@timber-js/app 0.2.0-alpha.239 → 0.2.0-alpha.240
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{actions-Top9GftB.js → actions-DIgnvDrG.js} +4 -4
- package/dist/_chunks/{actions-Top9GftB.js.map → actions-DIgnvDrG.js.map} +1 -1
- package/dist/_chunks/{als-registry-DpygwCp0.js → als-registry-PPYstxK0.js} +2 -1
- package/dist/_chunks/{als-registry-DpygwCp0.js.map → als-registry-PPYstxK0.js.map} +1 -1
- package/dist/_chunks/{cache-api-Bo8c7XVF.js → cache-api-uWQwuxWb.js} +5 -5
- package/dist/_chunks/{cache-api-Bo8c7XVF.js.map → cache-api-uWQwuxWb.js.map} +1 -1
- package/dist/_chunks/{chains-DMoHX4yH.js → chains-C7CExrUI.js} +2 -2
- package/dist/_chunks/{chains-DMoHX4yH.js.map → chains-C7CExrUI.js.map} +1 -1
- package/dist/_chunks/chains-CSslTUdI.js +1 -0
- package/dist/_chunks/{classify-BwyAd-dZ.js → classify-Cj9EeZoL.js} +2 -2
- package/dist/_chunks/{classify-BwyAd-dZ.js.map → classify-Cj9EeZoL.js.map} +1 -1
- package/dist/_chunks/{cli-check-DQAD9MLo.js → cli-check-C3QOAru7.js} +3 -3
- package/dist/_chunks/{cli-check-DQAD9MLo.js.map → cli-check-C3QOAru7.js.map} +1 -1
- package/dist/_chunks/{cli-schema-sync-C_xNLqBj.js → cli-schema-sync-BRxZz66D.js} +1 -1
- package/dist/_chunks/{cli-schema-sync-CmGls3dc.js → cli-schema-sync-DQUS_o3V.js} +2 -2
- package/dist/_chunks/{cli-schema-sync-CmGls3dc.js.map → cli-schema-sync-DQUS_o3V.js.map} +1 -1
- package/dist/_chunks/{client-dep-entries-C5BTQtFS.js → client-dep-entries-ZETBdLgv.js} +2 -2
- package/dist/_chunks/{client-dep-entries-C5BTQtFS.js.map → client-dep-entries-ZETBdLgv.js.map} +1 -1
- package/dist/_chunks/{convention-lint-GQA6WTRo.js → convention-lint-BoVISNS6.js} +3 -3
- package/dist/_chunks/{convention-lint-GQA6WTRo.js.map → convention-lint-BoVISNS6.js.map} +1 -1
- package/dist/_chunks/dev-server-B8roKA3Q.js +1 -0
- package/dist/_chunks/{dev-server-Cr3_Fu5A.js → dev-server-C5R6jx8Q.js} +2 -2
- package/dist/_chunks/{dev-server-Cr3_Fu5A.js.map → dev-server-C5R6jx8Q.js.map} +1 -1
- package/dist/_chunks/{dev-span-RsVeYYc_.js → dev-span-0aG7Q_Ph.js} +3 -7
- package/dist/_chunks/dev-span-0aG7Q_Ph.js.map +1 -0
- package/dist/_chunks/{error-boundary-Bh-egWUI.js → error-boundary-DB51f9ih.js} +98 -419
- package/dist/_chunks/error-boundary-DB51f9ih.js.map +1 -0
- package/dist/_chunks/{flight-source-node-BsrlUjMO.js → flight-source-node-D9cHBhjP.js} +7 -4
- package/dist/_chunks/flight-source-node-D9cHBhjP.js.map +1 -0
- package/dist/_chunks/{json-lossy-check-D47R9Fp5.js → json-lossy-check-Y1GxqVX_.js} +2 -2
- package/dist/_chunks/{json-lossy-check-D47R9Fp5.js.map → json-lossy-check-Y1GxqVX_.js.map} +1 -1
- package/dist/_chunks/{live-graph-HcLScfiV.js → live-graph-BDQWvnMm.js} +4 -4
- package/dist/_chunks/{live-graph-HcLScfiV.js.map → live-graph-BDQWvnMm.js.map} +1 -1
- package/dist/_chunks/{logger-DDLtp5e-.js → logger-DmRR9tmZ.js} +2 -2
- package/dist/_chunks/{logger-DDLtp5e-.js.map → logger-DmRR9tmZ.js.map} +1 -1
- package/dist/_chunks/metadata-routes-MXNjWOt5.js.map +1 -1
- package/dist/_chunks/{node-response-omewa8e6.js → node-response-yp8zdyRp.js} +2 -2
- package/dist/_chunks/{node-response-omewa8e6.js.map → node-response-yp8zdyRp.js.map} +1 -1
- package/dist/_chunks/plugin-context-BtaQcMuh.js.map +1 -1
- package/dist/_chunks/{poison-scan-DONdiCGX.js → poison-scan-WQgUydF_.js} +2 -2
- package/dist/_chunks/{poison-scan-DONdiCGX.js.map → poison-scan-WQgUydF_.js.map} +1 -1
- package/dist/_chunks/{scanner-DSAJjH0x.js → scanner-C9Lrf77z.js} +3 -2
- package/dist/_chunks/{scanner-DSAJjH0x.js.map → scanner-C9Lrf77z.js.map} +1 -1
- package/dist/_chunks/{sizeof-DVhEVN_y.js → sizeof-BISkSaU0.js} +2 -2
- package/dist/_chunks/{sizeof-DVhEVN_y.js.map → sizeof-BISkSaU0.js.map} +1 -1
- package/dist/_chunks/{walkers-96YopJds.js → walkers-Bxv4v7tX.js} +3 -3
- package/dist/_chunks/{walkers-96YopJds.js.map → walkers-Bxv4v7tX.js.map} +1 -1
- package/dist/adapters/cloudflare-kv-cache.js +1 -1
- package/dist/analyze/crawl-entry.js +3 -3
- package/dist/analyze/graph-command.js +2 -2
- package/dist/cache/index.js +2 -2
- package/dist/cache/stores/memory.js +1 -1
- package/dist/cdn/workers-cache-purge.js +1 -1
- package/dist/cli.js +3 -3
- package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -1
- package/dist/client/browser-entry/hydrate.d.ts +1 -1
- package/dist/client/browser-entry/router-init.d.ts.map +1 -1
- package/dist/client/error-boundary.d.ts +1 -0
- package/dist/client/error-boundary.d.ts.map +1 -1
- package/dist/client/error-boundary.js +1 -1
- package/dist/client/history.d.ts +4 -5
- package/dist/client/history.d.ts.map +1 -1
- package/dist/client/index.js +6 -7
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.d.ts +1 -1
- package/dist/client/internal.d.ts.map +1 -1
- package/dist/client/internal.js +194 -55
- package/dist/client/internal.js.map +1 -1
- package/dist/client/navigation-commit.d.ts +6 -25
- package/dist/client/navigation-commit.d.ts.map +1 -1
- package/dist/client/outlet-content-cache.d.ts +59 -0
- package/dist/client/outlet-content-cache.d.ts.map +1 -0
- package/dist/client/outlet-scope-context.d.ts +30 -0
- package/dist/client/outlet-scope-context.d.ts.map +1 -0
- package/dist/client/params-context.d.ts +10 -11
- package/dist/client/params-context.d.ts.map +1 -1
- package/dist/client/router-pipeline.d.ts +5 -5
- package/dist/client/router-pipeline.d.ts.map +1 -1
- package/dist/client/router-types.d.ts +10 -24
- package/dist/client/router-types.d.ts.map +1 -1
- package/dist/client/router.d.ts.map +1 -1
- package/dist/client/rsc-fetch.d.ts +4 -17
- package/dist/client/rsc-fetch.d.ts.map +1 -1
- package/dist/client/segment-cache.d.ts +15 -103
- package/dist/client/segment-cache.d.ts.map +1 -1
- package/dist/client/segment-outlet.d.ts +28 -52
- package/dist/client/segment-outlet.d.ts.map +1 -1
- package/dist/client/stale-segment.d.ts +39 -0
- package/dist/client/stale-segment.d.ts.map +1 -0
- package/dist/client/use-segment-params.d.ts +1 -1
- package/dist/config-types.d.ts +7 -6
- package/dist/config-types.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -732
- package/dist/index.js.map +1 -1
- package/dist/native/rsc/manifest.json +6 -4
- package/dist/native/rsc/routing/segment-keys.js +3 -11
- package/dist/native/rsc/routing/segment-keys.js.map +1 -1
- package/dist/native/rsc/server/access-gate.js +3 -7
- package/dist/native/rsc/server/access-gate.js.map +1 -1
- package/dist/native/rsc/server/als-registry.js +2 -1
- package/dist/native/rsc/server/als-registry.js.map +1 -1
- package/dist/native/rsc/server/build-manifest.js.map +1 -1
- package/dist/native/rsc/server/chain-url-parts.js +1 -6
- package/dist/native/rsc/server/chain-url-parts.js.map +1 -1
- package/dist/native/rsc/server/client-state-tree.js +33 -0
- package/dist/native/rsc/server/client-state-tree.js.map +1 -0
- package/dist/native/rsc/server/flight-source-node.js +5 -2
- package/dist/native/rsc/server/flight-source-node.js.map +1 -1
- package/dist/native/rsc/server/flight-source.js +46 -7
- package/dist/native/rsc/server/flight-source.js.map +1 -1
- package/dist/native/rsc/server/pipeline-interception.js +1 -1
- package/dist/native/rsc/server/publish-params.js.map +1 -1
- package/dist/native/rsc/server/route-element-builder.js +43 -61
- package/dist/native/rsc/server/route-element-builder.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/helpers.js +5 -28
- package/dist/native/rsc/server/rsc-entry/helpers.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/render-route.js +33 -7
- package/dist/native/rsc/server/rsc-entry/render-route.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js +2 -1
- package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/rsc-payload.js +2 -5
- package/dist/native/rsc/server/rsc-entry/rsc-payload.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/rsc-stream.js +44 -40
- package/dist/native/rsc/server/rsc-entry/rsc-stream.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/ssr-renderer.js +1 -1
- package/dist/native/rsc/server/rsc-entry/ssr-renderer.js.map +1 -1
- package/dist/native/rsc/server/segment-hash/capture.js +107 -0
- package/dist/native/rsc/server/segment-hash/capture.js.map +1 -0
- package/dist/native/rsc/server/segment-hash/outlet.js +81 -0
- package/dist/native/rsc/server/segment-hash/outlet.js.map +1 -0
- package/dist/native/rsc/server/segment-hash/stream-tap.js +139 -0
- package/dist/native/rsc/server/segment-hash/stream-tap.js.map +1 -0
- package/dist/native/rsc/server/segment-hash/value-hash.js +171 -0
- package/dist/native/rsc/server/segment-hash/value-hash.js.map +1 -0
- package/dist/native/rsc/server/slot-resolver.js +20 -124
- package/dist/native/rsc/server/slot-resolver.js.map +1 -1
- package/dist/native/rsc/server/vite-handoff-rsc.js.map +1 -1
- package/dist/native/rsc/shared/outlet-decision.js +5 -0
- package/dist/native/rsc/shared/outlet-decision.js.map +1 -0
- package/dist/native/ssr/client/error-boundary.js +16 -3
- package/dist/native/ssr/client/error-boundary.js.map +1 -1
- package/dist/native/ssr/client/navigation-commit.js +1 -5
- package/dist/native/ssr/client/navigation-commit.js.map +1 -1
- package/dist/native/ssr/client/outlet-content-cache.js +53 -0
- package/dist/native/ssr/client/outlet-content-cache.js.map +1 -0
- package/dist/native/ssr/client/outlet-scope-context.js +12 -0
- package/dist/native/ssr/client/outlet-scope-context.js.map +1 -0
- package/dist/native/ssr/client/params-context.js.map +1 -1
- package/dist/native/ssr/client/rsc-fetch.js +1 -12
- package/dist/native/ssr/client/rsc-fetch.js.map +1 -1
- package/dist/native/ssr/client/segment-outlet.js +34 -13
- package/dist/native/ssr/client/segment-outlet.js.map +1 -1
- package/dist/native/ssr/client/stale-segment.js +29 -0
- package/dist/native/ssr/client/stale-segment.js.map +1 -0
- package/dist/native/ssr/manifest.json +5 -4
- package/dist/native/ssr/routing/segment-keys.js +5 -1
- package/dist/native/ssr/routing/segment-keys.js.map +1 -1
- package/dist/native/ssr/server/access-gate.js +3 -7
- package/dist/native/ssr/server/access-gate.js.map +1 -1
- package/dist/native/ssr/server/als-registry.js +1 -0
- package/dist/native/ssr/server/als-registry.js.map +1 -1
- package/dist/native/ssr/server/build-manifest.js.map +1 -1
- package/dist/native/ssr/server/client-state-tree.js +33 -0
- package/dist/native/ssr/server/client-state-tree.js.map +1 -0
- package/dist/native/ssr/server/flight-source-node.js +5 -2
- package/dist/native/ssr/server/flight-source-node.js.map +1 -1
- package/dist/native/ssr/server/flight-source.js +1 -0
- package/dist/native/ssr/server/flight-source.js.map +1 -1
- package/dist/native/ssr/server/pipeline-interception.js +1 -1
- package/dist/native/ssr/server/segment-hash/value-hash.js +162 -0
- package/dist/native/ssr/server/segment-hash/value-hash.js.map +1 -0
- package/dist/native/ssr/server/ssr-wrappers.js.map +1 -1
- package/dist/native/ssr/server/vite-handoff-rsc.js.map +1 -1
- package/dist/native/ssr/shared/payload-root.js.map +1 -1
- package/dist/plugin-context.d.ts +0 -16
- package/dist/plugin-context.d.ts.map +1 -1
- package/dist/plugins/build-manifest.d.ts.map +1 -1
- package/dist/routing/index.js +2 -2
- package/dist/routing/segment-keys.d.ts +8 -21
- package/dist/routing/segment-keys.d.ts.map +1 -1
- package/dist/server/access-gate.d.ts +0 -14
- package/dist/server/access-gate.d.ts.map +1 -1
- package/dist/server/als-registry.d.ts +16 -0
- package/dist/server/als-registry.d.ts.map +1 -1
- package/dist/server/build-manifest.d.ts +1 -10
- package/dist/server/build-manifest.d.ts.map +1 -1
- package/dist/server/chain-url-parts.d.ts +3 -13
- package/dist/server/chain-url-parts.d.ts.map +1 -1
- package/dist/server/client-state-tree.d.ts +31 -0
- package/dist/server/client-state-tree.d.ts.map +1 -0
- package/dist/server/flight-source-node.d.ts +6 -1
- package/dist/server/flight-source-node.d.ts.map +1 -1
- package/dist/server/flight-source.d.ts +27 -0
- package/dist/server/flight-source.d.ts.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/internal.js +48 -47
- package/dist/server/internal.js.map +1 -1
- package/dist/server/publish-params.d.ts +5 -4
- package/dist/server/publish-params.d.ts.map +1 -1
- package/dist/server/route-element-builder.d.ts +4 -19
- package/dist/server/route-element-builder.d.ts.map +1 -1
- package/dist/server/rsc-entry/helpers.d.ts +7 -13
- package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
- package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
- package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-payload.d.ts +1 -2
- package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-stream.d.ts +11 -2
- package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-renderer.d.ts +0 -2
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/segment-hash/capture.d.ts +77 -0
- package/dist/server/segment-hash/capture.d.ts.map +1 -0
- package/dist/server/segment-hash/outlet.d.ts +65 -0
- package/dist/server/segment-hash/outlet.d.ts.map +1 -0
- package/dist/server/segment-hash/stream-tap.d.ts +49 -0
- package/dist/server/segment-hash/stream-tap.d.ts.map +1 -0
- package/dist/server/segment-hash/value-hash.d.ts +70 -0
- package/dist/server/segment-hash/value-hash.d.ts.map +1 -0
- package/dist/server/slot-resolver.d.ts +13 -78
- package/dist/server/slot-resolver.d.ts.map +1 -1
- package/dist/server/ssr-wrappers.d.ts +7 -9
- package/dist/server/ssr-wrappers.d.ts.map +1 -1
- package/dist/server/vite-handoff-rsc.d.ts +10 -1
- package/dist/server/vite-handoff-rsc.d.ts.map +1 -1
- package/dist/shared/outlet-decision.d.ts +48 -0
- package/dist/shared/outlet-decision.d.ts.map +1 -0
- package/dist/shared/payload-root.d.ts +5 -8
- package/dist/shared/payload-root.d.ts.map +1 -1
- package/dist/shared/segment-info.d.ts +13 -28
- package/dist/shared/segment-info.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client/browser-entry/action-dispatch.ts +1 -15
- package/src/client/browser-entry/hydrate.ts +3 -3
- package/src/client/browser-entry/router-init.ts +28 -47
- package/src/client/error-boundary.tsx +49 -9
- package/src/client/history.ts +4 -5
- package/src/client/internal.ts +1 -1
- package/src/client/navigation-commit.ts +25 -83
- package/src/client/outlet-content-cache.ts +119 -0
- package/src/client/outlet-scope-context.ts +42 -0
- package/src/client/params-context.ts +11 -12
- package/src/client/router-pipeline.ts +10 -74
- package/src/client/router-types.ts +11 -26
- package/src/client/router.ts +7 -22
- package/src/client/rsc-fetch.ts +5 -30
- package/src/client/segment-cache.ts +19 -264
- package/src/client/segment-outlet.tsx +80 -72
- package/src/client/stale-segment.ts +60 -0
- package/src/client/use-segment-params.ts +1 -1
- package/src/config-types.ts +7 -6
- package/src/index.ts +0 -2
- package/src/plugin-context.ts +0 -16
- package/src/plugins/build-manifest.ts +1 -22
- package/src/routing/scanner.ts +12 -0
- package/src/routing/segment-keys.ts +9 -35
- package/src/rsc-runtime/vendor-types.d.ts +8 -0
- package/src/server/access-gate.tsx +3 -32
- package/src/server/als-registry.ts +23 -0
- package/src/server/build-manifest.ts +1 -11
- package/src/server/chain-url-parts.ts +3 -21
- package/src/server/client-state-tree.ts +75 -0
- package/src/server/flight-source-node.ts +7 -2
- package/src/server/flight-source.ts +102 -9
- package/src/server/pipeline-interception.ts +1 -1
- package/src/server/publish-params.ts +5 -4
- package/src/server/route-element-builder.ts +77 -206
- package/src/server/rsc-entry/helpers.ts +11 -65
- package/src/server/rsc-entry/render-route.ts +54 -28
- package/src/server/rsc-entry/revalidate-renderer.ts +2 -1
- package/src/server/rsc-entry/rsc-payload.ts +11 -39
- package/src/server/rsc-entry/rsc-stream.ts +123 -101
- package/src/server/rsc-entry/ssr-renderer.ts +1 -3
- package/src/server/segment-hash/capture.ts +232 -0
- package/src/server/segment-hash/outlet.ts +185 -0
- package/src/server/segment-hash/stream-tap.ts +244 -0
- package/src/server/segment-hash/value-hash.ts +338 -0
- package/src/server/slot-resolver.ts +37 -323
- package/src/server/ssr-wrappers.tsx +7 -9
- package/src/server/vite-handoff-rsc.ts +12 -1
- package/src/shared/outlet-decision.ts +54 -0
- package/src/shared/payload-root.ts +5 -8
- package/src/shared/segment-info.ts +13 -28
- package/dist/_chunks/chains-CmzbpG-6.js +0 -1
- package/dist/_chunks/dev-server--4_Ogy_6.js +0 -1
- package/dist/_chunks/dev-span-RsVeYYc_.js.map +0 -1
- package/dist/_chunks/error-boundary-Bh-egWUI.js.map +0 -1
- package/dist/_chunks/flight-source-node-BsrlUjMO.js.map +0 -1
- package/dist/client/segment-update-context.d.ts +0 -15
- package/dist/client/segment-update-context.d.ts.map +0 -1
- package/dist/client/slot-content-cache-context.d.ts +0 -35
- package/dist/client/slot-content-cache-context.d.ts.map +0 -1
- package/dist/native/rsc/server/request-dep.js +0 -12
- package/dist/native/rsc/server/request-dep.js.map +0 -1
- package/dist/native/rsc/server/route-element-helpers.js +0 -20
- package/dist/native/rsc/server/route-element-helpers.js.map +0 -1
- package/dist/native/rsc/server/skippable-prefix.js +0 -72
- package/dist/native/rsc/server/skippable-prefix.js.map +0 -1
- package/dist/native/rsc/server/state-tree-diff.js +0 -35
- package/dist/native/rsc/server/state-tree-diff.js.map +0 -1
- package/dist/native/ssr/client/segment-cache.js +0 -119
- package/dist/native/ssr/client/segment-cache.js.map +0 -1
- package/dist/native/ssr/client/segment-update-context.js +0 -9
- package/dist/native/ssr/client/segment-update-context.js.map +0 -1
- package/dist/native/ssr/client/slot-content-cache-context.js +0 -8
- package/dist/native/ssr/client/slot-content-cache-context.js.map +0 -1
- package/dist/native/ssr/server/state-tree-diff.js +0 -23
- package/dist/native/ssr/server/state-tree-diff.js.map +0 -1
- package/dist/plugins/request-dep/analysis.d.ts +0 -106
- package/dist/plugins/request-dep/analysis.d.ts.map +0 -1
- package/dist/plugins/request-dep/index.d.ts +0 -75
- package/dist/plugins/request-dep/index.d.ts.map +0 -1
- package/dist/plugins/request-dep/origin.d.ts +0 -61
- package/dist/plugins/request-dep/origin.d.ts.map +0 -1
- package/dist/server/request-dep.d.ts +0 -15
- package/dist/server/request-dep.d.ts.map +0 -1
- package/dist/server/route-element-helpers.d.ts +0 -12
- package/dist/server/route-element-helpers.d.ts.map +0 -1
- package/dist/server/skippable-prefix.d.ts +0 -29
- package/dist/server/skippable-prefix.d.ts.map +0 -1
- package/dist/server/state-tree-diff.d.ts +0 -78
- package/dist/server/state-tree-diff.d.ts.map +0 -1
- package/src/client/segment-update-context.ts +0 -23
- package/src/client/slot-content-cache-context.ts +0 -43
- package/src/plugins/request-dep/analysis.ts +0 -447
- package/src/plugins/request-dep/index.ts +0 -376
- package/src/plugins/request-dep/origin.ts +0 -310
- package/src/server/request-dep.ts +0 -37
- package/src/server/route-element-helpers.ts +0 -37
- package/src/server/skippable-prefix.ts +0 -172
- package/src/server/state-tree-diff.ts +0 -132
|
@@ -29,25 +29,23 @@ import { MetadataCollector, MetadataHead } from './metadata-collector.ts';
|
|
|
29
29
|
import { AccessGate } from './access-gate.tsx';
|
|
30
30
|
import { PageDenyBoundary, buildDenyPageChain, handleCaughtDeny } from './deny-boundary.ts';
|
|
31
31
|
import type { DenyPageEntry } from './deny-boundary.ts';
|
|
32
|
-
import {
|
|
33
|
-
resolveSlotProps,
|
|
34
|
-
publishSlotSegmentParams,
|
|
35
|
-
emitSlotInfoForSkippedLayout,
|
|
36
|
-
type SlotSkipEntry,
|
|
37
|
-
} from './slot-resolver.ts';
|
|
32
|
+
import { resolveSlotProps } from './slot-resolver.ts';
|
|
38
33
|
import { consumedUrlParts } from './chain-url-parts.ts';
|
|
39
34
|
import { withPublishedParams } from './publish-params.ts';
|
|
40
35
|
import type { RscPayloadRoot } from '../shared/payload-root.ts';
|
|
41
36
|
|
|
42
37
|
import { wrapSegmentWithErrorBoundaries } from './error-boundary-wrapper.ts';
|
|
43
38
|
import type { InterceptionContext } from './pipeline.ts';
|
|
44
|
-
import
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
import {
|
|
40
|
+
childrenOutletKey,
|
|
41
|
+
computeSegmentKeys,
|
|
42
|
+
computeSegmentTreePaths,
|
|
43
|
+
} from '../routing/segment-keys.ts';
|
|
44
|
+
import { outletGate, type OutletSpec, type SegmentHashRender } from './segment-hash/outlet.ts';
|
|
45
|
+
import { METADATA_OUTLET_PATH } from '../shared/outlet-decision.ts';
|
|
47
46
|
import { setFirstDeniedSegmentIndex } from './deny-boundary.ts';
|
|
48
47
|
import { loadModule, type ManifestLoader } from './safe-load.ts';
|
|
49
48
|
import { loadFallbackModule } from './pipeline-helpers.ts';
|
|
50
|
-
import { replaceOutermostSegmentOutlet } from './route-element-helpers.ts';
|
|
51
49
|
import { getActionErrorForRender } from './request-context.ts';
|
|
52
50
|
import { loadInterceptionGates } from './interception-gates.ts';
|
|
53
51
|
|
|
@@ -58,9 +56,8 @@ import { loadInterceptionGates } from './interception-gates.ts';
|
|
|
58
56
|
* Only its **length** matters: both hooks take `segments.length` as a depth and
|
|
59
57
|
* index the live pathname with it. So this is really "how many URL parts had
|
|
60
58
|
* been consumed by the time this layout rendered", which is
|
|
61
|
-
* `consumedUrlParts` — the same derivation slot matching
|
|
62
|
-
*
|
|
63
|
-
* deep they are. The root consumes nothing → `['']`, length 1.
|
|
59
|
+
* `consumedUrlParts` — the same derivation slot matching uses, so a layout
|
|
60
|
+
* and the slots beside it cannot disagree about how deep they are. The root consumes nothing → `['']`, length 1.
|
|
64
61
|
*
|
|
65
62
|
* @internal — exported for tests; production has exactly one caller.
|
|
66
63
|
*/
|
|
@@ -106,19 +103,6 @@ export interface RouteElementResult {
|
|
|
106
103
|
segments: ManifestSegmentNode[];
|
|
107
104
|
/** Max deferSuspenseFor hold window across all segments. */
|
|
108
105
|
deferSuspenseFor: number;
|
|
109
|
-
/**
|
|
110
|
-
* Segment paths that were skipped because the client already has them cached.
|
|
111
|
-
* Ordered outermost to innermost. Empty when no segments were skipped.
|
|
112
|
-
* The client uses this to merge the partial payload with cached segments.
|
|
113
|
-
* See design/19-client-navigation.md §"X-Timber-State-Tree Header"
|
|
114
|
-
*/
|
|
115
|
-
skippedSegments: string[];
|
|
116
|
-
/**
|
|
117
|
-
* Slot metadata for the X-Timber-Segments header. Contains info about
|
|
118
|
-
* all parallel route slots encountered during element tree construction,
|
|
119
|
-
* enabling the client to populate its segment cache with slot entries.
|
|
120
|
-
*/
|
|
121
|
-
slotSkipInfo: SlotSkipEntry[];
|
|
122
106
|
/**
|
|
123
107
|
* The deny page chain built from the leaf segment outward to root.
|
|
124
108
|
* Threaded into `renderRscStream` for late addressing of nested-component
|
|
@@ -154,12 +138,7 @@ function wrapMetadataCollectors(
|
|
|
154
138
|
return element;
|
|
155
139
|
}
|
|
156
140
|
|
|
157
|
-
/**
|
|
158
|
-
* Wrap an element in an AccessGate for one segment.
|
|
159
|
-
*
|
|
160
|
-
* Skipped segments pass `skippedSegment: true` and omit `denyPages`.
|
|
161
|
-
* Rendered segments pass `denyPages` and omit `skippedSegment`.
|
|
162
|
-
*/
|
|
141
|
+
/** Wrap an element in an AccessGate for one segment. */
|
|
163
142
|
function wrapAccessGate(
|
|
164
143
|
element: React.ReactElement,
|
|
165
144
|
opts: {
|
|
@@ -168,7 +147,6 @@ function wrapAccessGate(
|
|
|
168
147
|
segmentKey: string;
|
|
169
148
|
segmentIndex: number;
|
|
170
149
|
denyPages?: DenyPageEntry[];
|
|
171
|
-
skippedSegment?: boolean;
|
|
172
150
|
},
|
|
173
151
|
h: (...args: unknown[]) => React.ReactElement
|
|
174
152
|
): React.ReactElement {
|
|
@@ -177,7 +155,6 @@ function wrapAccessGate(
|
|
|
177
155
|
segmentName: opts.segment.segmentName,
|
|
178
156
|
segmentKey: opts.segmentKey,
|
|
179
157
|
segmentIndex: opts.segmentIndex,
|
|
180
|
-
...(opts.skippedSegment ? { skippedSegment: true } : {}),
|
|
181
158
|
...(opts.denyPages ? { denyPages: opts.denyPages } : {}),
|
|
182
159
|
children: element,
|
|
183
160
|
});
|
|
@@ -203,8 +180,8 @@ function wrapAccessGate(
|
|
|
203
180
|
export async function buildRouteElement(
|
|
204
181
|
req: Request,
|
|
205
182
|
match: RouteMatch,
|
|
206
|
-
interception
|
|
207
|
-
|
|
183
|
+
interception: InterceptionContext | undefined,
|
|
184
|
+
render: SegmentHashRender,
|
|
208
185
|
metadataRouteHashes?: Record<string, string>
|
|
209
186
|
): Promise<RouteElementResult> {
|
|
210
187
|
const segments = match.segments;
|
|
@@ -231,7 +208,7 @@ export async function buildRouteElement(
|
|
|
231
208
|
// Compute state-tree keys for all segments. Route groups accumulate
|
|
232
209
|
// ancestor group names for globally unique keys (e.g., "/(a)/(shared)"
|
|
233
210
|
// instead of just "/(shared)"). This is the single key computation —
|
|
234
|
-
// the same keys are used for
|
|
211
|
+
// the same keys are used for SegmentOutlet props, the
|
|
235
212
|
// X-Timber-Segments header (via buildSegmentInfo), the error boundaries,
|
|
236
213
|
// and deny page ownership.
|
|
237
214
|
//
|
|
@@ -304,128 +281,41 @@ export async function buildRouteElement(
|
|
|
304
281
|
element = h(TracedPage, {});
|
|
305
282
|
}
|
|
306
283
|
|
|
307
|
-
//
|
|
308
|
-
// renders siblings concurrently — the page starts immediately while
|
|
309
|
-
// MetadataHead awaits metadata promises. Float hoists the head
|
|
310
|
-
//
|
|
311
|
-
//
|
|
312
|
-
//
|
|
313
|
-
//
|
|
314
|
-
// See TIM-1363, TIM-1367, design/16-metadata.md.
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
h(MetadataHead, {
|
|
284
|
+
// Metadata is its own outlet, a SIBLING of the page rather than a wrapper.
|
|
285
|
+
// React renders siblings concurrently — the page starts immediately while
|
|
286
|
+
// MetadataHead awaits metadata promises. Float hoists the head elements to
|
|
287
|
+
// <head> regardless of tree position. Both resolve before onShellReady
|
|
288
|
+
// (outside Suspense), but they overlap. As its own outlet, a title that
|
|
289
|
+
// changes does not resend the page beside it, and a page's title does not
|
|
290
|
+
// land in the output of the layout above it (design/52 §"Metadata is its
|
|
291
|
+
// own unit"). See TIM-1363, TIM-1367, design/16-metadata.md.
|
|
292
|
+
const metadataOutlet: OutletSpec = {
|
|
293
|
+
segmentPath: METADATA_OUTLET_PATH,
|
|
294
|
+
content: h(MetadataHead, {
|
|
319
295
|
segments,
|
|
320
296
|
rawSegmentParams: match.rawSegmentParams,
|
|
321
297
|
requestUrl: req.url,
|
|
322
298
|
metadataRouteHashes,
|
|
323
299
|
}),
|
|
324
|
-
|
|
325
|
-
|
|
300
|
+
nested: [],
|
|
301
|
+
};
|
|
302
|
+
element = h(Fragment, null, outletGate(metadataOutlet, render), element);
|
|
326
303
|
|
|
327
304
|
// Build a lookup of layout components by segment for O(1) access.
|
|
328
305
|
const layoutBySegment = new Map(
|
|
329
306
|
layoutComponents.map(({ component, segment }) => [segment, component])
|
|
330
307
|
);
|
|
331
308
|
|
|
332
|
-
//
|
|
333
|
-
//
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
// See skippable-prefix.ts for the three sub-rules and slot-change guard.
|
|
338
|
-
const skippableSet = computeSkippableSet(
|
|
339
|
-
segments,
|
|
340
|
-
segmentKeys,
|
|
341
|
-
layoutBySegment,
|
|
342
|
-
clientStateTree,
|
|
343
|
-
match,
|
|
344
|
-
req
|
|
345
|
-
);
|
|
346
|
-
|
|
347
|
-
let outermostSegmentProvider: React.ReactElement | null = null;
|
|
348
|
-
|
|
349
|
-
// Slot caching uses key-based diffing (TIM-1370). The server computes a
|
|
350
|
-
// content key per slot and the client advertises keys for cached slots.
|
|
351
|
-
// The skip decision is a set-membership check — no departing URL needed.
|
|
352
|
-
const destinationUrl = req.url;
|
|
353
|
-
const slotSkipInfo: SlotSkipEntry[] = [];
|
|
309
|
+
// The outlets built so far that no outlet built so far contains — the ones
|
|
310
|
+
// the next outlet out will hold directly. A skipped outlet carries their
|
|
311
|
+
// decisions, because the client's cached copy of it still holds the old
|
|
312
|
+
// ones (segment-hash/outlet.ts).
|
|
313
|
+
let unclaimedOutlets: OutletSpec[] = [metadataOutlet];
|
|
354
314
|
|
|
355
315
|
for (let i = segments.length - 1; i >= 0; i--) {
|
|
356
316
|
const segment = segments[i];
|
|
357
|
-
const isLeaf = i === segments.length - 1;
|
|
358
317
|
const layoutComponent = layoutBySegment.get(segment);
|
|
359
318
|
|
|
360
|
-
// Skip decision was pre-computed in the top-down prefix pass.
|
|
361
|
-
if (skippableSet.has(i)) {
|
|
362
|
-
// Record for X-Timber-Skipped-Segments header (outermost first, so prepend).
|
|
363
|
-
skippedSegments.unshift(segmentKeys[i]);
|
|
364
|
-
|
|
365
|
-
// A skipped layout never reaches resolveSlotProps below, but its slots
|
|
366
|
-
// stay mounted on the client — so their params still have to be
|
|
367
|
-
// published, or useSegmentParams(slotPath) falls back to the main
|
|
368
|
-
// route's record after any navigation that skipped their parent
|
|
369
|
-
// (TIM-1285). Params only: nothing renders and no access chain runs,
|
|
370
|
-
// because an unchanged slot is what made this layout skippable.
|
|
371
|
-
publishSlotSegmentParams(segment, match, destinationUrl, segmentTreePaths[i]);
|
|
372
|
-
|
|
373
|
-
// Emit slot metadata so the client's segment tree retains contentKeys
|
|
374
|
-
// for slots of skipped layouts. Without this, the client rebuilds its
|
|
375
|
-
// tree from the response and loses slot keys it can't advertise next time.
|
|
376
|
-
emitSlotInfoForSkippedLayout(segment, segmentKeys[i], match, destinationUrl, slotSkipInfo);
|
|
377
|
-
|
|
378
|
-
// No error boundaries are wrapped for a skipped segment — the `continue`
|
|
379
|
-
// below returns before that walk. A deny addressed to this segment
|
|
380
|
-
// therefore finds no boundary in the payload, and since TIM-1356 the
|
|
381
|
-
// payload path no longer falls back to a re-render for an addressed
|
|
382
|
-
// deny. What makes that sound is the precondition for skipping at all:
|
|
383
|
-
// `shouldSkipSegment` only returns true when this exact segment key is
|
|
384
|
-
// in the client's state tree, which means the client rendered this
|
|
385
|
-
// segment on an earlier navigation and still has its boundaries mounted,
|
|
386
|
-
// carrying the same key this build would have stamped. The payload
|
|
387
|
-
// splices in below them, so the throw passes through them on its way up.
|
|
388
|
-
//
|
|
389
|
-
// Metadata from skipped segments still needs to be collected (e.g.,
|
|
390
|
-
// root layout title templates). MetadataCollector wraps the element
|
|
391
|
-
// inside AccessGate — if access denies, metadata is excluded.
|
|
392
|
-
const skippedMeta = metadataSources.filter((s) => s.segmentIndex === i).reverse();
|
|
393
|
-
element = wrapMetadataCollectors(element, skippedMeta, h);
|
|
394
|
-
|
|
395
|
-
// SECURITY: Even though the layout is skipped, AccessGate MUST still
|
|
396
|
-
// wrap the element tree. access.ts runs on every navigation regardless
|
|
397
|
-
// of cached layouts or state tree content.
|
|
398
|
-
// See design/13-security.md §"Auth always runs" (test #11).
|
|
399
|
-
//
|
|
400
|
-
// Skipped segments omit denyPages and set skippedSegment=true. If
|
|
401
|
-
// access denies at a skipped segment, AccessGate records the deny in
|
|
402
|
-
// ALS and rethrows. Rendering the deny page in-tree here would appear
|
|
403
|
-
// inside the client's cached layout chrome (TIM-1074), so the throw
|
|
404
|
-
// goes to Flight's onError instead: addressed there against the leaf
|
|
405
|
-
// chain, its row is claimed by the boundary the client still has
|
|
406
|
-
// mounted at the owner (TIM-1450); with no addressable file it stays
|
|
407
|
-
// unplaced, and the response path answers with rscErrorEnvelope so the
|
|
408
|
-
// client hard-navigates for a clean full render — when the deny lands
|
|
409
|
-
// inside Flight's opening window. After it, the unaddressed row reaches
|
|
410
|
-
// the terminal boundary the last full render left mounted. See TIM-1363.
|
|
411
|
-
const accessFn = gateFor(i);
|
|
412
|
-
if (accessFn) {
|
|
413
|
-
element = wrapAccessGate(
|
|
414
|
-
element,
|
|
415
|
-
{
|
|
416
|
-
accessFn,
|
|
417
|
-
segment,
|
|
418
|
-
segmentKey: segmentKeys[i],
|
|
419
|
-
segmentIndex: i,
|
|
420
|
-
skippedSegment: true,
|
|
421
|
-
},
|
|
422
|
-
h
|
|
423
|
-
);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
continue;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
319
|
// Wrap with MetadataCollector(s) INSIDE error boundaries so a
|
|
430
320
|
// metadata() throw is caught by this segment's status-file boundaries,
|
|
431
321
|
// not an ancestor's. Still inside AccessGate (placed below) — when
|
|
@@ -460,26 +350,34 @@ export async function buildRouteElement(
|
|
|
460
350
|
// This prevents leaking layout UI (sidebars, nav) on denied pages.
|
|
461
351
|
// See design/04-authorization.md §"Access Failure".
|
|
462
352
|
if (layoutComponent) {
|
|
463
|
-
// Resolve parallel slots for this layout. If a parent AccessGate
|
|
464
|
-
// denies during render, the layout never renders and slot props
|
|
465
|
-
// are never consumed. Slot access functions may still fire eagerly
|
|
466
|
-
// for skip-candidate slots — a follow-up will make that lazy.
|
|
467
353
|
const segmentId = segmentKeys[i];
|
|
468
|
-
|
|
469
|
-
|
|
354
|
+
|
|
355
|
+
// Everything this layout receives as `children` is one outlet, and the
|
|
356
|
+
// layout's own outlet below is another: the layout's hash covers its
|
|
357
|
+
// chrome, not what renders under it.
|
|
358
|
+
const childrenOutlet: OutletSpec = {
|
|
359
|
+
segmentPath: childrenOutletKey(segmentId),
|
|
360
|
+
content: element,
|
|
361
|
+
nested: unclaimedOutlets,
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
// Resolve parallel slots for this layout, each in its own outlet. If a
|
|
365
|
+
// parent AccessGate denies during render, the layout never renders and
|
|
366
|
+
// slot props are never consumed.
|
|
367
|
+
const slots = await resolveSlotProps({
|
|
470
368
|
segment,
|
|
471
369
|
segmentId,
|
|
472
370
|
match,
|
|
473
371
|
h,
|
|
474
372
|
interception,
|
|
475
|
-
parentTreePath,
|
|
373
|
+
parentTreePath: segmentTreePaths[i],
|
|
476
374
|
req,
|
|
477
|
-
|
|
478
|
-
slotSkipInfo,
|
|
375
|
+
render,
|
|
479
376
|
});
|
|
480
377
|
|
|
481
378
|
const segmentPath = computeLayoutSegmentPath(segments, i, match);
|
|
482
379
|
const parallelRouteKeys = Object.keys(segment.slots ?? {});
|
|
380
|
+
const layoutProps = { ...slots.props, children: outletGate(childrenOutlet, render) };
|
|
483
381
|
|
|
484
382
|
// Build the layout element.
|
|
485
383
|
// Keep the descendant tree in a SERVER layout's children prop. Moving it
|
|
@@ -491,10 +389,7 @@ export async function buildRouteElement(
|
|
|
491
389
|
// treat a client layout as an authorization or data-hiding boundary.
|
|
492
390
|
let layoutElement: React.ReactElement;
|
|
493
391
|
if (isClientReference(layoutComponent)) {
|
|
494
|
-
layoutElement = h(layoutComponent,
|
|
495
|
-
...slotProps,
|
|
496
|
-
children: element,
|
|
497
|
-
});
|
|
392
|
+
layoutElement = h(layoutComponent, layoutProps);
|
|
498
393
|
} else {
|
|
499
394
|
// Server component layout — wrap with OTEL tracing AND DenySignal
|
|
500
395
|
// catching. If the layout calls deny(), the signal is caught here
|
|
@@ -523,10 +418,7 @@ export async function buildRouteElement(
|
|
|
523
418
|
throw error;
|
|
524
419
|
}
|
|
525
420
|
};
|
|
526
|
-
layoutElement = h(TracedLayout,
|
|
527
|
-
...slotProps,
|
|
528
|
-
children: element,
|
|
529
|
-
});
|
|
421
|
+
layoutElement = h(TracedLayout, layoutProps);
|
|
530
422
|
|
|
531
423
|
// A second, deny-only copy of this segment's boundaries OUTSIDE its
|
|
532
424
|
// layout. The copy above (inside the layout) is the one a page error
|
|
@@ -537,9 +429,9 @@ export async function buildRouteElement(
|
|
|
537
429
|
// a deny in the layout body: with its own file, replacing the layout.
|
|
538
430
|
// A hoisted deny addressed further up passes through unclaimed.
|
|
539
431
|
//
|
|
540
|
-
// Inside
|
|
541
|
-
//
|
|
542
|
-
//
|
|
432
|
+
// Inside the layout's outlet, so a skipped layout's cached copy on
|
|
433
|
+
// the client carries it along. See TIM-1450,
|
|
434
|
+
// design/04-authorization.md §"Where a Deny Page Renders".
|
|
543
435
|
layoutElement = await wrapSegmentWithErrorBoundaries(segment, layoutElement, {
|
|
544
436
|
loadModule: loadBoundaryModule,
|
|
545
437
|
createElement: h,
|
|
@@ -549,24 +441,18 @@ export async function buildRouteElement(
|
|
|
549
441
|
});
|
|
550
442
|
}
|
|
551
443
|
|
|
552
|
-
const
|
|
553
|
-
segments: segmentPath,
|
|
554
|
-
segmentId,
|
|
555
|
-
parallelRouteKeys,
|
|
556
|
-
children: layoutElement,
|
|
557
|
-
});
|
|
558
|
-
|
|
559
|
-
element = h(clientComponents().SegmentOutlet, {
|
|
444
|
+
const layoutOutlet: OutletSpec = {
|
|
560
445
|
segmentPath: segmentId,
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
446
|
+
content: h(clientComponents().SegmentProvider, {
|
|
447
|
+
segments: segmentPath,
|
|
448
|
+
segmentId,
|
|
449
|
+
parallelRouteKeys,
|
|
450
|
+
children: layoutElement,
|
|
451
|
+
}),
|
|
452
|
+
nested: [childrenOutlet, ...slots.outlets],
|
|
453
|
+
};
|
|
454
|
+
element = outletGate(layoutOutlet, render);
|
|
455
|
+
unclaimedOutlets = [layoutOutlet];
|
|
570
456
|
}
|
|
571
457
|
|
|
572
458
|
// Wrap in AccessGate OUTSIDE the layout, error boundaries, and MetadataCollector.
|
|
@@ -574,6 +460,10 @@ export async function buildRouteElement(
|
|
|
574
460
|
// Parent layouts (from outer iterations) form the shell. Access runs
|
|
575
461
|
// exactly once, during render, inside React.cache scope — layouts
|
|
576
462
|
// share the cache. See TIM-1363, design/04-authorization.md.
|
|
463
|
+
//
|
|
464
|
+
// It sits in the enclosing outlet's content, so a segment skipped by
|
|
465
|
+
// hash still has its access checked: the capture that produced the hash
|
|
466
|
+
// ran this gate, and a deny there changes the hash (segment-hash/outlet.ts).
|
|
577
467
|
const accessFn = gateFor(i);
|
|
578
468
|
if (accessFn) {
|
|
579
469
|
element = wrapAccessGate(
|
|
@@ -595,15 +485,6 @@ export async function buildRouteElement(
|
|
|
595
485
|
// their deny (TIM-1607).
|
|
596
486
|
if (interceptionGates) element = interceptionGates.wrap(element, h);
|
|
597
487
|
|
|
598
|
-
// On partial navigation (some segments skipped), the client already has a
|
|
599
|
-
// SegmentOutlet mounted at the outermost non-skipped segment's position.
|
|
600
|
-
// Sending another SegmentOutlet in the payload causes double-wrapping —
|
|
601
|
-
// the inner outlet reads the same context update and recurses infinitely.
|
|
602
|
-
// Replace the outermost SegmentOutlet with just its SegmentProvider child.
|
|
603
|
-
if (skippedSegments.length > 0 && outermostSegmentProvider) {
|
|
604
|
-
element = replaceOutermostSegmentOutlet(element, outermostSegmentProvider);
|
|
605
|
-
}
|
|
606
|
-
|
|
607
488
|
// The deny chain's terminal, for a deny that streamed as an error row and
|
|
608
489
|
// that no segment boundary — inner or outer — could claim. With the outer
|
|
609
490
|
// copies above, that is one shape only: a server component in a layout's
|
|
@@ -613,23 +494,15 @@ export async function buildRouteElement(
|
|
|
613
494
|
// path does for a deny with no file. A non-deny row nothing claimed ends
|
|
614
495
|
// here too: the terminal leaves the SPA so the document request renders
|
|
615
496
|
// the real error page (see TimberErrorBoundary). Outside every segment
|
|
616
|
-
// boundary, inside the payload root so hydration agrees.
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
if (skippedSegments.length === 0) {
|
|
623
|
-
element = h(clientComponents().TimberErrorBoundary, {
|
|
624
|
-
lastResort: true,
|
|
625
|
-
fallbackComponent: clientComponents().DenyLastResort,
|
|
626
|
-
children: element,
|
|
627
|
-
});
|
|
628
|
-
}
|
|
497
|
+
// boundary, inside the payload root so hydration agrees. See TIM-1450.
|
|
498
|
+
element = h(clientComponents().TimberErrorBoundary, {
|
|
499
|
+
lastResort: true,
|
|
500
|
+
fallbackComponent: clientComponents().DenyLastResort,
|
|
501
|
+
children: element,
|
|
502
|
+
});
|
|
629
503
|
|
|
630
504
|
// Publish the request's params beside the finished tree, as the payload's
|
|
631
|
-
// root row.
|
|
632
|
-
// tree and this takes it as it finally stands.
|
|
505
|
+
// root row.
|
|
633
506
|
const payload = withPublishedParams(element);
|
|
634
507
|
|
|
635
508
|
return {
|
|
@@ -637,8 +510,6 @@ export async function buildRouteElement(
|
|
|
637
510
|
layoutComponents,
|
|
638
511
|
segments,
|
|
639
512
|
deferSuspenseFor,
|
|
640
|
-
skippedSegments,
|
|
641
|
-
slotSkipInfo,
|
|
642
513
|
leafDenyChain: leafDenyPages,
|
|
643
514
|
};
|
|
644
515
|
}
|
|
@@ -7,37 +7,22 @@
|
|
|
7
7
|
import type { ManifestSegmentNode } from '../route-matcher.ts';
|
|
8
8
|
import { computeSegmentKeys, computeSegmentTreePaths } from '../../routing/segment-keys.ts';
|
|
9
9
|
import type { SegmentInfo } from '../../shared/segment-info.ts';
|
|
10
|
-
import type { SlotSkipEntry } from '../slot-resolver.ts';
|
|
11
|
-
import { isClientReference } from '../utils/element-type.ts';
|
|
12
|
-
import { isStaticRequestDependent } from '../request-dep.ts';
|
|
13
10
|
|
|
14
11
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
12
|
+
* Describe the mounted segment chain for `X-Timber-Segments` and the
|
|
13
|
+
* `self.__timber_segments` bootstrap: every layout-bearing segment above the
|
|
14
|
+
* first one that denied. The client reports these back as `treePaths` for
|
|
15
|
+
* interception scoping (design/07-routing.md §"Intercepting Routes").
|
|
18
16
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* request-dependent if any reachable module calls a request accessor.
|
|
22
|
-
* This replaces the previous runtime ALS-based taint tracking which
|
|
23
|
-
* couldn't attribute accessor calls in Flight-deferred child components.
|
|
24
|
-
*
|
|
25
|
-
* See design/07-routing.md §"Server Diffing Rules".
|
|
17
|
+
* Nothing here is about caching — what the client may reuse is decided by
|
|
18
|
+
* segment hashes in the payload itself (design/52-segment-hash-dedupe.md).
|
|
26
19
|
*/
|
|
27
20
|
export function buildSegmentInfo(
|
|
28
21
|
segments: ManifestSegmentNode[],
|
|
29
|
-
layoutComponents: Array<{
|
|
30
|
-
component: (...args: unknown[]) => unknown;
|
|
31
|
-
segment: ManifestSegmentNode;
|
|
32
|
-
}>,
|
|
33
|
-
slotSkipInfo?: SlotSkipEntry[],
|
|
34
|
-
skippedSegmentKeys?: string[],
|
|
22
|
+
layoutComponents: Array<{ segment: ManifestSegmentNode }>,
|
|
35
23
|
firstDeniedIndex = Infinity
|
|
36
24
|
): SegmentInfo[] {
|
|
37
|
-
const
|
|
38
|
-
layoutComponents.map(({ component, segment }) => [segment, component])
|
|
39
|
-
);
|
|
40
|
-
|
|
25
|
+
const withLayout = new Set(layoutComponents.map(({ segment }) => segment));
|
|
41
26
|
const segmentKeys = computeSegmentKeys(segments);
|
|
42
27
|
// The scope identity interception compares against. Emitted for every
|
|
43
28
|
// layout-bearing segment, which is exactly the set that can own a scope:
|
|
@@ -45,11 +30,8 @@ export function buildSegmentInfo(
|
|
|
45
30
|
// (`route-element-builder.ts`), so a segment with no layout can never hold
|
|
46
31
|
// an intercepting slot. See TIM-1282.
|
|
47
32
|
const treePaths = computeSegmentTreePaths(segments);
|
|
48
|
-
const skippedSet = skippedSegmentKeys ? new Set(skippedSegmentKeys) : null;
|
|
49
33
|
const result: SegmentInfo[] = [];
|
|
50
34
|
|
|
51
|
-
// Deepest segment that actually mounted, exclusive.
|
|
52
|
-
//
|
|
53
35
|
for (let i = 0; i < segments.length; i++) {
|
|
54
36
|
// A denied segment's AccessGate renders the deny page in place of the
|
|
55
37
|
// layout, so this segment and everything below it never mounted. Their
|
|
@@ -58,50 +40,14 @@ export function buildSegmentInfo(
|
|
|
58
40
|
// the client is told it has a tree it does not, and `treePaths` reports a
|
|
59
41
|
// slot owner whose slot was never resolved (TIM-1282).
|
|
60
42
|
if (i >= firstDeniedIndex) break;
|
|
61
|
-
|
|
62
43
|
const segment = segments[i];
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (!component) continue;
|
|
44
|
+
if (!withLayout.has(segment)) continue;
|
|
66
45
|
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
if (isClientReference(component)) {
|
|
70
|
-
isRequestDependent = false;
|
|
71
|
-
} else if (skippedSet?.has(segmentId)) {
|
|
72
|
-
isRequestDependent = false;
|
|
73
|
-
} else if (segment.layout) {
|
|
74
|
-
isRequestDependent = isStaticRequestDependent(segment.layout.filePath);
|
|
75
|
-
} else {
|
|
76
|
-
isRequestDependent = true;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const entry: SegmentInfo = {
|
|
80
|
-
path: segment.urlPath,
|
|
81
|
-
treePath: treePaths[i],
|
|
82
|
-
isRequestDependent,
|
|
83
|
-
};
|
|
84
|
-
if (segmentId !== segment.urlPath) {
|
|
85
|
-
entry.segmentId = segmentId;
|
|
86
|
-
}
|
|
46
|
+
const entry: SegmentInfo = { path: segment.urlPath, treePath: treePaths[i] };
|
|
47
|
+
if (segmentKeys[i] !== segment.urlPath) entry.segmentId = segmentKeys[i];
|
|
87
48
|
result.push(entry);
|
|
88
49
|
}
|
|
89
50
|
|
|
90
|
-
if (slotSkipInfo) {
|
|
91
|
-
for (const slot of slotSkipInfo) {
|
|
92
|
-
const entry: SegmentInfo = {
|
|
93
|
-
path: slot.slotKey,
|
|
94
|
-
isRequestDependent: slot.isRequestDependent,
|
|
95
|
-
slot: true,
|
|
96
|
-
parentSegment: slot.parentSegmentId,
|
|
97
|
-
contentKey: slot.contentKey,
|
|
98
|
-
};
|
|
99
|
-
if (slot.skipped) entry.skipped = true;
|
|
100
|
-
if (slot.denied) entry.denied = true;
|
|
101
|
-
result.push(entry);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
51
|
return result;
|
|
106
52
|
}
|
|
107
53
|
|