vinext 1.3.0 → 1.4.0
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 +5 -2
- package/THIRD_PARTY_LICENSES.md +47 -0
- package/dist/_virtual/_rolldown/runtime.js +4 -3
- package/dist/build/action-owner-manifest.d.ts +3 -2
- package/dist/build/action-owner-manifest.js +18 -2
- package/dist/build/app-page-static-eligibility.d.ts +17 -1
- package/dist/build/app-page-static-eligibility.js +80 -13
- package/dist/build/clean-output.d.ts +2 -1
- package/dist/build/client-build-config.d.ts +13 -3
- package/dist/build/client-build-config.js +46 -9
- package/dist/build/client-reference-async.d.ts +48 -0
- package/dist/build/client-reference-async.js +123 -0
- package/dist/build/client-reference-chunks.d.ts +32 -0
- package/dist/build/client-reference-chunks.js +111 -0
- package/dist/build/client-reference-groups.d.ts +9 -1
- package/dist/build/client-reference-groups.js +40 -2
- package/dist/build/css-url-assets.d.ts +2 -1
- package/dist/build/google-fonts/fallback-metrics.d.ts +2 -1
- package/dist/build/google-fonts/find-font-files-in-css.d.ts +1 -0
- package/dist/build/google-fonts/find-font-files-in-css.js +17 -4
- package/dist/build/google-fonts/font-metadata.d.ts +2 -1
- package/dist/build/google-fonts/validate.d.ts +2 -1
- package/dist/build/inline-css.d.ts +2 -1
- package/dist/build/module-dependency-cache.d.ts +2 -1
- package/dist/build/next-client-runtime-manifests.d.ts +2 -1
- package/dist/build/precompress.d.ts +2 -1
- package/dist/build/precompress.js +1 -1
- package/dist/build/prerender-paths.d.ts +2 -1
- package/dist/build/prerender-phase.d.ts +2 -1
- package/dist/build/prerender-server-pool.js +1 -1
- package/dist/build/prerender.d.ts +3 -2
- package/dist/build/prerender.js +6 -5
- package/dist/build/report.d.ts +2 -15
- package/dist/build/report.js +1 -51
- package/dist/build/run-prerender.d.ts +2 -1
- package/dist/build/server-actions-encryption-key.d.ts +2 -1
- package/dist/build/ssr-manifest.js +25 -2
- package/dist/build/standalone.d.ts +2 -1
- package/dist/cache/cache-adapters-virtual.d.ts +2 -1
- package/dist/cache.js +1 -2
- package/dist/check.d.ts +2 -1
- package/dist/check.js +5 -1
- package/dist/cli-args.d.ts +2 -1
- package/dist/cli.js +5 -0
- package/dist/client/client-redirect-matcher.js +2 -1
- package/dist/client/client-redirects.d.ts +4 -3
- package/dist/client/client-redirects.js +2 -1
- package/dist/client/client-rewrites.d.ts +2 -1
- package/dist/client/dev-error-overlay-store.d.ts +2 -1
- package/dist/client/dev-error-overlay.js +1 -1
- package/dist/client/index.js +1 -2
- package/dist/client/instrumentation-client-state.js +5 -5
- package/dist/client/navigation-runtime.d.ts +16 -2
- package/dist/client/navigation-runtime.js +2 -2
- package/dist/client/pages-router-link-navigation.d.ts +2 -1
- package/dist/client/vinext-next-data.d.ts +25 -1
- package/dist/client/window-next.d.ts +2 -1
- package/dist/config/config-matchers.d.ts +12 -1
- package/dist/config/config-matchers.js +111 -16
- package/dist/config/dotenv.d.ts +2 -1
- package/dist/config/next-config.d.ts +32 -1
- package/dist/config/next-config.js +93 -5
- package/dist/config/tsconfig-paths.d.ts +2 -1
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-codec.js +327 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-data.js +123 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/index.js +29 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/internal.js +134 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-codec.js +50 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data-generated.js +455 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data.js +147 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/big5-added.json.js +169 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp936.json.js +2584 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp949.json.js +2220 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp950.json.js +227 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/eucjp.json.js +425 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gb18030-ranges.json.js +427 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gbk-added.json.js +229 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/shiftjis.json.js +292 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf16.js +106 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf7.js +182 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/bom-handling.js +42 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/extend-node.js +147 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/index.js +94 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/streams.js +95 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/detector.js +23 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/index.js +2 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/lookup.js +25 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/bmp.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/cur.js +15 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/dds.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/gif.js +12 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/heif.js +55 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/icns.js +76 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ico.js +39 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/index.js +46 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/j2c.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jp2.js +21 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jpg.js +71 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl-stream.js +42 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/jxl.js +46 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/ktx.js +19 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/png.js +28 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/pnm.js +54 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/psd.js +11 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/svg.js +79 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tga.js +15 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/tiff.js +96 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/utils.js +53 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/types/webp.js +45 -0
- package/dist/deps/.pnpm/image-size@2.0.4/deps/image-size/dist/esm/utils/bit-reader.js +38 -0
- package/dist/deps/.pnpm/safer-buffer@2.1.2/deps/safer-buffer/safer.js +45 -0
- package/dist/deps/.pnpm/ua-parser-js@1.0.35/deps/ua-parser-js/src/ua-parser.js +2 -2
- package/dist/entries/app-browser-entry.d.ts +20 -5
- package/dist/entries/app-browser-entry.js +79 -6
- package/dist/entries/app-rsc-entry.d.ts +2 -1
- package/dist/entries/app-rsc-entry.js +59 -60
- package/dist/entries/app-rsc-manifest.d.ts +2 -1
- package/dist/entries/app-rsc-manifest.js +56 -4
- package/dist/entries/app-ssr-entry.js +1 -0
- package/dist/entries/pages-entry-helpers.js +1 -2
- package/dist/entries/pages-server-entry.d.ts +2 -1
- package/dist/entries/pages-server-entry.js +34 -9
- package/dist/entries/runtime-entry-module.d.ts +1 -0
- package/dist/entries/runtime-entry-module.js +4 -1
- package/dist/image/image-adapters-virtual.d.ts +2 -1
- package/dist/index.js +184 -103
- package/dist/init-cloudflare.d.ts +1 -3
- package/dist/init-cloudflare.js +10 -48
- package/dist/init-platform.d.ts +2 -0
- package/dist/init-platform.js +4 -0
- package/dist/plugins/client-compile-hints.d.ts +30 -0
- package/dist/plugins/client-compile-hints.js +88 -0
- package/dist/plugins/client-reference-dedup.d.ts +2 -1
- package/dist/plugins/cloudflare-dev-module-urls.d.ts +2 -1
- package/dist/plugins/dynamic-preload-metadata.d.ts +3 -1
- package/dist/plugins/dynamic-preload-metadata.js +1 -1
- package/dist/plugins/environment.d.ts +2 -1
- package/dist/plugins/extensionless-dynamic-import.js +6 -2
- package/dist/plugins/fonts.js +9 -12
- package/dist/plugins/ignore-dynamic-requests.d.ts +2 -1
- package/dist/plugins/import-meta-url.d.ts +2 -1
- package/dist/plugins/next-intl-catalog.d.ts +12 -0
- package/dist/plugins/next-intl-catalog.js +85 -0
- package/dist/plugins/og-assets.d.ts +2 -1
- package/dist/plugins/og-assets.js +2 -3
- package/dist/plugins/optimize-imports.d.ts +2 -1
- package/dist/plugins/pages-node-externals.d.ts +3 -1
- package/dist/plugins/pages-node-externals.js +1 -1
- package/dist/plugins/remove-console.d.ts +2 -1
- package/dist/plugins/require-condition-resolution.d.ts +2 -1
- package/dist/plugins/rsc-client-reference-loaders.d.ts +8 -0
- package/dist/plugins/rsc-client-reference-loaders.js +170 -68
- package/dist/plugins/rsc-client-shim-excludes.js +2 -0
- package/dist/plugins/sass.d.ts +2 -1
- package/dist/plugins/strip-server-exports.d.ts +2 -1
- package/dist/plugins/styled-jsx.d.ts +2 -1
- package/dist/plugins/transform-result.d.ts +2 -1
- package/dist/plugins/typeof-window.d.ts +2 -1
- package/dist/plugins/use-cache-callable.d.ts +1 -1
- package/dist/plugins/use-cache-callable.js +136 -94
- package/dist/plugins/worker-image-imports.js +1 -1
- package/dist/plugins/worker-use-server.d.ts +2 -1
- package/dist/routing/app-route-graph.d.ts +46 -0
- package/dist/routing/app-route-graph.js +131 -51
- package/dist/routing/browser-route-manifest.d.ts +2 -1
- package/dist/routing/optimistic-route-trie.d.ts +2 -1
- package/dist/routing/route-matching.d.ts +2 -1
- package/dist/routing/route-pattern.d.ts +2 -1
- package/dist/server/accept-encoding.d.ts +2 -1
- package/dist/server/api-handler.js +19 -4
- package/dist/server/app-action-forwarding.d.ts +2 -1
- package/dist/server/app-bfcache-identity.d.ts +2 -1
- package/dist/server/app-bfcache-identity.js +1 -1
- package/dist/server/app-browser-action-result.d.ts +2 -1
- package/dist/server/app-browser-entry.js +106 -66
- package/dist/server/app-browser-error.d.ts +2 -1
- package/dist/server/app-browser-history-controller.d.ts +7 -5
- package/dist/server/app-browser-history-controller.js +93 -15
- package/dist/server/app-browser-hydration.d.ts +2 -1
- package/dist/server/app-browser-interception-context.d.ts +2 -1
- package/dist/server/app-browser-navigation-controller.d.ts +2 -2
- package/dist/server/app-browser-navigation-controller.js +16 -12
- package/dist/server/app-browser-popstate.d.ts +2 -1
- package/dist/server/app-browser-rsc-redirect.d.ts +2 -1
- package/dist/server/app-browser-rsc-redirect.js +4 -4
- package/dist/server/app-browser-server-action-client.d.ts +4 -1
- package/dist/server/app-browser-server-action-client.js +4 -3
- package/dist/server/app-browser-state.d.ts +2 -4
- package/dist/server/app-browser-state.js +9 -4
- package/dist/server/app-browser-stream.d.ts +2 -1
- package/dist/server/app-browser-supplemental-refresh.js +16 -1
- package/dist/server/app-browser-visible-commit.d.ts +3 -2
- package/dist/server/app-browser-visible-commit.js +2 -12
- package/dist/server/app-client-reference-manifest.d.ts +31 -0
- package/dist/server/app-client-reference-manifest.js +46 -0
- package/dist/server/app-client-reference-preloader.d.ts +25 -5
- package/dist/server/app-client-reference-preloader.js +22 -7
- package/dist/server/app-elements-wire.d.ts +8 -39
- package/dist/server/app-elements-wire.js +4 -41
- package/dist/server/app-elements.d.ts +4 -2
- package/dist/server/app-elements.js +4 -2
- package/dist/server/app-fallback-renderer.d.ts +9 -2
- package/dist/server/app-fallback-renderer.js +4 -1
- package/dist/server/app-history-state.d.ts +4 -3
- package/dist/server/app-history-state.js +5 -2
- package/dist/server/app-inline-css-client.d.ts +2 -1
- package/dist/server/app-metadata-tracing.d.ts +2 -1
- package/dist/server/app-mounted-layouts.d.ts +21 -0
- package/dist/server/app-mounted-layouts.js +67 -0
- package/dist/server/app-optimistic-routing.d.ts +37 -2
- package/dist/server/app-optimistic-routing.js +75 -2
- package/dist/server/app-page-boundary-render.d.ts +20 -2
- package/dist/server/app-page-boundary-render.js +224 -40
- package/dist/server/app-page-boundary.d.ts +34 -5
- package/dist/server/app-page-boundary.js +41 -8
- package/dist/server/app-page-cache-finalizer.d.ts +14 -2
- package/dist/server/app-page-cache-finalizer.js +71 -30
- package/dist/server/app-page-cache-render.d.ts +10 -2
- package/dist/server/app-page-cache-render.js +14 -2
- package/dist/server/app-page-cache.d.ts +13 -1
- package/dist/server/app-page-cache.js +33 -11
- package/dist/server/app-page-dispatch.d.ts +39 -11
- package/dist/server/app-page-dispatch.js +236 -177
- package/dist/server/app-page-element-builder.d.ts +19 -3
- package/dist/server/app-page-element-builder.js +193 -71
- package/dist/server/app-page-execution.d.ts +43 -51
- package/dist/server/app-page-execution.js +205 -92
- package/dist/server/app-page-head.d.ts +108 -3
- package/dist/server/app-page-head.js +337 -154
- package/dist/server/app-page-http-access-fallback-metadata.d.ts +49 -2
- package/dist/server/app-page-http-access-fallback-metadata.js +77 -2
- package/dist/server/app-page-layout-gate.d.ts +35 -0
- package/dist/server/app-page-layout-gate.js +50 -0
- package/dist/server/app-page-method.d.ts +2 -1
- package/dist/server/app-page-params.d.ts +0 -1
- package/dist/server/app-page-params.js +1 -14
- package/dist/server/app-page-probe.d.ts +5 -22
- package/dist/server/app-page-probe.js +4 -37
- package/dist/server/app-page-render-identity.d.ts +2 -1
- package/dist/server/app-page-render.d.ts +9 -13
- package/dist/server/app-page-render.js +108 -214
- package/dist/server/app-page-request.d.ts +15 -4
- package/dist/server/app-page-request.js +2 -2
- package/dist/server/app-page-response.js +3 -3
- package/dist/server/app-page-route-wiring.d.ts +65 -8
- package/dist/server/app-page-route-wiring.js +259 -103
- package/dist/server/app-page-rsc-render-status.d.ts +29 -2
- package/dist/server/app-page-rsc-render-status.js +121 -13
- package/dist/server/app-page-search-params-observation.d.ts +7 -2
- package/dist/server/app-page-search-params-observation.js +8 -1
- package/dist/server/app-page-segment-plan.d.ts +2 -1
- package/dist/server/app-page-stream.d.ts +33 -1
- package/dist/server/app-page-stream.js +25 -6
- package/dist/server/app-pages-bridge.d.ts +6 -1
- package/dist/server/app-pages-bridge.js +7 -3
- package/dist/server/app-ppr-fallback-shell-render.d.ts +2 -1
- package/dist/server/app-ppr-fallback-shell.d.ts +2 -1
- package/dist/server/app-prerender-endpoints.d.ts +2 -1
- package/dist/server/app-prerender-static-params.d.ts +2 -1
- package/dist/server/app-render-dependency.d.ts +21 -4
- package/dist/server/app-render-dependency.js +100 -33
- package/dist/server/app-request-stage-dispatch.js +1 -1
- package/dist/server/app-request-stage-independent-entry.d.ts +2 -1
- package/dist/server/app-response-stage-entry.d.ts +2 -1
- package/dist/server/app-route-handler-cache.d.ts +2 -1
- package/dist/server/app-route-handler-cache.js +2 -2
- package/dist/server/app-route-handler-dispatch.d.ts +2 -1
- package/dist/server/app-route-handler-dispatch.js +15 -10
- package/dist/server/app-route-handler-execution.d.ts +2 -1
- package/dist/server/app-route-handler-execution.js +8 -3
- package/dist/server/app-route-handler-policy.d.ts +1 -1
- package/dist/server/app-route-handler-policy.js +3 -3
- package/dist/server/app-route-handler-response.d.ts +2 -1
- package/dist/server/app-route-handler-response.js +1 -1
- package/dist/server/app-route-handler-runtime.d.ts +2 -1
- package/dist/server/app-route-handler-runtime.js +17 -4
- package/dist/server/app-route-module-loader.d.ts +18 -1
- package/dist/server/app-route-module-loader.js +8 -0
- package/dist/server/app-route-tree-prefetch.d.ts +2 -1
- package/dist/server/app-rsc-cache-busting.d.ts +2 -2
- package/dist/server/app-rsc-cache-busting.js +4 -4
- package/dist/server/app-rsc-error-handler.d.ts +4 -2
- package/dist/server/app-rsc-error-handler.js +9 -1
- package/dist/server/app-rsc-errors.d.ts +10 -1
- package/dist/server/app-rsc-errors.js +8 -1
- package/dist/server/app-rsc-handler.d.ts +7 -6
- package/dist/server/app-rsc-handler.js +36 -34
- package/dist/server/app-rsc-request-normalization.d.ts +0 -4
- package/dist/server/app-rsc-request-normalization.js +1 -4
- package/dist/server/app-rsc-response-finalizer.d.ts +2 -1
- package/dist/server/app-rsc-response-finalizer.js +2 -2
- package/dist/server/app-rsc-response-stage.js +5 -3
- package/dist/server/app-rsc-route-matching.d.ts +38 -1
- package/dist/server/app-rsc-route-matching.js +24 -0
- package/dist/server/app-segment-config.d.ts +2 -1
- package/dist/server/app-segment-config.js +1 -14
- package/dist/server/app-server-action-execution.d.ts +5 -2
- package/dist/server/app-server-action-execution.js +10 -7
- package/dist/server/app-ssr-entry.d.ts +8 -0
- package/dist/server/app-ssr-entry.js +98 -50
- package/dist/server/app-ssr-error-meta.d.ts +2 -1
- package/dist/server/app-ssr-search-params-gate.d.ts +2 -1
- package/dist/server/app-ssr-stream.d.ts +22 -10
- package/dist/server/app-ssr-stream.js +300 -68
- package/dist/server/app-static-generation.d.ts +2 -1
- package/dist/server/app-streamed-client-references.d.ts +39 -0
- package/dist/server/app-streamed-client-references.js +156 -0
- package/dist/server/app-visited-response-cache.d.ts +38 -2
- package/dist/server/app-visited-response-cache.js +46 -5
- package/dist/server/app-worker-stages.d.ts +27 -4
- package/dist/server/app-worker-stages.js +45 -6
- package/dist/server/artifact-compatibility.d.ts +2 -2
- package/dist/server/artifact-compatibility.js +1 -10
- package/dist/server/bfcache-identity.d.ts +2 -1
- package/dist/server/cache-headers.d.ts +2 -1
- package/dist/server/cache-proof.d.ts +1 -115
- package/dist/server/cache-proof.js +1 -544
- package/dist/server/cacheability-request.d.ts +2 -1
- package/dist/server/cacheability-request.js +13 -8
- package/dist/server/config-headers.d.ts +2 -1
- package/dist/server/csp.d.ts +2 -1
- package/dist/server/default-global-not-found-module.d.ts +2 -1
- package/dist/server/default-http-access-fallback-modules.d.ts +33 -0
- package/dist/server/default-http-access-fallback-modules.js +31 -0
- package/dist/server/defer-until-stream-consumed.d.ts +34 -0
- package/dist/server/defer-until-stream-consumed.js +154 -21
- package/dist/server/dev-lockfile.d.ts +32 -2
- package/dist/server/dev-lockfile.js +46 -2
- package/dist/server/dev-module-runner.d.ts +2 -1
- package/dist/server/dev-server.js +14 -6
- package/dist/server/fetch-handler.js +1 -2
- package/dist/server/file-based-metadata.d.ts +2 -1
- package/dist/server/framework-tracer.d.ts +2 -1
- package/dist/server/headers.d.ts +6 -3
- package/dist/server/headers.js +9 -5
- package/dist/server/html.d.ts +1 -0
- package/dist/server/html.js +19 -1
- package/dist/server/http-conditional.d.ts +2 -1
- package/dist/server/http-error-responses.d.ts +2 -1
- package/dist/server/implicit-tags.d.ts +2 -1
- package/dist/server/isr-cache.d.ts +8 -2
- package/dist/server/isr-cache.js +26 -1
- package/dist/server/metadata-route-build-data.d.ts +2 -1
- package/dist/server/metadata-route-build-data.js +1 -1
- package/dist/server/metadata-route-response.d.ts +2 -1
- package/dist/server/metadata-route-response.js +32 -15
- package/dist/server/metadata-routes.d.ts +2 -1
- package/dist/server/middleware-runtime.d.ts +2 -1
- package/dist/server/multi-stage.d.ts +52 -11
- package/dist/server/multi-stage.js +13 -1
- package/dist/server/navigation-planner.js +1 -1
- package/dist/server/navigation-trace.d.ts +2 -1
- package/dist/server/next-error-digest.d.ts +2 -1
- package/dist/server/nitro-public-files-plugin.d.ts +2 -1
- package/dist/server/nitro-public-files.d.ts +2 -1
- package/dist/server/opentelemetry-api.d.ts +2 -1
- package/dist/server/operation-token.d.ts +2 -1
- package/dist/server/pages-api-route.d.ts +2 -1
- package/dist/server/pages-api-route.js +28 -19
- package/dist/server/pages-asset-tags.d.ts +2 -1
- package/dist/server/pages-body-parser-config.d.ts +2 -1
- package/dist/server/pages-client-assets.d.ts +4 -0
- package/dist/server/pages-data-route.d.ts +2 -1
- package/dist/server/pages-document-asset-props.d.ts +2 -1
- package/dist/server/pages-document-initial-props.d.ts +2 -1
- package/dist/server/pages-execution-tracing.d.ts +2 -1
- package/dist/server/pages-execution-tracing.js +1 -1
- package/dist/server/pages-get-initial-props.d.ts +2 -1
- package/dist/server/pages-media-type.d.ts +21 -1
- package/dist/server/pages-media-type.js +69 -5
- package/dist/server/pages-node-compat.js +52 -27
- package/dist/server/pages-page-data.d.ts +7 -1
- package/dist/server/pages-page-data.js +35 -12
- package/dist/server/pages-page-handler.d.ts +3 -2
- package/dist/server/pages-page-handler.js +27 -27
- package/dist/server/pages-page-method.d.ts +2 -1
- package/dist/server/pages-page-response.d.ts +2 -1
- package/dist/server/pages-preview.d.ts +2 -1
- package/dist/server/pages-readiness.d.ts +2 -1
- package/dist/server/pages-request-pipeline.d.ts +10 -1
- package/dist/server/pages-request-pipeline.js +6 -7
- package/dist/server/pages-request-stage-entry.d.ts +2 -1
- package/dist/server/pages-request-stage-entry.js +14 -12
- package/dist/server/pages-response-stage-entry.d.ts +2 -1
- package/dist/server/pages-response-stage-entry.js +9 -3
- package/dist/server/pages-route-data-kind.d.ts +2 -1
- package/dist/server/prerender-cache-life-header.d.ts +2 -1
- package/dist/server/prerender-route-params.d.ts +2 -1
- package/dist/server/prod-server.js +14 -4
- package/dist/server/request-log.d.ts +2 -1
- package/dist/server/request-pipeline.d.ts +6 -0
- package/dist/server/request-pipeline.js +21 -1
- package/dist/server/request-tracing.d.ts +2 -1
- package/dist/server/request-tracing.js +1 -1
- package/dist/server/response-start-tracing.js +7 -29
- package/dist/server/rsc-render-stream.d.ts +4 -0
- package/dist/server/rsc-render-stream.js +25 -0
- package/dist/server/seed-cache.d.ts +2 -1
- package/dist/server/seed-cache.js +1 -1
- package/dist/server/shared-cache-identity.d.ts +23 -0
- package/dist/server/shared-cache-identity.js +36 -0
- package/dist/server/static-file-cache.d.ts +2 -1
- package/dist/server/static-file-cache.js +1 -0
- package/dist/server/worker-revalidation-context.d.ts +2 -1
- package/dist/server/worker-stages.d.ts +18 -4
- package/dist/server/worker-stages.js +23 -4
- package/dist/shims/app.d.ts +2 -1
- package/dist/shims/cache-callable-runtime.d.ts +2 -1
- package/dist/shims/cache-handler.d.ts +8 -3
- package/dist/shims/cache-handler.js +31 -11
- package/dist/shims/cache-request-state.d.ts +17 -20
- package/dist/shims/cache-request-state.js +16 -21
- package/dist/shims/cache-runtime.js +27 -11
- package/dist/shims/cache.d.ts +8 -7
- package/dist/shims/cache.js +17 -19
- package/dist/shims/cacheability-classification.d.ts +2 -0
- package/dist/shims/caught-not-found-boundaries.d.ts +15 -0
- package/dist/shims/caught-not-found-boundaries.js +48 -0
- package/dist/shims/cdn-cache.d.ts +22 -5
- package/dist/shims/cdn-purge-routes.d.ts +2 -1
- package/dist/shims/client-locale.js +2 -1
- package/dist/shims/client-page-root.d.ts +2 -1
- package/dist/shims/client-page-root.js +2 -2
- package/dist/shims/config.d.ts +2 -1
- package/dist/shims/default-forbidden.d.ts +4 -0
- package/dist/shims/default-forbidden.js +18 -0
- package/dist/shims/default-not-found.d.ts +0 -5
- package/dist/shims/default-not-found.js +5 -41
- package/dist/shims/default-unauthorized.d.ts +4 -0
- package/dist/shims/default-unauthorized.js +18 -0
- package/dist/shims/dynamic.js +9 -6
- package/dist/shims/error-boundary.d.ts +39 -3
- package/dist/shims/error-boundary.js +33 -18
- package/dist/shims/fetch-cache-state.d.ts +5 -1
- package/dist/shims/fetch-cache-state.js +1 -3
- package/dist/shims/fetch-cache.d.ts +2 -1
- package/dist/shims/fetch-cache.js +34 -24
- package/dist/shims/font-google.js +1 -2
- package/dist/shims/font-utils.d.ts +3 -2
- package/dist/shims/font-utils.js +5 -3
- package/dist/shims/form.js +3 -3
- package/dist/shims/headers.d.ts +8 -23
- package/dist/shims/headers.js +17 -67
- package/dist/shims/http-access-error-fallback.d.ts +7 -0
- package/dist/shims/http-access-error-fallback.js +47 -0
- package/dist/shims/image.d.ts +1 -22
- package/dist/shims/internal/app-prefetch-fetch-queue.d.ts +22 -2
- package/dist/shims/internal/app-prefetch-fetch-queue.js +71 -18
- package/dist/shims/internal/app-route-prefetch-policy.d.ts +14 -3
- package/dist/shims/internal/app-route-prefetch-policy.js +29 -4
- package/dist/shims/internal/cache-context-accessor.d.ts +2 -1
- package/dist/shims/internal/client-reference-loader.d.ts +7 -0
- package/dist/shims/internal/client-reference-loader.js +91 -0
- package/dist/shims/internal/cookie-serialize.d.ts +2 -1
- package/dist/shims/internal/cookies.js +1 -2
- package/dist/shims/internal/headers-state.d.ts +2 -0
- package/dist/shims/internal/headers-state.js +6 -1
- package/dist/shims/internal/hybrid-client-route-owner-direct.d.ts +2 -1
- package/dist/shims/internal/interpolate-as.d.ts +2 -1
- package/dist/shims/internal/navigation-untracked.js +1 -1
- package/dist/shims/internal/pages-data-target.d.ts +2 -1
- package/dist/shims/internal/pages-data-url.d.ts +2 -1
- package/dist/shims/internal/thenable-well-known-properties.d.ts +2 -1
- package/dist/shims/link.js +197 -52
- package/dist/shims/metadata.d.ts +52 -29
- package/dist/shims/metadata.js +142 -42
- package/dist/shims/navigation-errors.d.ts +2 -1
- package/dist/shims/navigation-server.js +1 -1
- package/dist/shims/navigation.d.ts +95 -8
- package/dist/shims/navigation.js +255 -47
- package/dist/shims/navigation.react-server.js +2 -2
- package/dist/shims/pages-router-runtime.d.ts +2 -1
- package/dist/shims/ppr-fallback-shell.d.ts +2 -1
- package/dist/shims/request-state-types.d.ts +2 -2
- package/dist/shims/router.js +14 -3
- package/dist/shims/slot.d.ts +12 -0
- package/dist/shims/slot.js +37 -9
- package/dist/shims/unified-request-context.d.ts +1 -1
- package/dist/shims/unified-request-context.js +5 -6
- package/dist/typegen.d.ts +2 -1
- package/dist/utils/cache-control-metadata.d.ts +5 -0
- package/dist/utils/cache-control-metadata.js +9 -1
- package/dist/utils/client-build-manifest.d.ts +4 -1
- package/dist/utils/client-build-manifest.js +9 -2
- package/dist/utils/client-entry-manifest.d.ts +13 -0
- package/dist/utils/client-entry-manifest.js +20 -1
- package/dist/utils/client-reference-chunks.d.ts +45 -0
- package/dist/utils/client-reference-chunks.js +30 -0
- package/dist/utils/client-runtime-metadata.d.ts +9 -1
- package/dist/utils/client-runtime-metadata.js +40 -9
- package/dist/utils/compare.d.ts +9 -0
- package/dist/utils/compare.js +15 -1
- package/dist/utils/lazy-chunks.d.ts +14 -0
- package/dist/utils/lazy-chunks.js +27 -1
- package/dist/utils/middleware-request-headers.d.ts +2 -1
- package/dist/utils/project.d.ts +4 -3
- package/dist/utils/project.js +12 -17
- package/dist/utils/query.d.ts +2 -1
- package/dist/utils/regex.d.ts +5 -0
- package/dist/utils/regex.js +11 -1
- package/dist/utils/text-stream.d.ts +10 -5
- package/dist/utils/text-stream.js +6 -6
- package/dist/utils/vite-cli-invocation.d.ts +2 -1
- package/package.json +6 -5
- package/dist/build/layout-classification-types.d.ts +0 -60
- package/dist/build/layout-classification-types.js +0 -1
- package/dist/build/layout-classification.d.ts +0 -61
- package/dist/build/layout-classification.js +0 -98
- package/dist/build/route-classification-injector.d.ts +0 -32
- package/dist/build/route-classification-injector.js +0 -59
- package/dist/build/route-classification-manifest.d.ts +0 -53
- package/dist/build/route-classification-manifest.js +0 -143
- package/dist/deps/.pnpm/image-size@2.0.2/deps/image-size/dist/index.js +0 -808
- package/dist/server/app-browser-client-reuse-manifest.d.ts +0 -10
- package/dist/server/app-browser-client-reuse-manifest.js +0 -101
- package/dist/server/app-layout-param-observation.d.ts +0 -41
- package/dist/server/app-layout-param-observation.js +0 -168
- package/dist/server/client-reuse-manifest.d.ts +0 -102
- package/dist/server/client-reuse-manifest.js +0 -209
- package/dist/server/default-not-found-module.d.ts +0 -19
- package/dist/server/default-not-found-module.js +0 -18
- package/dist/server/rsc-stream-hints.d.ts +0 -21
- package/dist/server/rsc-stream-hints.js +0 -227
- package/dist/server/skip-cache-proof.d.ts +0 -60
- package/dist/server/skip-cache-proof.js +0 -168
- package/dist/server/static-layout-client-reuse-proof.d.ts +0 -13
- package/dist/server/static-layout-client-reuse-proof.js +0 -33
- package/dist/utils/sorted-array.d.ts +0 -7
- package/dist/utils/sorted-array.js +0 -20
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { APP_RSC_RENDER_MODE_PREFETCH_EMPTY, APP_RSC_RENDER_MODE_PREFETCH_LOADING_SHELL } from "./app-rsc-render-mode.js";
|
|
2
2
|
import { fnv1a64 } from "../utils/hash.js";
|
|
3
3
|
import { createInlineScriptTag, escapeHtmlAttr } from "./html.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { APP_PREFETCH_LOADING_SHELL_MARKER_KEY } from "./app-elements.js";
|
|
7
|
-
import DefaultGlobalError from "../shims/default-global-error.js";
|
|
8
|
-
import { ErrorBoundary, ForbiddenBoundary, GlobalErrorBoundary, NotFoundBoundary, RedirectBoundary, UnauthorizedBoundary } from "../shims/error-boundary.js";
|
|
4
|
+
import { APP_LAYOUT_IDS_KEY, APP_ROOT_LAYOUT_KEY, APP_SKIPPED_LAYOUT_IDS_KEY, APP_STATIC_SIBLINGS_KEY, AppElementsWire, normalizeAppElementsSlotBindings } from "./app-elements-wire.js";
|
|
5
|
+
import { APP_PREFETCH_LOADING_SHELL_MARKER_KEY, APP_STREAMING_METADATA_BODY_ID_PREFIX } from "./app-elements.js";
|
|
9
6
|
import { AppRouterScrollTarget } from "../shims/app-router-scroll.js";
|
|
10
|
-
import
|
|
7
|
+
import { hashMountedLayoutIdentity } from "./app-mounted-layouts.js";
|
|
8
|
+
import { BfcacheChildrenBoundary, BfcacheSegmentBoundary, Children as Children$1, ParallelSlot, Slot } from "../shims/slot.js";
|
|
9
|
+
import { APP_PAGE_SEGMENT_KEY, isAppPageRouteGroupSegment, resolveAppPageChildSegments, resolveAppPageSegmentStateKey, resolveAppPageTemplateStateKey } from "./app-page-segment-state.js";
|
|
10
|
+
import DefaultGlobalError from "../shims/default-global-error.js";
|
|
11
|
+
import { ErrorBoundary, ForbiddenBoundary, GlobalErrorBoundary, HttpAccessFallbackPassthrough, NotFoundBoundary, RedirectBoundary, UnauthorizedBoundary } from "../shims/error-boundary.js";
|
|
11
12
|
import { LayoutSegmentProvider } from "../shims/layout-segment-context.js";
|
|
12
13
|
import { withUseCacheLayoutMarker } from "../shims/internal/app-page-props-cache-key.js";
|
|
13
14
|
import { MetadataHead, ViewportHead, renderMetadataToHtml } from "../shims/metadata.js";
|
|
14
|
-
import {
|
|
15
|
+
import { APP_PAGE_NOT_FOUND_BOUNDARY_ID, tagAppPageLayoutError, tagAppPageSlotError } from "./app-page-execution.js";
|
|
16
|
+
import { resolveAppPageBranchParams, resolveAppPageSegmentParams } from "./app-page-params.js";
|
|
17
|
+
import DefaultForbidden from "../shims/default-forbidden.js";
|
|
18
|
+
import DefaultNotFound from "../shims/default-not-found.js";
|
|
19
|
+
import DefaultUnauthorized from "../shims/default-unauthorized.js";
|
|
15
20
|
import { StreamedIconsInsertion } from "../shims/streamed-icons.js";
|
|
16
|
-
import {
|
|
21
|
+
import { createAppRenderDependency, invokeAppComponentMappingErrors, isReactOwnedAppComponent, renderAfterAppDependencies, renderAppComponentWithDependencyBarrier } from "./app-render-dependency.js";
|
|
22
|
+
import { createAppPageLayoutGate, registerAppPageLayoutGate } from "./app-page-layout-gate.js";
|
|
17
23
|
import { probeReactServerSubtree } from "./app-page-probe.js";
|
|
18
|
-
import { APP_PAGE_SEGMENT_KEY, resolveAppPageChildSegments, resolveAppPageSegmentStateKey, resolveAppPageTemplateStateKey } from "./app-page-segment-state.js";
|
|
19
24
|
import { createAppPageSegmentPlan } from "./app-page-segment-plan.js";
|
|
20
25
|
import { resolveAppPageModuleTraceSegment, traceGetLayoutOrPageModule } from "./app-page-tracing.js";
|
|
21
26
|
import { Fragment, Suspense } from "react";
|
|
@@ -25,9 +30,37 @@ const APP_PAGE_SLOT_SEGMENT_KEY = "(__SLOT__)";
|
|
|
25
30
|
const APP_PAGE_LAYOUT_PROBE_CHILD = /* @__PURE__ */ jsx(Fragment, {});
|
|
26
31
|
const DEFAULT_GLOBAL_ERROR_COMPONENT = DefaultGlobalError;
|
|
27
32
|
const DEFAULT_NOT_FOUND_COMPONENT = DefaultNotFound;
|
|
33
|
+
const DEFAULT_FORBIDDEN_COMPONENT = DefaultForbidden;
|
|
34
|
+
const DEFAULT_UNAUTHORIZED_COMPONENT = DefaultUnauthorized;
|
|
28
35
|
function resolveSlotLayoutParams(routeSegments, treePosition, params) {
|
|
29
36
|
return resolveAppPageBranchParams(routeSegments, treePosition, params);
|
|
30
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* A parallel slot's layout, whose notFound(), forbidden() and unauthorized()
|
|
40
|
+
* are caught above the layout that renders the slot, as its page's are. Next.js
|
|
41
|
+
* attaches the slot's own boundaries inside that layout, so they never catch it.
|
|
42
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/create-component-tree.tsx
|
|
43
|
+
*/
|
|
44
|
+
function createSlotLayoutElement(LayoutComponent, props, slotLayoutIndex, notFoundBoundary) {
|
|
45
|
+
if (slotLayoutIndex === void 0 || isReactOwnedAppComponent(LayoutComponent)) return /* @__PURE__ */ jsx(LayoutComponent, { ...props });
|
|
46
|
+
const SlotLayoutInvoker = () => invokeAppComponentMappingErrors(LayoutComponent, props, (error) => tagAppPageSlotError(error, slotLayoutIndex, notFoundBoundary));
|
|
47
|
+
return /* @__PURE__ */ jsx(SlotLayoutInvoker, {});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A route layout, whose notFound(), forbidden() and unauthorized() are caught
|
|
51
|
+
* above it: its own boundaries wrap only its `children`. The layout's index
|
|
52
|
+
* tags what it throws, so the response's fallback finds that boundary from the
|
|
53
|
+
* render. `onSettled` hears how the layout rendered.
|
|
54
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/create-component-tree.tsx
|
|
55
|
+
*/
|
|
56
|
+
function createRouteLayoutElement(LayoutComponent, props, layoutIndex, dependency, onSettled) {
|
|
57
|
+
const mapError = (error) => tagAppPageLayoutError(error, layoutIndex);
|
|
58
|
+
if (dependency) return renderAppComponentWithDependencyBarrier(LayoutComponent, props, dependency, mapError, onSettled);
|
|
59
|
+
if (isReactOwnedAppComponent(LayoutComponent)) return /* @__PURE__ */ jsx(LayoutComponent, { ...props });
|
|
60
|
+
const RouteLayoutInvoker = () => invokeAppComponentMappingErrors(LayoutComponent, props, mapError, onSettled);
|
|
61
|
+
RouteLayoutInvoker.displayName = LayoutComponent.displayName ?? LayoutComponent.name;
|
|
62
|
+
return /* @__PURE__ */ jsx(RouteLayoutInvoker, {});
|
|
63
|
+
}
|
|
31
64
|
function getDefaultExport(module) {
|
|
32
65
|
return module?.default ?? null;
|
|
33
66
|
}
|
|
@@ -39,37 +72,19 @@ function createAppPageTreePath(routeSegments, treePosition) {
|
|
|
39
72
|
if (treePathSegments.length === 0) return "/";
|
|
40
73
|
return `/${treePathSegments.join("/")}`;
|
|
41
74
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
function
|
|
47
|
-
options.layoutParamAccess?.recordLayoutParamScope(options.layoutId, resolveAppPageSegmentParamScopeKeys(options.routeSegments, options.treePosition));
|
|
48
|
-
const revalidateSeconds = readFiniteRevalidateSeconds(options.layoutModule);
|
|
49
|
-
if (revalidateSeconds !== null) options.layoutParamAccess?.recordLayoutFiniteRevalidate(options.layoutId, revalidateSeconds);
|
|
50
|
-
}
|
|
51
|
-
function probeAppPageLayoutWithTracking(options) {
|
|
75
|
+
/**
|
|
76
|
+
* Renders the layout at `layoutIndex` with a placeholder for its children, so
|
|
77
|
+
* whatever it or a component it renders throws comes out.
|
|
78
|
+
*/
|
|
79
|
+
function probeAppPageLayout(options) {
|
|
52
80
|
const treePosition = options.route.layoutTreePositions?.[options.layoutIndex] ?? 0;
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
layoutId,
|
|
61
|
-
layoutModule,
|
|
62
|
-
layoutParamAccess: options.layoutParamAccess,
|
|
63
|
-
routeSegments: options.route.routeSegments,
|
|
64
|
-
treePosition
|
|
65
|
-
});
|
|
66
|
-
const layoutParams = resolveAppPageSegmentParams(options.route.routeSegments, treePosition, options.matchedParams);
|
|
67
|
-
return probeReactServerSubtree(/* @__PURE__ */ jsx(LayoutComponent, {
|
|
68
|
-
...withUseCacheLayoutMarker(LayoutComponent, { params: options.makeThenableParams(layoutParams, options.layoutParamAccess?.createThenableParamsObserver(layoutId)) }),
|
|
69
|
-
children: APP_PAGE_LAYOUT_PROBE_CHILD
|
|
70
|
-
}));
|
|
71
|
-
};
|
|
72
|
-
return options.layoutParamAccess ? options.layoutParamAccess.runLayoutProbe(layoutId, probe) : probe();
|
|
81
|
+
const LayoutComponent = getDefaultExport(options.route.layouts[options.layoutIndex]);
|
|
82
|
+
if (!LayoutComponent) return null;
|
|
83
|
+
const layoutParams = resolveAppPageSegmentParams(options.route.routeSegments, treePosition, options.matchedParams);
|
|
84
|
+
return probeReactServerSubtree(/* @__PURE__ */ jsx(LayoutComponent, {
|
|
85
|
+
...withUseCacheLayoutMarker(LayoutComponent, { params: options.makeThenableParams(layoutParams) }),
|
|
86
|
+
children: APP_PAGE_LAYOUT_PROBE_CHILD
|
|
87
|
+
}));
|
|
73
88
|
}
|
|
74
89
|
function createAppPageLayoutEntries(route) {
|
|
75
90
|
return route.layouts.map((layoutModule, index) => {
|
|
@@ -266,7 +281,7 @@ async function AppPageHead(props) {
|
|
|
266
281
|
metadata,
|
|
267
282
|
pathname: props.pathname,
|
|
268
283
|
trailingSlash: props.trailingSlash
|
|
269
|
-
}) : null, /* @__PURE__ */ jsx(ViewportHead, { viewport })] });
|
|
284
|
+
}) : null, viewport ? /* @__PURE__ */ jsx(ViewportHead, { viewport }) : null] });
|
|
270
285
|
}
|
|
271
286
|
AppPageHead.displayName = "Vinext.Head";
|
|
272
287
|
function hasStreamedIcons(metadata) {
|
|
@@ -360,10 +375,58 @@ function buildAppPageElements(options) {
|
|
|
360
375
|
for (const templateEntry of templateEntries) templateEntriesByTreePosition.set(templateEntry.treePosition, templateEntry);
|
|
361
376
|
for (const loadingEntry of loadingEntries) loadingEntriesByTreePosition.set(loadingEntry.treePosition, loadingEntry);
|
|
362
377
|
for (const errorEntry of errorEntries) errorEntriesByTreePosition.set(errorEntry.treePosition, errorEntry);
|
|
378
|
+
const isOutermostEntryBelowLoading = (loadingTreePosition, treePosition, kind) => {
|
|
379
|
+
const enclosesEntry = (entryTreePosition, sameSegmentEncloses) => entryTreePosition > loadingTreePosition && (entryTreePosition < treePosition || sameSegmentEncloses && entryTreePosition === treePosition);
|
|
380
|
+
return !layoutEntries.some((entry) => getDefaultExport(entry.layoutModule) && enclosesEntry(entry.treePosition, kind !== "layout")) && !templateEntries.some((entry) => getDefaultExport(entry.templateModule) && enclosesEntry(entry.treePosition, kind === "page"));
|
|
381
|
+
};
|
|
363
382
|
const layoutIndicesByTreePosition = /* @__PURE__ */ new Map();
|
|
364
383
|
for (let index = 0; index < layoutEntries.length; index++) layoutIndicesByTreePosition.set(layoutEntries[index].treePosition, index);
|
|
384
|
+
const resolveAccessBoundaries = (segmentModules, segmentTreePositions, getLayoutModule, builtInComponent) => {
|
|
385
|
+
const files = /* @__PURE__ */ new Map();
|
|
386
|
+
if (segmentTreePositions) for (const [index, treePosition] of segmentTreePositions.entries()) {
|
|
387
|
+
const module = segmentModules?.[index];
|
|
388
|
+
if (module && getDefaultExport(module)) files.set(treePosition, module);
|
|
389
|
+
}
|
|
390
|
+
else for (const entry of layoutEntries) {
|
|
391
|
+
const module = getLayoutModule(entry);
|
|
392
|
+
if (module && getDefaultExport(module)) files.set(entry.treePosition, module);
|
|
393
|
+
}
|
|
394
|
+
const boundaries = /* @__PURE__ */ new Map();
|
|
395
|
+
for (const [treePosition, module] of files) {
|
|
396
|
+
const component = getDefaultExport(module);
|
|
397
|
+
if (component) boundaries.set(treePosition, {
|
|
398
|
+
component,
|
|
399
|
+
module
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
const rootTreePosition = layoutEntriesByTreePosition.has(0) ? 0 : layoutEntries[0]?.treePosition ?? null;
|
|
403
|
+
let rootModuleTreePosition = files.has(0) ? 0 : null;
|
|
404
|
+
for (const treePosition of files.keys()) if (rootTreePosition !== null && treePosition <= rootTreePosition && (rootModuleTreePosition === null || treePosition > rootModuleTreePosition)) rootModuleTreePosition = treePosition;
|
|
405
|
+
const rootModule = rootModuleTreePosition === null ? void 0 : files.get(rootModuleTreePosition);
|
|
406
|
+
const rootComponent = getDefaultExport(rootModule) ?? builtInComponent;
|
|
407
|
+
if (rootComponent) {
|
|
408
|
+
const rootBoundary = {
|
|
409
|
+
component: rootComponent,
|
|
410
|
+
module: rootModule ?? null
|
|
411
|
+
};
|
|
412
|
+
if (rootTreePosition !== null && !files.has(rootTreePosition)) boundaries.set(rootTreePosition, rootBoundary);
|
|
413
|
+
const firstSegment = routeSegments[0];
|
|
414
|
+
if (firstSegment !== void 0 && isAppPageRouteGroupSegment(firstSegment) && !files.has(1)) boundaries.set(1, rootBoundary);
|
|
415
|
+
}
|
|
416
|
+
for (const treePosition of boundaries.keys()) {
|
|
417
|
+
const hasLayout = layoutEntriesByTreePosition.has(treePosition);
|
|
418
|
+
if (rootTreePosition !== null && treePosition < rootTreePosition || !hasLayout && (treePosition === 0 || treePosition >= routeSegments.length)) boundaries.delete(treePosition);
|
|
419
|
+
}
|
|
420
|
+
return boundaries;
|
|
421
|
+
};
|
|
422
|
+
const rootNotFoundModule = options.route.segmentNotFoundTreePositions ? null : options.rootNotFoundModule;
|
|
423
|
+
const rootForbiddenModule = options.route.segmentForbiddenTreePositions ? null : options.rootForbiddenModule;
|
|
424
|
+
const rootUnauthorizedModule = options.route.segmentUnauthorizedTreePositions ? null : options.rootUnauthorizedModule;
|
|
425
|
+
const notFoundBoundaries = resolveAccessBoundaries(options.route.segmentNotFounds, options.route.segmentNotFoundTreePositions, (entry) => entry.notFoundModule, rootNotFoundModule ? null : DEFAULT_NOT_FOUND_COMPONENT);
|
|
426
|
+
const forbiddenBoundaries = resolveAccessBoundaries(options.route.segmentForbiddens, options.route.segmentForbiddenTreePositions, (entry) => entry.forbiddenModule, rootForbiddenModule ? null : DEFAULT_FORBIDDEN_COMPONENT);
|
|
427
|
+
const unauthorizedBoundaries = resolveAccessBoundaries(options.route.segmentUnauthorizeds, options.route.segmentUnauthorizedTreePositions, (entry) => entry.unauthorizedModule, rootUnauthorizedModule ? null : DEFAULT_UNAUTHORIZED_COMPONENT);
|
|
428
|
+
const layoutGate = createAppPageLayoutGate();
|
|
365
429
|
const layoutDependenciesByIndex = /* @__PURE__ */ new Map();
|
|
366
|
-
const renderDependenciesByElementId = /* @__PURE__ */ new Map();
|
|
367
430
|
const layoutDependenciesBefore = [];
|
|
368
431
|
const slotDependenciesByLayoutIndex = [];
|
|
369
432
|
const templateDependenciesById = /* @__PURE__ */ new Map();
|
|
@@ -379,7 +442,10 @@ function buildAppPageElements(options) {
|
|
|
379
442
|
...layoutEntries.map((entry) => entry.treePosition),
|
|
380
443
|
...templateEntries.map((entry) => entry.treePosition),
|
|
381
444
|
...loadingEntries.map((entry) => entry.treePosition),
|
|
382
|
-
...errorEntries.map((entry) => entry.treePosition)
|
|
445
|
+
...errorEntries.map((entry) => entry.treePosition),
|
|
446
|
+
...notFoundBoundaries.keys(),
|
|
447
|
+
...forbiddenBoundaries.keys(),
|
|
448
|
+
...unauthorizedBoundaries.keys()
|
|
383
449
|
])).sort((left, right) => left - right);
|
|
384
450
|
const resolveSlotOverride = (slotKey, slotName) => {
|
|
385
451
|
const overrideByKey = options.slotOverrides?.[slotKey];
|
|
@@ -398,7 +464,7 @@ function buildAppPageElements(options) {
|
|
|
398
464
|
}) : [];
|
|
399
465
|
const prefetchLoadingComponent = getDefaultExport(prefetchLoadingEntry?.loadingModule);
|
|
400
466
|
const shouldRenderPrefetchLoadingShell = isPrefetchLoadingShell && (prefetchLoadingComponent !== null || prefetchSlotLoadingEntries.length > 0);
|
|
401
|
-
const streamingMetadataBodyId = options.resolveHead && metadataPlacement === "body" && (!isPrefetchLoadingShell || shouldRenderPrefetchLoadingShell) ?
|
|
467
|
+
const streamingMetadataBodyId = options.resolveHead && metadataPlacement === "body" && (!isPrefetchLoadingShell || shouldRenderPrefetchLoadingShell) ? `${APP_STREAMING_METADATA_BODY_ID_PREFIX}${routeId}` : null;
|
|
402
468
|
const prefetchCutoffTreePosition = isPrefetchLoadingShell ? prefetchLoadingEntry?.treePosition ?? prefetchSlotLoadingEntries.reduce((deepest, entry) => Math.max(deepest, entry.ownerTreePosition), 0) : null;
|
|
403
469
|
const includesPrefetchTreePosition = (treePosition) => prefetchCutoffTreePosition === null || treePosition <= prefetchCutoffTreePosition;
|
|
404
470
|
const segmentPlan = createAppPageSegmentPlan({
|
|
@@ -421,6 +487,13 @@ function buildAppPageElements(options) {
|
|
|
421
487
|
templateEntries
|
|
422
488
|
});
|
|
423
489
|
const routeResetKey = segmentPlan.routeResetKey;
|
|
490
|
+
const skippedLayoutIds = /* @__PURE__ */ new Set();
|
|
491
|
+
if (options.mountedLayouts && options.isRscRequest === true && options.isUncacheableRender === true && renderMode === "navigation" && interception === null) for (const layoutEntry of layoutEntries) {
|
|
492
|
+
const identity = segmentPlan.bfcacheSegmentIdentities[layoutEntry.id];
|
|
493
|
+
if (identity === void 0) break;
|
|
494
|
+
if (!options.mountedLayouts.has(hashMountedLayoutIdentity(identity))) break;
|
|
495
|
+
skippedLayoutIds.add(layoutEntry.id);
|
|
496
|
+
}
|
|
424
497
|
const slotPlansByKey = new Map(segmentPlan.slots.map((slot) => [slot.key, slot]));
|
|
425
498
|
const resolveRouteSegmentResetKey = (treePosition) => resolveAppPageSegmentStateKey(routeSegments, treePosition, options.matchedParams);
|
|
426
499
|
const metadataEntries = AppElementsWire.createMetadataEntries({
|
|
@@ -440,6 +513,12 @@ function buildAppPageElements(options) {
|
|
|
440
513
|
[pageElementId]: null,
|
|
441
514
|
[routeId]: null
|
|
442
515
|
};
|
|
516
|
+
if (isPrefetchLoadingShell && !shouldRenderPrefetchLoadingShell && options.isUncacheableRender === true) return {
|
|
517
|
+
...metadataEntries,
|
|
518
|
+
...options.route.staticSiblings && options.route.staticSiblings.length > 0 ? { [APP_STATIC_SIBLINGS_KEY]: options.route.staticSiblings } : {},
|
|
519
|
+
[pageElementId]: null,
|
|
520
|
+
[routeId]: null
|
|
521
|
+
};
|
|
443
522
|
const elements = {};
|
|
444
523
|
for (const slotPlan of segmentPlan.slots) for (const segment of slotPlan.nestedBfcacheSegments) elements[segment.id] = null;
|
|
445
524
|
if (options.route.staticSiblings && options.route.staticSiblings.length > 0) elements[APP_STATIC_SIBLINGS_KEY] = options.route.staticSiblings;
|
|
@@ -457,10 +536,9 @@ function buildAppPageElements(options) {
|
|
|
457
536
|
if (layoutIndex !== void 0) {
|
|
458
537
|
const layoutEntry = layoutEntries[layoutIndex];
|
|
459
538
|
layoutDependenciesBefore[layoutIndex] = [...pageDependencies];
|
|
460
|
-
if (getDefaultExport(layoutEntry.layoutModule)) {
|
|
539
|
+
if (!skippedLayoutIds.has(layoutEntry.id) && getDefaultExport(layoutEntry.layoutModule)) {
|
|
461
540
|
const layoutDependency = createAppRenderDependency();
|
|
462
541
|
layoutDependenciesByIndex.set(layoutIndex, layoutDependency);
|
|
463
|
-
renderDependenciesByElementId.set(layoutEntry.id, layoutDependency);
|
|
464
542
|
pageDependencies.push(layoutDependency);
|
|
465
543
|
}
|
|
466
544
|
slotDependenciesByLayoutIndex[layoutIndex] = [...pageDependencies];
|
|
@@ -476,11 +554,15 @@ function buildAppPageElements(options) {
|
|
|
476
554
|
const routeLoadingComponent = getDefaultExport(options.route.loading);
|
|
477
555
|
if (shouldRenderPrefetchLoadingShell) elements[APP_PREFETCH_LOADING_SHELL_MARKER_KEY] = "LoadingBoundary";
|
|
478
556
|
const pageLoadingModule = resolveAppPageLoadingModuleAtOrAbove(options.route, routeSegments.length);
|
|
479
|
-
const
|
|
557
|
+
const pageLoadingEntry = loadingEntries.find((entry) => entry.loadingModule === pageLoadingModule);
|
|
558
|
+
const PageLoadingComponent = pageRenderDependency && (!pageLoadingEntry || isOutermostEntryBelowLoading(pageLoadingEntry.treePosition, routeSegments.length, "page")) ? getDefaultExport(pageLoadingModule) : null;
|
|
559
|
+
const streamingMetadataOutlet = createAppPageStreamingMetadataOutlet(streamingMetadataOutletId, options.streamingMetadataOutletSuspended);
|
|
560
|
+
const renderElementWithMetadataOutlet = options.renderElementWithMetadataOutlet;
|
|
561
|
+
const pageContent = renderElementWithMetadataOutlet ? renderElementWithMetadataOutlet(streamingMetadataOutlet) : options.element;
|
|
480
562
|
const pageElement = PageLoadingComponent ? /* @__PURE__ */ jsx(Suspense, {
|
|
481
563
|
fallback: /* @__PURE__ */ jsx(PageLoadingComponent, {}),
|
|
482
|
-
children:
|
|
483
|
-
}, routeResetKey) :
|
|
564
|
+
children: pageContent
|
|
565
|
+
}, routeResetKey) : pageContent;
|
|
484
566
|
elements[pageElementId] = isPrefetchLoadingShell ? null : pageRenderDependency ? pageElement : renderAfterAppDependencies(pageElement, pageDependencies);
|
|
485
567
|
for (const templateEntry of templateEntries) {
|
|
486
568
|
if (isPrefetchLoadingShell && !includesPrefetchTreePosition(templateEntry.treePosition)) continue;
|
|
@@ -491,7 +573,7 @@ function buildAppPageElements(options) {
|
|
|
491
573
|
let templateElement = templateDependency ? renderAppComponentWithDependencyBarrier(TemplateComponent, { children: /* @__PURE__ */ jsx(Children$1, {}) }, templateDependency) : /* @__PURE__ */ jsx(TemplateComponent, { children: /* @__PURE__ */ jsx(Children$1, {}) });
|
|
492
574
|
const ancestorLoadingEntry = findNearestAncestorLoadingEntry(templateEntry.treePosition);
|
|
493
575
|
const ancestorLoadingComponent = getDefaultExport(ancestorLoadingEntry?.loadingModule);
|
|
494
|
-
if (ancestorLoadingComponent && ancestorLoadingEntry) {
|
|
576
|
+
if (ancestorLoadingComponent && ancestorLoadingEntry && isOutermostEntryBelowLoading(ancestorLoadingEntry.treePosition, templateEntry.treePosition, "template")) {
|
|
495
577
|
const AncestorLoadingComponent = ancestorLoadingComponent;
|
|
496
578
|
const loadingResetKey = resolveRouteSegmentResetKey(ancestorLoadingEntry.treePosition);
|
|
497
579
|
templateElement = /* @__PURE__ */ jsx(Suspense, {
|
|
@@ -504,35 +586,31 @@ function buildAppPageElements(options) {
|
|
|
504
586
|
for (let index = 0; index < layoutEntries.length; index++) {
|
|
505
587
|
const layoutEntry = layoutEntries[index];
|
|
506
588
|
if (isPrefetchLoadingShell && !includesPrefetchTreePosition(layoutEntry.treePosition)) continue;
|
|
589
|
+
if (skippedLayoutIds.has(layoutEntry.id)) continue;
|
|
507
590
|
if (!layoutEntry.layoutModule) continue;
|
|
508
591
|
const layoutComponent = traceGetLayoutOrPageModule(resolveAppPageModuleTraceSegment(routeSegments, layoutEntry.treePosition), () => getDefaultExport(layoutEntry.layoutModule));
|
|
509
592
|
if (!layoutComponent) continue;
|
|
510
593
|
const layoutParams = resolveAppPageSegmentParams(options.route.routeSegments, layoutEntry.treePosition, options.matchedParams);
|
|
511
|
-
|
|
512
|
-
layoutId: layoutEntry.id,
|
|
513
|
-
layoutModule: layoutEntry.layoutModule,
|
|
514
|
-
layoutParamAccess: options.layoutParamAccess,
|
|
515
|
-
routeSegments: options.route.routeSegments,
|
|
516
|
-
treePosition: layoutEntry.treePosition
|
|
517
|
-
});
|
|
518
|
-
const layoutProps = { params: options.makeThenableParams(layoutParams, options.layoutParamAccess?.createThenableParamsObserver(layoutEntry.id)) };
|
|
594
|
+
const layoutProps = { params: options.makeThenableParams(layoutParams) };
|
|
519
595
|
for (const slot of Object.values(options.route.slots ?? {})) {
|
|
520
596
|
const slotName = slot.name;
|
|
521
597
|
if ((slot.layoutIndex >= 0 ? slot.layoutIndex : layoutEntries.length - 1) !== index) continue;
|
|
522
598
|
layoutProps[slotName] = /* @__PURE__ */ jsx(ParallelSlot, { name: slotName });
|
|
523
599
|
}
|
|
524
600
|
const LayoutComponent = layoutComponent;
|
|
525
|
-
const
|
|
526
|
-
|
|
601
|
+
const ancestorLoadingEntry = findNearestAncestorLoadingEntry(layoutEntry.treePosition);
|
|
602
|
+
const holdsResponse = !ancestorLoadingEntry && !isReactOwnedAppComponent(LayoutComponent);
|
|
603
|
+
if (holdsResponse) layoutGate.hold(layoutEntry.id, index);
|
|
604
|
+
let layoutElement = createRouteLayoutElement(LayoutComponent, withUseCacheLayoutMarker(LayoutComponent, {
|
|
527
605
|
...layoutProps,
|
|
528
606
|
children: /* @__PURE__ */ jsx(Children$1, {})
|
|
529
|
-
}),
|
|
530
|
-
|
|
531
|
-
|
|
607
|
+
}), index, layoutDependenciesByIndex.get(index), holdsResponse ? (failure) => layoutGate.settle(layoutEntry.id, failure) : void 0);
|
|
608
|
+
layoutElement = /* @__PURE__ */ jsx(RedirectBoundary, {
|
|
609
|
+
resetKey: resolveRouteSegmentResetKey(layoutEntry.treePosition),
|
|
610
|
+
children: layoutElement
|
|
532
611
|
});
|
|
533
|
-
const ancestorLoadingEntry = findNearestAncestorLoadingEntry(layoutEntry.treePosition);
|
|
534
612
|
const ancestorLoadingComponent = getDefaultExport(ancestorLoadingEntry?.loadingModule);
|
|
535
|
-
if (ancestorLoadingComponent && ancestorLoadingEntry) {
|
|
613
|
+
if (ancestorLoadingComponent && ancestorLoadingEntry && isOutermostEntryBelowLoading(ancestorLoadingEntry.treePosition, layoutEntry.treePosition, "layout")) {
|
|
536
614
|
const AncestorLoadingComponent = ancestorLoadingComponent;
|
|
537
615
|
const loadingResetKey = resolveRouteSegmentResetKey(ancestorLoadingEntry.treePosition);
|
|
538
616
|
layoutElement = /* @__PURE__ */ jsx(Suspense, {
|
|
@@ -561,6 +639,45 @@ function buildAppPageElements(options) {
|
|
|
561
639
|
elements[slotId] = AppElementsWire.unmatchedSlotValue;
|
|
562
640
|
continue;
|
|
563
641
|
}
|
|
642
|
+
const branchNotFounds = /* @__PURE__ */ new Map();
|
|
643
|
+
const slotNotFoundModules = !overrideOrPageComponent ? void 0 : hasSlotTreeOverride ? slotOverride?.notFoundModules : slot.notFounds;
|
|
644
|
+
const slotNotFoundTreePositions = hasSlotTreeOverride ? slotOverride?.notFoundTreePositions : slot.notFoundTreePositions;
|
|
645
|
+
for (const [index, notFoundModule] of (slotNotFoundModules ?? []).entries()) {
|
|
646
|
+
const component = getDefaultExport(notFoundModule);
|
|
647
|
+
const treePosition = slotNotFoundTreePositions?.[index];
|
|
648
|
+
if (component && treePosition !== void 0) branchNotFounds.set(treePosition, component);
|
|
649
|
+
}
|
|
650
|
+
const branchAccessBoundaries = /* @__PURE__ */ new Map();
|
|
651
|
+
if (overrideOrPageComponent && hasSlotTreeOverride) for (const [modules, treePositions, Boundary] of [[
|
|
652
|
+
slotOverride?.forbiddenModules,
|
|
653
|
+
slotOverride?.forbiddenTreePositions,
|
|
654
|
+
ForbiddenBoundary
|
|
655
|
+
], [
|
|
656
|
+
slotOverride?.unauthorizedModules,
|
|
657
|
+
slotOverride?.unauthorizedTreePositions,
|
|
658
|
+
UnauthorizedBoundary
|
|
659
|
+
]]) for (const [index, module] of (modules ?? []).entries()) {
|
|
660
|
+
const component = getDefaultExport(module);
|
|
661
|
+
const treePosition = treePositions?.[index];
|
|
662
|
+
if (!component || treePosition === void 0) continue;
|
|
663
|
+
const entries = branchAccessBoundaries.get(treePosition) ?? [];
|
|
664
|
+
entries.push({
|
|
665
|
+
component,
|
|
666
|
+
Boundary
|
|
667
|
+
});
|
|
668
|
+
branchAccessBoundaries.set(treePosition, entries);
|
|
669
|
+
}
|
|
670
|
+
const branchErrors = /* @__PURE__ */ new Map();
|
|
671
|
+
if (overrideOrPageComponent && hasSlotTreeOverride) for (const [index, errorModule] of (slotOverride?.errorModules ?? []).entries()) {
|
|
672
|
+
const component = getErrorBoundaryExport(errorModule);
|
|
673
|
+
const treePosition = slotOverride?.errorTreePositions?.[index];
|
|
674
|
+
if (component && treePosition !== void 0) branchErrors.set(treePosition, component);
|
|
675
|
+
}
|
|
676
|
+
const resolveSlotNotFoundBoundary = (treePosition) => {
|
|
677
|
+
let caughtAt;
|
|
678
|
+
for (const position of branchNotFounds.keys()) if (position < treePosition && (caughtAt === void 0 || position > caughtAt)) caughtAt = position;
|
|
679
|
+
return caughtAt === void 0 ? void 0 : `${slotId}:${caughtAt}`;
|
|
680
|
+
};
|
|
564
681
|
let slotElement;
|
|
565
682
|
if (prefetchSlotLoadingEntry) {
|
|
566
683
|
const PrefetchSlotLoadingComponent = getDefaultExport(prefetchSlotLoadingEntry.loadingModule);
|
|
@@ -569,10 +686,10 @@ function buildAppPageElements(options) {
|
|
|
569
686
|
const slotProps = { params: options.makeThenableParams(slotParams) };
|
|
570
687
|
if (options.searchParams !== void 0) slotProps.searchParams = options.searchParams;
|
|
571
688
|
if (slotOverride?.props) Object.assign(slotProps, slotOverride.props);
|
|
572
|
-
slotElement = options.createPageElement ? options.createPageElement(slotComponent, slotProps) : (() => {
|
|
689
|
+
slotElement = options.createPageElement ? options.createPageElement(slotComponent, slotProps, targetIndex >= 0 ? targetIndex : void 0, resolveSlotNotFoundBoundary(Number.POSITIVE_INFINITY)) : (() => {
|
|
573
690
|
return /* @__PURE__ */ jsx(slotComponent, { ...slotProps });
|
|
574
691
|
})();
|
|
575
|
-
if (overrideOrPageComponent) slotElement = /* @__PURE__ */
|
|
692
|
+
if (overrideOrPageComponent) slotElement = /* @__PURE__ */ jsxs(Fragment, { children: [slotElement, slotOverride?.metadataOutlet] }, slotResetKey);
|
|
576
693
|
slotElement = /* @__PURE__ */ jsx(RedirectBoundary, {
|
|
577
694
|
resetKey: slotResetKey,
|
|
578
695
|
children: slotElement
|
|
@@ -628,6 +745,9 @@ function buildAppPageElements(options) {
|
|
|
628
745
|
...branchLayouts.keys(),
|
|
629
746
|
...branchLoadings.keys(),
|
|
630
747
|
...slotErrorComponent ? [0] : [],
|
|
748
|
+
...branchNotFounds.keys(),
|
|
749
|
+
...branchAccessBoundaries.keys(),
|
|
750
|
+
...branchErrors.keys(),
|
|
631
751
|
...nestedBfcacheSegments.flatMap((segment) => segment.treePosition === null ? [] : [segment.treePosition])
|
|
632
752
|
])).filter((treePosition) => !prefetchSlotLoadingEntry || !isOwnedAtRoutePrefetchCutoff && treePosition <= prefetchSlotLoadingEntry.treePosition).sort((left, right) => left - right);
|
|
633
753
|
for (let index = branchTreePositions.length - 1; index >= 0; index--) {
|
|
@@ -647,19 +767,31 @@ function buildAppPageElements(options) {
|
|
|
647
767
|
children: slotElement
|
|
648
768
|
}, loadingResetKey || slotResetKey);
|
|
649
769
|
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
770
|
+
const SlotNotFoundComponent = branchNotFounds.get(treePosition);
|
|
771
|
+
if (SlotNotFoundComponent) slotElement = /* @__PURE__ */ jsx(NotFoundBoundary, {
|
|
772
|
+
resetKey: resolveAppPageTemplateStateKey(branchSegments, treePosition, slotParams),
|
|
773
|
+
fallback: /* @__PURE__ */ jsx(SlotNotFoundComponent, {}),
|
|
774
|
+
caughtId: `${slotId}:${treePosition}`,
|
|
775
|
+
children: slotElement
|
|
776
|
+
});
|
|
777
|
+
for (const { component: AccessComponent, Boundary } of branchAccessBoundaries.get(treePosition) ?? []) slotElement = /* @__PURE__ */ jsx(Boundary, {
|
|
778
|
+
resetKey: resolveAppPageTemplateStateKey(branchSegments, treePosition, slotParams),
|
|
779
|
+
fallback: /* @__PURE__ */ jsx(AccessComponent, {}),
|
|
780
|
+
children: slotElement
|
|
781
|
+
});
|
|
782
|
+
const SegmentErrorComponent = branchErrors.get(treePosition) ?? (treePosition === 0 ? slotErrorComponent : null);
|
|
783
|
+
if (SegmentErrorComponent) slotElement = /* @__PURE__ */ jsx(ErrorBoundary, {
|
|
784
|
+
resetKey: treePosition === 0 ? slotResetKey : resolveAppPageSegmentStateKey(branchSegments, treePosition, slotParams) || slotResetKey,
|
|
785
|
+
fallback: SegmentErrorComponent,
|
|
653
786
|
children: slotElement
|
|
654
787
|
});
|
|
655
788
|
const layoutEntriesAtPosition = branchLayouts.get(treePosition) ?? [];
|
|
656
789
|
for (let layoutIndex = layoutEntriesAtPosition.length - 1; layoutIndex >= 0; layoutIndex--) {
|
|
657
790
|
const layoutEntry = layoutEntriesAtPosition[layoutIndex];
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
...withUseCacheLayoutMarker(LayoutComponent, { params: options.makeThenableParams(layoutEntry.params) }),
|
|
791
|
+
slotElement = createSlotLayoutElement(layoutEntry.component, withUseCacheLayoutMarker(layoutEntry.component, {
|
|
792
|
+
params: options.makeThenableParams(layoutEntry.params),
|
|
661
793
|
children: slotElement
|
|
662
|
-
});
|
|
794
|
+
}), targetIndex >= 0 ? targetIndex : void 0, prefetchSlotLoadingEntry ? void 0 : resolveSlotNotFoundBoundary(treePosition));
|
|
663
795
|
}
|
|
664
796
|
}
|
|
665
797
|
const unalignedBfcacheSegment = nestedBfcacheSegments.find((segment) => segment.treePosition === null);
|
|
@@ -670,7 +802,8 @@ function buildAppPageElements(options) {
|
|
|
670
802
|
});
|
|
671
803
|
const ownerLoadingEntry = isPrefetchLoadingShell ? void 0 : findNearestLoadingEntryAtOrAbove(ownerTreePosition);
|
|
672
804
|
const ownerLoadingComponent = getDefaultExport(ownerLoadingEntry?.loadingModule);
|
|
673
|
-
|
|
805
|
+
const slotLayoutTreePosition = layoutEntries[targetIndex]?.treePosition;
|
|
806
|
+
if (ownerLoadingComponent && ownerLoadingEntry && (slotLayoutTreePosition === void 0 || isOutermostEntryBelowLoading(ownerLoadingEntry.treePosition, slotLayoutTreePosition, "slot"))) {
|
|
674
807
|
const OwnerLoadingComponent = ownerLoadingComponent;
|
|
675
808
|
const ownerResetKey = resolveRouteSegmentResetKey(ownerLoadingEntry.treePosition);
|
|
676
809
|
slotElement = /* @__PURE__ */ jsx(Suspense, {
|
|
@@ -684,7 +817,7 @@ function buildAppPageElements(options) {
|
|
|
684
817
|
providerId: pageElementId,
|
|
685
818
|
segmentMap: { children: [APP_PAGE_SEGMENT_KEY] },
|
|
686
819
|
children: /* @__PURE__ */ jsx(Slot, { id: pageElementId })
|
|
687
|
-
}),
|
|
820
|
+
}), renderElementWithMetadataOutlet ? null : streamingMetadataOutlet] });
|
|
688
821
|
if (isPrefetchLoadingShell) {
|
|
689
822
|
if (prefetchLoadingComponent === null) routeChildren = null;
|
|
690
823
|
else routeChildren = /* @__PURE__ */ jsx(prefetchLoadingComponent, {});
|
|
@@ -700,24 +833,41 @@ function buildAppPageElements(options) {
|
|
|
700
833
|
routeChildren = /* @__PURE__ */ jsx(AppRouterScrollTarget, { children: routeChildren });
|
|
701
834
|
}
|
|
702
835
|
const lastLayoutErrorModule = errorEntries.length > 0 ? errorEntries[errorEntries.length - 1].errorModule : null;
|
|
703
|
-
const
|
|
704
|
-
|
|
705
|
-
|
|
836
|
+
const resolveAccessBoundaryOwner = (boundaries, pageModule) => {
|
|
837
|
+
let deepest = null;
|
|
838
|
+
for (const treePosition of boundaries.keys()) if (treePosition < routeSegments.length && (deepest === null || treePosition > deepest)) deepest = treePosition;
|
|
839
|
+
return deepest !== null && boundaries.get(deepest)?.module === pageModule ? deepest : null;
|
|
840
|
+
};
|
|
841
|
+
const resolvePageAccessModule = (routeModule, rootModule) => (getDefaultExport(routeModule) ? routeModule : null) ?? (getDefaultExport(rootModule) ? rootModule : null) ?? null;
|
|
842
|
+
const notFoundPageModule = resolvePageAccessModule(options.route.notFound, rootNotFoundModule);
|
|
843
|
+
const forbiddenPageModule = resolvePageAccessModule(options.route.forbidden, rootForbiddenModule);
|
|
844
|
+
const unauthorizedPageModule = resolvePageAccessModule(options.route.unauthorized, rootUnauthorizedModule);
|
|
845
|
+
const notFoundOwnerTreePosition = resolveAccessBoundaryOwner(notFoundBoundaries, notFoundPageModule);
|
|
846
|
+
const forbiddenOwnerTreePosition = resolveAccessBoundaryOwner(forbiddenBoundaries, forbiddenPageModule);
|
|
847
|
+
const unauthorizedOwnerTreePosition = resolveAccessBoundaryOwner(unauthorizedBoundaries, unauthorizedPageModule);
|
|
848
|
+
const notFoundComponent = getDefaultExport(notFoundPageModule) ?? (layoutEntries.length === 0 ? DEFAULT_NOT_FOUND_COMPONENT : null);
|
|
849
|
+
const identifiesPageNotFoundCatcher = !renderElementWithMetadataOutlet;
|
|
850
|
+
const isPageNotFoundCaughtAtPage = identifiesPageNotFoundCatcher && notFoundComponent !== null && notFoundOwnerTreePosition === null;
|
|
851
|
+
let pageNotFoundCatcherTreePosition = null;
|
|
852
|
+
if (identifiesPageNotFoundCatcher && !isPageNotFoundCaughtAtPage) {
|
|
853
|
+
for (const treePosition of notFoundBoundaries.keys()) if (pageNotFoundCatcherTreePosition === null || treePosition > pageNotFoundCatcherTreePosition) pageNotFoundCatcherTreePosition = treePosition;
|
|
854
|
+
}
|
|
706
855
|
if (notFoundComponent) routeChildren = /* @__PURE__ */ jsx(NotFoundBoundary, {
|
|
707
856
|
resetKey: routeResetKey,
|
|
708
|
-
|
|
857
|
+
caughtId: isPageNotFoundCaughtAtPage ? APP_PAGE_NOT_FOUND_BOUNDARY_ID : void 0,
|
|
858
|
+
fallback: notFoundOwnerTreePosition === null ? /* @__PURE__ */ jsx(notFoundComponent, {}) : /* @__PURE__ */ jsx(HttpAccessFallbackPassthrough, { status: 404 }),
|
|
709
859
|
children: routeChildren
|
|
710
860
|
});
|
|
711
|
-
const forbiddenComponent = getDefaultExport(
|
|
861
|
+
const forbiddenComponent = getDefaultExport(forbiddenPageModule);
|
|
712
862
|
if (forbiddenComponent) routeChildren = /* @__PURE__ */ jsx(ForbiddenBoundary, {
|
|
713
863
|
resetKey: routeResetKey,
|
|
714
|
-
fallback: /* @__PURE__ */ jsx(forbiddenComponent, {}),
|
|
864
|
+
fallback: forbiddenOwnerTreePosition === null ? /* @__PURE__ */ jsx(forbiddenComponent, {}) : /* @__PURE__ */ jsx(HttpAccessFallbackPassthrough, { status: 403 }),
|
|
715
865
|
children: routeChildren
|
|
716
866
|
});
|
|
717
|
-
const unauthorizedComponent = getDefaultExport(
|
|
867
|
+
const unauthorizedComponent = getDefaultExport(unauthorizedPageModule);
|
|
718
868
|
if (unauthorizedComponent) routeChildren = /* @__PURE__ */ jsx(UnauthorizedBoundary, {
|
|
719
869
|
resetKey: routeResetKey,
|
|
720
|
-
fallback: /* @__PURE__ */ jsx(unauthorizedComponent, {}),
|
|
870
|
+
fallback: unauthorizedOwnerTreePosition === null ? /* @__PURE__ */ jsx(unauthorizedComponent, {}) : /* @__PURE__ */ jsx(HttpAccessFallbackPassthrough, { status: 401 }),
|
|
721
871
|
children: routeChildren
|
|
722
872
|
});
|
|
723
873
|
const pageErrorComponent = getErrorBoundaryExport(options.route.error);
|
|
@@ -727,6 +877,7 @@ function buildAppPageElements(options) {
|
|
|
727
877
|
children: routeChildren
|
|
728
878
|
});
|
|
729
879
|
const renderedTreePositions = isPrefetchLoadingShell ? orderedTreePositions.filter(includesPrefetchTreePosition) : orderedTreePositions;
|
|
880
|
+
let childSegmentElementId = pageElementId;
|
|
730
881
|
for (let index = renderedTreePositions.length - 1; index >= 0; index--) {
|
|
731
882
|
const treePosition = renderedTreePositions[index];
|
|
732
883
|
const segmentResetKey = resolveRouteSegmentResetKey(treePosition);
|
|
@@ -742,23 +893,24 @@ function buildAppPageElements(options) {
|
|
|
742
893
|
children: segmentChildren
|
|
743
894
|
}, segmentResetKey || routeResetKey);
|
|
744
895
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
const
|
|
753
|
-
if (
|
|
754
|
-
|
|
755
|
-
|
|
896
|
+
const accessBoundaries = [
|
|
897
|
+
[notFoundBoundaries, NotFoundBoundary],
|
|
898
|
+
[forbiddenBoundaries, ForbiddenBoundary],
|
|
899
|
+
[unauthorizedBoundaries, UnauthorizedBoundary]
|
|
900
|
+
];
|
|
901
|
+
const accessResetKey = resolveAppPageTemplateStateKey(routeSegments, treePosition, options.matchedParams);
|
|
902
|
+
for (const [boundaries, AccessBoundary] of accessBoundaries) {
|
|
903
|
+
const boundary = boundaries.get(treePosition);
|
|
904
|
+
if (!boundary) continue;
|
|
905
|
+
const BoundaryComponent = boundary.component;
|
|
906
|
+
segmentChildren = AccessBoundary === NotFoundBoundary && treePosition === pageNotFoundCatcherTreePosition ? /* @__PURE__ */ jsx(NotFoundBoundary, {
|
|
907
|
+
resetKey: accessResetKey,
|
|
908
|
+
fallback: /* @__PURE__ */ jsx(BoundaryComponent, {}),
|
|
909
|
+
caughtId: APP_PAGE_NOT_FOUND_BOUNDARY_ID,
|
|
756
910
|
children: segmentChildren
|
|
757
|
-
})
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
resetKey: segmentResetKey,
|
|
761
|
-
fallback: /* @__PURE__ */ jsx(layoutUnauthorizedComponent, {}),
|
|
911
|
+
}) : /* @__PURE__ */ jsx(AccessBoundary, {
|
|
912
|
+
resetKey: accessResetKey,
|
|
913
|
+
fallback: /* @__PURE__ */ jsx(BoundaryComponent, {}),
|
|
762
914
|
children: segmentChildren
|
|
763
915
|
});
|
|
764
916
|
}
|
|
@@ -797,9 +949,13 @@ function buildAppPageElements(options) {
|
|
|
797
949
|
children: layoutHasElement ? /* @__PURE__ */ jsx(Slot, {
|
|
798
950
|
id: layoutEntry.id,
|
|
799
951
|
parallelSlots: createAppPageParallelSlotEntries(layoutIndex, layoutEntries, options.route, getEffectiveSlotParams, resolveSlotOverride),
|
|
800
|
-
children:
|
|
952
|
+
children: /* @__PURE__ */ jsx(BfcacheChildrenBoundary, {
|
|
953
|
+
id: childSegmentElementId,
|
|
954
|
+
children: segmentChildren
|
|
955
|
+
})
|
|
801
956
|
}) : segmentChildren
|
|
802
957
|
});
|
|
958
|
+
if (layoutHasElement) childSegmentElementId = layoutEntry.id;
|
|
803
959
|
}
|
|
804
960
|
const globalErrorComponent = getErrorBoundaryExport(options.globalErrorModule);
|
|
805
961
|
routeChildren = /* @__PURE__ */ jsx(GlobalErrorBoundary, {
|
|
@@ -815,9 +971,9 @@ function buildAppPageElements(options) {
|
|
|
815
971
|
createAppPageStreamingMetadataBody(streamingMetadataBodyId)
|
|
816
972
|
] });
|
|
817
973
|
elements[routeId] = pageRenderDependency ? renderAfterAppDependencies(routeElement, [pageRenderDependency]) : routeElement;
|
|
818
|
-
Object.assign(elements, metadataEntries, options.route.staticSiblings && options.route.staticSiblings.length > 0 ? { [APP_STATIC_SIBLINGS_KEY]: options.route.staticSiblings } : {}, shouldRenderPrefetchLoadingShell ? { [APP_PREFETCH_LOADING_SHELL_MARKER_KEY]: "LoadingBoundary" } : {});
|
|
819
|
-
|
|
974
|
+
Object.assign(elements, metadataEntries, options.route.staticSiblings && options.route.staticSiblings.length > 0 ? { [APP_STATIC_SIBLINGS_KEY]: options.route.staticSiblings } : {}, shouldRenderPrefetchLoadingShell ? { [APP_PREFETCH_LOADING_SHELL_MARKER_KEY]: "LoadingBoundary" } : {}, skippedLayoutIds.size > 0 ? { [APP_SKIPPED_LAYOUT_IDS_KEY]: [...skippedLayoutIds] } : {});
|
|
975
|
+
registerAppPageLayoutGate(elements, layoutGate);
|
|
820
976
|
return elements;
|
|
821
977
|
}
|
|
822
978
|
//#endregion
|
|
823
|
-
export { buildAppPageElements, createAppPageLayoutEntries, createAppPageRouteBodyMetadata, createAppPageSourcePage, createAppPageTreePath,
|
|
979
|
+
export { buildAppPageElements, createAppPageLayoutEntries, createAppPageRouteBodyMetadata, createAppPageSourcePage, createAppPageTreePath, probeAppPageLayout, resolveAppPageChildSegments, resolveAppPageLoadingModuleAtOrAbove };
|