@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
|
@@ -1,96 +1,104 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SegmentOutlet — client
|
|
2
|
+
* SegmentOutlet — the client boundary around one segment: a layout's own
|
|
3
|
+
* chrome, a layout's `children`, a parallel slot, or the page's metadata.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
* 1. Knows its segment path (prop from the server)
|
|
6
|
-
* 2. Reads from SegmentUpdateContext for partial navigation updates
|
|
7
|
-
* 3. Reads from — and, at commit, writes to — the router's slot content
|
|
8
|
-
* cache, so a skipped parallel slot keeps showing what it last committed
|
|
5
|
+
* The server decides each outlet (server/segment-hash/outlet.ts):
|
|
9
6
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* On a skipped parallel slot (`skip=true`, children null): the outlet renders
|
|
18
|
-
* the content it last committed for this path.
|
|
7
|
+
* - **Live** — the outlet renders the content it was sent, and once React
|
|
8
|
+
* commits it, records it in the router's outlet content cache beside the
|
|
9
|
+
* hash the server computed from the rows that carried it.
|
|
10
|
+
* - **Skip** — the client already holds content with this hash. The outlet
|
|
11
|
+
* renders the cached copy, and provides the nested outlets' new decisions
|
|
12
|
+
* to the outlet elements inside that copy (client/outlet-scope-context.ts),
|
|
13
|
+
* so each renders its segment's new decision in place.
|
|
19
14
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
15
|
+
* Every navigation renders the payload root, and every outlet in it is live
|
|
16
|
+
* or skipped on its own. There is no partial payload spliced into a retained
|
|
17
|
+
* tree: an unchanged segment keeps its state because it renders the same
|
|
18
|
+
* elements at the same position.
|
|
24
19
|
*
|
|
25
|
-
* Render is a pure read. The only write — recording committed
|
|
26
|
-
* happens in a layout effect, so a render React throws away
|
|
27
|
-
*
|
|
28
|
-
* resolves to (TIM-1423). See client/slot-content-cache-context.ts.
|
|
20
|
+
* Render is a pure read. The only write — recording committed content —
|
|
21
|
+
* happens in a layout effect, so a render React throws away cannot poison
|
|
22
|
+
* what a later skip resolves to (TIM-1423).
|
|
29
23
|
*
|
|
30
|
-
* Security: performance
|
|
31
|
-
*
|
|
32
|
-
* See design/13-security.md §"State tree manipulation".
|
|
24
|
+
* Security: performance only. The server runs every access.ts regardless, and
|
|
25
|
+
* a skip whose hash the client does not hold leaves the SPA rather than show
|
|
26
|
+
* other content. See design/13-security.md §"State tree manipulation".
|
|
33
27
|
*/
|
|
34
28
|
|
|
35
29
|
'use client';
|
|
36
30
|
|
|
37
|
-
import { useContext, useLayoutEffect, type ReactNode } from 'react';
|
|
38
|
-
import {
|
|
39
|
-
|
|
31
|
+
import { createElement, use, useContext, useLayoutEffect, useMemo, type ReactNode } from 'react';
|
|
32
|
+
import type {
|
|
33
|
+
CaptureHole,
|
|
34
|
+
OutletDecision,
|
|
35
|
+
OutletDecisionValue,
|
|
36
|
+
} from '../shared/outlet-decision.ts';
|
|
37
|
+
import { OutletContentCacheContext } from './outlet-content-cache.ts';
|
|
38
|
+
import { LIVE_OUTLET_SCOPE, OutletScopeContext, type OutletScope } from './outlet-scope-context.ts';
|
|
39
|
+
import { staleSegmentError } from './stale-segment.ts';
|
|
40
40
|
|
|
41
41
|
export interface SegmentOutletProps {
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* the same urlPath. For slots this includes the slot name (e.g., "/@sidebar").
|
|
47
|
-
* Must match the segmentId used in state-tree-diff.ts.
|
|
43
|
+
* The outlet's key: a segment id (`/`, `/(marketing)`), a slot key
|
|
44
|
+
* (`/@sidebar`), a layout's children (`/dashboard/@children`), or the
|
|
45
|
+
* metadata outlet.
|
|
48
46
|
*/
|
|
49
47
|
segmentPath: string;
|
|
50
|
-
|
|
51
|
-
/** The segment's React subtree (layout + inner content). */
|
|
52
|
-
children: ReactNode;
|
|
53
|
-
|
|
54
48
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* server sends an empty SegmentOutlet with skip=true, and the client keeps
|
|
58
|
-
* the previously committed slot content.
|
|
49
|
+
* What the server decided for this segment. Absent only on the bare holes
|
|
50
|
+
* a capture render emits, which never reach the client.
|
|
59
51
|
*/
|
|
60
|
-
|
|
52
|
+
decision?: OutletDecisionValue | CaptureHole;
|
|
61
53
|
}
|
|
62
54
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
55
|
+
function isCaptureHole(value: OutletDecisionValue | CaptureHole): value is CaptureHole {
|
|
56
|
+
return 'captureHole' in value;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function isThenable(value: OutletDecisionValue): value is PromiseLike<OutletDecision> {
|
|
60
|
+
return typeof (value as PromiseLike<OutletDecision>).then === 'function';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function SegmentOutlet({ segmentPath, decision }: SegmentOutletProps): ReactNode {
|
|
64
|
+
const scope = useContext(OutletScopeContext);
|
|
65
|
+
const cache = useContext(OutletContentCacheContext);
|
|
66
|
+
|
|
67
|
+
// Inside a skipped segment's cached content this element is from an
|
|
68
|
+
// earlier render; the skip handed down this segment's new decision.
|
|
69
|
+
const value = scope.skipped ? scope.decisions.get(segmentPath) : decision;
|
|
70
|
+
// A capture's hole marker is replaced before anything is sent; one that got
|
|
71
|
+
// through is a decision the client does not have.
|
|
72
|
+
if (value === undefined || isCaptureHole(value)) throw staleSegmentError(segmentPath);
|
|
73
|
+
const resolved = isThenable(value) ? use(value) : value;
|
|
79
74
|
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
const content: ReactNode =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
const cached = resolved.skip ? cache?.lookup(segmentPath, resolved.hash) : undefined;
|
|
76
|
+
if (resolved.skip && !cached) throw staleSegmentError(segmentPath);
|
|
77
|
+
const content: ReactNode = resolved.skip ? cached!.content : resolved.children;
|
|
78
|
+
const childScope = useMemo<OutletScope>(
|
|
79
|
+
() =>
|
|
80
|
+
resolved.skip
|
|
81
|
+
? { skipped: true, decisions: new Map(Object.entries(resolved.outlets)) }
|
|
82
|
+
: LIVE_OUTLET_SCOPE,
|
|
83
|
+
[resolved]
|
|
84
|
+
);
|
|
87
85
|
|
|
88
|
-
// Commit-time write
|
|
89
|
-
//
|
|
90
|
-
const record = hasUpdate || !skip;
|
|
86
|
+
// Commit-time write: live content is recorded once React commits it, and
|
|
87
|
+
// its hash attached when the server's arrives.
|
|
91
88
|
useLayoutEffect(() => {
|
|
92
|
-
if (
|
|
93
|
-
|
|
89
|
+
if (cache === null) return;
|
|
90
|
+
if (resolved.skip) {
|
|
91
|
+
cache.touch(segmentPath);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const entry = cache.record(segmentPath, content);
|
|
95
|
+
resolved.hash?.then(
|
|
96
|
+
(hash) => {
|
|
97
|
+
if (hash) cache.attachHash(segmentPath, entry, hash);
|
|
98
|
+
},
|
|
99
|
+
() => {}
|
|
100
|
+
);
|
|
101
|
+
}, [resolved, cache, segmentPath, content]);
|
|
94
102
|
|
|
95
|
-
return content;
|
|
103
|
+
return createElement(OutletScopeContext.Provider, { value: childScope }, content);
|
|
96
104
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The error a `SegmentOutlet` throws when it cannot render what the server
|
|
3
|
+
* decided — a skip whose content the client no longer holds under that hash,
|
|
4
|
+
* or an outlet inside a skipped segment that received no new decision.
|
|
5
|
+
*
|
|
6
|
+
* Either means the client's record moved on between the request and the
|
|
7
|
+
* response (a prefetch consumed late, a replayed payload whose content was
|
|
8
|
+
* evicted). Rendering anything else would show content the server did not
|
|
9
|
+
* produce, so the error passes every boundary to the terminal, which fetches
|
|
10
|
+
* the page again (`recoverFromStaleSegment`) — and leaves the SPA only if
|
|
11
|
+
* that misses too (design/52 §"The client checks before reusing").
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export interface StaleSegmentDigest {
|
|
15
|
+
type: 'stale-segment';
|
|
16
|
+
leaveSpa: true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function staleSegmentError(segmentPath: string): Error {
|
|
20
|
+
const error = new Error(`[timber] content for segment "${segmentPath}" is no longer held`);
|
|
21
|
+
const digest: StaleSegmentDigest = { type: 'stale-segment', leaveSpa: true };
|
|
22
|
+
(error as Error & { digest: string }).digest = JSON.stringify(digest);
|
|
23
|
+
return error;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** The router surface recovery needs. */
|
|
27
|
+
interface RecoveryRouter {
|
|
28
|
+
getPendingUrl(): string | null;
|
|
29
|
+
navigate(url: string, options?: { replace?: boolean; scroll?: boolean }): PromiseLike<unknown>;
|
|
30
|
+
refresh(): PromiseLike<unknown>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** A recovery in flight: a second stale segment during it leaves the SPA. */
|
|
34
|
+
let recovering = false;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Answer a stale segment by fetching the page again inside the SPA. The new
|
|
38
|
+
* request advertises only what the client holds now, so every skip it gets
|
|
39
|
+
* names content that is there. A navigation still in flight is re-requested;
|
|
40
|
+
* otherwise the page on the address bar — a traversal has already moved it —
|
|
41
|
+
* is refreshed, which sends no hashes at all.
|
|
42
|
+
*
|
|
43
|
+
* Returns false when the caller should leave the SPA instead: there is no
|
|
44
|
+
* router, or this miss happened while recovering from the last one.
|
|
45
|
+
*/
|
|
46
|
+
export function recoverFromStaleSegment(router: RecoveryRouter | null): boolean {
|
|
47
|
+
if (!router || recovering) return false;
|
|
48
|
+
recovering = true;
|
|
49
|
+
const pending = router.getPendingUrl();
|
|
50
|
+
const done = () => {
|
|
51
|
+
recovering = false;
|
|
52
|
+
};
|
|
53
|
+
queueMicrotask(() => {
|
|
54
|
+
const handle = pending
|
|
55
|
+
? router.navigate(pending, { replace: true, scroll: false })
|
|
56
|
+
: router.refresh();
|
|
57
|
+
Promise.resolve(handle).then(done, done);
|
|
58
|
+
});
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* One unconditional read of ParamsContext, on every side (TIM-1425):
|
|
18
18
|
*
|
|
19
19
|
* - In the browser, `PayloadRoot` publishes the payload's params above the
|
|
20
|
-
*
|
|
20
|
+
* payload root on every render path. Params update atomically with the RSC
|
|
21
21
|
* tree — no timing gap (TIM-1294, TIM-1297).
|
|
22
22
|
* - During SSR, the wrapper chain mounts the same `PayloadRoot`, fed the
|
|
23
23
|
* `params` half of `splitPayloadRoot(root)` — the identical derivation
|
package/src/config-types.ts
CHANGED
|
@@ -327,19 +327,20 @@ export interface TimberUserConfig {
|
|
|
327
327
|
*/
|
|
328
328
|
buildDir?: string;
|
|
329
329
|
/**
|
|
330
|
-
*
|
|
330
|
+
* Skip unchanged segments on client navigation (segment hash dedupe).
|
|
331
331
|
*
|
|
332
|
-
* When enabled,
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
332
|
+
* When enabled, every live segment the server sends carries a hash of its
|
|
333
|
+
* output, and the router advertises the hashes of the content it holds in
|
|
334
|
+
* `X-Timber-State-Tree`. The server still renders every segment; one whose
|
|
335
|
+
* output hashes the same as the client's copy is sent as a skip, and the
|
|
336
|
+
* client keeps its copy. Every segment renders once either way.
|
|
336
337
|
*
|
|
337
338
|
* When disabled (the default), every navigation gets a full RSC payload.
|
|
338
339
|
*
|
|
339
340
|
* This is a performance optimization only — not a security boundary.
|
|
340
341
|
* The server always runs all `access.ts` files regardless.
|
|
341
342
|
*
|
|
342
|
-
* See design/
|
|
343
|
+
* See design/52-segment-hash-dedupe.md
|
|
343
344
|
*/
|
|
344
345
|
clientSegmentCache?: boolean;
|
|
345
346
|
/**
|
package/src/index.ts
CHANGED
|
@@ -33,7 +33,6 @@ import { clientChunkGroup } from './plugins/client-chunks.ts';
|
|
|
33
33
|
import { timberServerBundle } from './plugins/server-bundle.ts';
|
|
34
34
|
import { timberEncryptionRuntime } from './plugins/encryption-runtime.ts';
|
|
35
35
|
import { timberCacheTransform } from './plugins/cache.ts';
|
|
36
|
-
import { timberRequestDep } from './plugins/request-dep/index.ts';
|
|
37
36
|
import { timberOptimizePackageImports } from './plugins/optimize-package-imports.ts';
|
|
38
37
|
import { timberClientInServerPackageDeps } from './plugins/client-in-server-package-deps.ts';
|
|
39
38
|
import { timberNodeFlightBuilds } from './plugins/node-flight-builds.ts';
|
|
@@ -592,7 +591,6 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
|
592
591
|
timberMdx(ctx),
|
|
593
592
|
timberOptimizePackageImports(ctx), // Listed barrels → the modules that define the imported names
|
|
594
593
|
timberClientInServerPackageDeps(), // Dev: a package's inner 'use client' file → its bare path, so the browser pre-bundles it
|
|
595
|
-
timberRequestDep(ctx),
|
|
596
594
|
timberCacheTransform(ctx),
|
|
597
595
|
timberPrerenderSugar(ctx), // export const prerender → cache.component() desugaring
|
|
598
596
|
prebuilt, // cache.component() → __prebuilt() callsite rewrite
|
package/src/plugin-context.ts
CHANGED
|
@@ -120,22 +120,6 @@ export interface PluginContext {
|
|
|
120
120
|
* populate per-route modulepreload entries from clientReferenceDeps.
|
|
121
121
|
*/
|
|
122
122
|
routeClientRefKeys?: Map<string, Set<string>>;
|
|
123
|
-
/**
|
|
124
|
-
* Static request-dependency verdict per segment entry file, keyed by the
|
|
125
|
-
* absolute `filePath` the route scanner produced. Computed once by
|
|
126
|
-
* `timber-request-dep`'s RSC `buildEnd` and serialized into
|
|
127
|
-
* `buildManifest.requestDep` by `timber-build-manifest` (build only — dev
|
|
128
|
-
* answers the same question through the `Symbol.for('timber:request-dep')`
|
|
129
|
-
* bridge instead).
|
|
130
|
-
*
|
|
131
|
-
* `undefined` and `{}` are different states and the difference is the whole
|
|
132
|
-
* of TIM-1300: an empty object means the analysis ran and found no segments,
|
|
133
|
-
* `undefined` means it never ran, and the runtime cannot tell them apart —
|
|
134
|
-
* every key is absent either way, so every segment falls to the conservative
|
|
135
|
-
* `true` and nothing is ever skipped. The build fails loudly on `undefined`
|
|
136
|
-
* rather than shipping that silently.
|
|
137
|
-
*/
|
|
138
|
-
requestDepMap?: Record<string, boolean>;
|
|
139
123
|
/**
|
|
140
124
|
* Maps absolute module IDs of client references in non-facade RSC
|
|
141
125
|
* chunks to the absolute paths of their consuming facade modules.
|
|
@@ -385,7 +385,7 @@ export function timberBuildManifest(ctx: PluginContext): Plugin {
|
|
|
385
385
|
'// Auto-generated build manifest — do not edit.',
|
|
386
386
|
'// Production: reads manifest from globalThis (set by _timber-manifest-init.js).',
|
|
387
387
|
'// The object below is only the fallback for when that global is unset —',
|
|
388
|
-
'// the real manifest
|
|
388
|
+
'// the real manifest is in that init module.',
|
|
389
389
|
'',
|
|
390
390
|
`const manifest = globalThis.__TIMBER_BUILD_MANIFEST__ ?? ${empty};`,
|
|
391
391
|
'',
|
|
@@ -437,27 +437,6 @@ export function timberBuildManifest(ctx: PluginContext): Plugin {
|
|
|
437
437
|
ctx.buildManifest.metadataRouteHashes = computeMetadataRouteHashes(ctx.routeTree.root);
|
|
438
438
|
}
|
|
439
439
|
|
|
440
|
-
// Attach the static request-dependency map from the request-dep
|
|
441
|
-
// plugin, computed in the RSC `buildEnd` hook. The RSC environment is
|
|
442
|
-
// built before the client one, so the field is populated by now.
|
|
443
|
-
//
|
|
444
|
-
// Absent means the RSC `buildEnd` never ran — a broken plugin pipeline,
|
|
445
|
-
// not an app without segments, which produces `{}`. Serializing that as
|
|
446
|
-
// an empty map is indistinguishable at runtime from an analysis that
|
|
447
|
-
// found nothing (`server/request-dep.ts` answers `true` for any absent
|
|
448
|
-
// key either way), so every segment and slot silently stops being a
|
|
449
|
-
// skip candidate and slot caching is off with nothing to show for it.
|
|
450
|
-
// Fail the build instead (TIM-1300).
|
|
451
|
-
if (ctx.requestDepMap === undefined) {
|
|
452
|
-
throw new Error(
|
|
453
|
-
'[timber] Build manifest: the request-dependency map was never computed. ' +
|
|
454
|
-
"The RSC environment's buildEnd hook did not run before the client build, " +
|
|
455
|
-
'so no segment or slot could be skipped on client navigation. This is a ' +
|
|
456
|
-
'plugin pipeline bug — timber-request-dep must run in the rsc environment.'
|
|
457
|
-
);
|
|
458
|
-
}
|
|
459
|
-
ctx.buildManifest.requestDep = ctx.requestDepMap;
|
|
460
|
-
|
|
461
440
|
// When client JavaScript is disabled, strip JS chunks from the bundle
|
|
462
441
|
// so Rollup never writes them to disk. CSS assets are preserved —
|
|
463
442
|
// they're still needed for server-rendered HTML. The JS references
|
package/src/routing/scanner.ts
CHANGED
|
@@ -366,6 +366,18 @@ function scanChildren(dirPath: string, parentNode: SegmentNode, extSet: Set<stri
|
|
|
366
366
|
`Rename the directory to remove the encoded delimiter.`
|
|
367
367
|
);
|
|
368
368
|
}
|
|
369
|
+
// `@children` is the implicit slot a layout's `children` prop fills, and
|
|
370
|
+
// the key of the outlet that carries it (`childrenOutletKey`). A slot
|
|
371
|
+
// directory by that name would claim the same outlet and be rendered in
|
|
372
|
+
// place of the children (design/52-segment-hash-dedupe.md).
|
|
373
|
+
if (entry === '@children') {
|
|
374
|
+
throw new Error(
|
|
375
|
+
`Build error: "@children" is reserved and cannot be a slot directory.\n` +
|
|
376
|
+
` Directory: ${fullPath}\n` +
|
|
377
|
+
`A layout's children fill the implicit children slot. Put this content in the ` +
|
|
378
|
+
`parent segment's page, or give the slot another name.`
|
|
379
|
+
);
|
|
380
|
+
}
|
|
369
381
|
if (NULL_BYTE_RE.test(entry)) {
|
|
370
382
|
throw new Error(
|
|
371
383
|
`Build error: directory name contains an encoded null byte (%00).\n` +
|
|
@@ -23,8 +23,6 @@
|
|
|
23
23
|
* URL path and the segment classification, never on file payloads.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import type { CoercedParams } from '../shared/param-value.ts';
|
|
27
|
-
|
|
28
26
|
export interface SegmentKeyInput {
|
|
29
27
|
urlPath: string;
|
|
30
28
|
segmentName?: string;
|
|
@@ -149,38 +147,14 @@ export function computeSlotKey(parentSegmentId: string, slotName: string): strin
|
|
|
149
147
|
}
|
|
150
148
|
|
|
151
149
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
* the slot's own extracted params.
|
|
160
|
-
*
|
|
161
|
-
* The slot key prevents cross-group collisions: two route groups at the
|
|
162
|
-
* same URL level each owning a `@sidebar` slot produce different keys
|
|
163
|
-
* even when both fall back to `default.tsx`.
|
|
164
|
-
*
|
|
165
|
-
* The key is opaque to the client — it stores whatever the server sent
|
|
166
|
-
* and advertises it back. The server computes the destination key and
|
|
167
|
-
* checks membership. This eliminates the need for the server to
|
|
168
|
-
* reconstruct the client's state from a departing URL.
|
|
169
|
-
*
|
|
170
|
-
* See design/07-routing.md §"Segment Tree Diffing on Navigation"
|
|
150
|
+
* The outlet key of a layout's `children`. A layout's own outlet covers its
|
|
151
|
+
* chrome; everything it receives as `children` — this segment's boundaries
|
|
152
|
+
* and metadata collectors, the next segment's access gate, the page — is a
|
|
153
|
+
* separate outlet, so an unchanged layout
|
|
154
|
+
* dedupes while what is under it changes. Keyed as the implicit `children`
|
|
155
|
+
* slot; the route scanner rejects an `@children` directory.
|
|
156
|
+
* See design/52-segment-hash-dedupe.md §"The unit is the segment's own output".
|
|
171
157
|
*/
|
|
172
|
-
export function
|
|
173
|
-
|
|
174
|
-
ownerParts: string[],
|
|
175
|
-
entryFile: string | null,
|
|
176
|
-
slotParams: CoercedParams
|
|
177
|
-
): string {
|
|
178
|
-
const owner = ownerParts.join('/');
|
|
179
|
-
const entry = entryFile ?? '\x01';
|
|
180
|
-
const paramKeys = Object.keys(slotParams).sort();
|
|
181
|
-
const paramParts = paramKeys.map((k) => {
|
|
182
|
-
const v = slotParams[k];
|
|
183
|
-
return Array.isArray(v) ? `${k}=${v.map(String).join('\x02')}` : `${k}=${String(v)}`;
|
|
184
|
-
});
|
|
185
|
-
return [slotKey, owner, entry, ...paramParts].join('\0');
|
|
158
|
+
export function childrenOutletKey(segmentId: string): string {
|
|
159
|
+
return computeSlotKey(segmentId, '@children');
|
|
186
160
|
}
|
|
@@ -70,6 +70,14 @@ declare module '@vitejs/plugin-rsc/vendor/react-server-dom/server.edge' {
|
|
|
70
70
|
id: string,
|
|
71
71
|
exportName: string | null
|
|
72
72
|
): T;
|
|
73
|
+
|
|
74
|
+
// Tests render real client references (segment-hash tests) the way the
|
|
75
|
+
// use-client transform registers them.
|
|
76
|
+
export function registerClientReference<T>(
|
|
77
|
+
proxyImplementation: T,
|
|
78
|
+
id: string,
|
|
79
|
+
exportName: string
|
|
80
|
+
): T & { $$id: string };
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
// src decodes through plugin-rsc's wrappers; tests decode a Flight response
|
|
@@ -68,17 +68,8 @@ export interface AccessGateProps {
|
|
|
68
68
|
* AccessGate renders the matching deny page in-tree instead of throwing.
|
|
69
69
|
* This prevents the error from reaching React Flight, eliminating the
|
|
70
70
|
* second render pass. See TIM-666.
|
|
71
|
-
*
|
|
72
|
-
* Omitted for skipped segments — a deny there must hard-navigate to
|
|
73
|
-
* avoid rendering the deny page inside cached layout chrome (TIM-1074).
|
|
74
71
|
*/
|
|
75
72
|
denyPages?: DenyPageEntry[];
|
|
76
|
-
/**
|
|
77
|
-
* When true, this gate wraps a skipped segment. On deny, the gate
|
|
78
|
-
* records the deny in ALS and rethrows so the response path can
|
|
79
|
-
* return rscErrorEnvelope for a client hard-navigate.
|
|
80
|
-
*/
|
|
81
|
-
skippedSegment?: boolean;
|
|
82
73
|
/**
|
|
83
74
|
* When true, this gate guards a segment of the URL's own route that is not
|
|
84
75
|
* in the rendered tree — an intercepted navigation renders one for each
|
|
@@ -133,33 +124,19 @@ export interface SlotAccessGateProps {
|
|
|
133
124
|
* because the gate also sits inside every layout above it and rendering
|
|
134
125
|
* here would wrap the deny page in all of them (TIM-1356).
|
|
135
126
|
*
|
|
136
|
-
* For skipped segments (skippedSegment=true), deny pages are NOT rendered
|
|
137
|
-
* in-tree — the client's cached layout chrome would wrap them incorrectly.
|
|
138
|
-
* Instead, the deny is recorded in ALS and rethrown so the response path
|
|
139
|
-
* can return rscErrorEnvelope for a client hard-navigate.
|
|
140
|
-
*
|
|
141
127
|
* For a segment outside the rendered tree (outsideTree=true), see
|
|
142
128
|
* `DenySignal._leaveSpa`.
|
|
143
129
|
*/
|
|
144
130
|
export function AccessGate(props: AccessGateProps): Promise<ReactNode> {
|
|
145
|
-
const {
|
|
146
|
-
|
|
147
|
-
segmentName,
|
|
148
|
-
segmentKey,
|
|
149
|
-
segmentIndex,
|
|
150
|
-
denyPages,
|
|
151
|
-
skippedSegment,
|
|
152
|
-
outsideTree,
|
|
153
|
-
children,
|
|
154
|
-
} = props;
|
|
131
|
+
const { accessFn, segmentName, segmentKey, segmentIndex, denyPages, outsideTree, children } =
|
|
132
|
+
props;
|
|
155
133
|
|
|
156
134
|
return accessGateFallback(
|
|
157
135
|
accessFn,
|
|
158
136
|
segmentName,
|
|
159
137
|
segmentKey,
|
|
160
138
|
segmentIndex,
|
|
161
|
-
|
|
162
|
-
skippedSegment,
|
|
139
|
+
denyPages,
|
|
163
140
|
outsideTree,
|
|
164
141
|
children
|
|
165
142
|
);
|
|
@@ -175,7 +152,6 @@ async function accessGateFallback(
|
|
|
175
152
|
segmentKey: AccessGateProps['segmentKey'],
|
|
176
153
|
segmentIndex: AccessGateProps['segmentIndex'],
|
|
177
154
|
denyPages: DenyPageEntry[] | undefined,
|
|
178
|
-
skippedSegment: boolean | undefined,
|
|
179
155
|
outsideTree: boolean | undefined,
|
|
180
156
|
children: ReactNode
|
|
181
157
|
): Promise<ReactNode> {
|
|
@@ -193,11 +169,6 @@ async function accessGateFallback(
|
|
|
193
169
|
throw error;
|
|
194
170
|
}
|
|
195
171
|
|
|
196
|
-
if (skippedSegment) {
|
|
197
|
-
error._hardNavigate = true;
|
|
198
|
-
throw error;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
172
|
if (denyPages) {
|
|
202
173
|
return handleCaughtDeny(denyPages, error, segmentKey);
|
|
203
174
|
}
|
|
@@ -339,3 +339,26 @@ export interface PrebuiltCaptureStore {
|
|
|
339
339
|
export const prebuiltCaptureAls = getOrCreateAls<PrebuiltCaptureStore>(
|
|
340
340
|
Symbol.for('timber:prebuilt-capture-als')
|
|
341
341
|
);
|
|
342
|
+
|
|
343
|
+
// ─── Segment Hash Capture ─────────────────────────────────────────────────
|
|
344
|
+
// Used by: segment-hash/capture.ts, segment-hash/outlet.ts
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* One in-flight segment-hash capture render (design/52 §"Capture"). The
|
|
348
|
+
* outlet gate renders a nested segment as a bare hole there — its content
|
|
349
|
+
* belongs to its own hash.
|
|
350
|
+
*
|
|
351
|
+
* @internal — import via segment-hash/capture.ts
|
|
352
|
+
*/
|
|
353
|
+
export interface SegmentCaptureStore {
|
|
354
|
+
/**
|
|
355
|
+
* A nested outlet rendered here, as a hole: the opaque marker it carries in
|
|
356
|
+
* place of its decision (a Flight temporary reference).
|
|
357
|
+
*/
|
|
358
|
+
hole(segmentPath: string): import('../shared/outlet-decision.ts').CaptureHole;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/** @internal — import via segment-hash/capture.ts */
|
|
362
|
+
export const segmentCaptureAls = getOrCreateAls<SegmentCaptureStore>(
|
|
363
|
+
Symbol.for('timber:segment-capture-als')
|
|
364
|
+
);
|
|
@@ -41,12 +41,6 @@ export interface BuildManifest {
|
|
|
41
41
|
* In dev mode this is empty — a startup nonce is used instead.
|
|
42
42
|
*/
|
|
43
43
|
metadataRouteHashes?: Record<string, string>;
|
|
44
|
-
/**
|
|
45
|
-
* Static request-dependency map from the Vite plugin's module-graph analysis.
|
|
46
|
-
* Map from segment entry file path to whether it's request-dependent.
|
|
47
|
-
* Used by buildSegmentInfo() for X-Timber-Segments in production.
|
|
48
|
-
*/
|
|
49
|
-
requestDep?: Record<string, boolean>;
|
|
50
44
|
}
|
|
51
45
|
|
|
52
46
|
/**
|
|
@@ -56,10 +50,7 @@ export interface BuildManifest {
|
|
|
56
50
|
* `virtual:timber-build-manifest` serializes this constant into its generated
|
|
57
51
|
* source rather than restating it — one literal for the dev module, one for the
|
|
58
52
|
* production module's `globalThis.__TIMBER_BUILD_MANIFEST__ ?? …` fallback.
|
|
59
|
-
* They were three hand-written objects that had already drifted
|
|
60
|
-
* the dev literal were missing `requestDep` while the production fallback had
|
|
61
|
-
* it, so a reader who grepped the built bundle for `requestDep` found the one
|
|
62
|
-
* copy that mentioned it and read the fallback as the shipped map (TIM-1300).
|
|
53
|
+
* They were three hand-written objects that had already drifted (TIM-1300).
|
|
63
54
|
* A field added here now reaches every copy.
|
|
64
55
|
*/
|
|
65
56
|
export const EMPTY_BUILD_MANIFEST: BuildManifest = {
|
|
@@ -68,7 +59,6 @@ export const EMPTY_BUILD_MANIFEST: BuildManifest = {
|
|
|
68
59
|
modulepreload: {},
|
|
69
60
|
fonts: {},
|
|
70
61
|
metadataRouteHashes: {},
|
|
71
|
-
requestDep: {},
|
|
72
62
|
};
|
|
73
63
|
|
|
74
64
|
/** Segment shape expected by collectRouteCss (matches ManifestSegmentNode). */
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
* How much of the URL a matched segment chain has consumed.
|
|
3
3
|
*
|
|
4
4
|
* One question — "which URL parts had been consumed by the time segment `i`
|
|
5
|
-
* rendered?" — asked by
|
|
5
|
+
* rendered?" — asked by everything that must agree about it:
|
|
6
6
|
*
|
|
7
7
|
* - the layout depth handed to `SegmentProvider` (`route-element-builder.ts`),
|
|
8
8
|
* which `useSelectedLayoutSegment(s)` indexes the live pathname with;
|
|
9
|
-
* -
|
|
10
|
-
* - `resolveSlotProps` and `skippable-prefix.ts`, which derive content keys
|
|
11
|
-
* for slot skip decisions (TIM-1370).
|
|
9
|
+
* - slot matching, which slices the destination pathname at the owner.
|
|
12
10
|
*
|
|
13
11
|
* They were four separate `extractUrlParts(...).length` calls. That was fine
|
|
14
12
|
* while the answer was a plain walk, and stopped being fine when interception
|
|
@@ -35,7 +33,7 @@ import { computeInterceptedBase } from '../routing/interception.ts';
|
|
|
35
33
|
*
|
|
36
34
|
* The root segment is named '' and consumes nothing, so it is skipped here
|
|
37
35
|
* rather than by each caller — callers that pass a chain including the root
|
|
38
|
-
* (interception anchoring, slot
|
|
36
|
+
* (interception anchoring, slot matching) would otherwise have to remember
|
|
39
37
|
* to filter it, and one that forgot would push an empty part and shift every
|
|
40
38
|
* subsequent index by one.
|
|
41
39
|
*
|
|
@@ -145,19 +143,3 @@ export function consumedUrlParts(
|
|
|
145
143
|
// At or below it: the intercepting subtree's parts ARE the target's.
|
|
146
144
|
return [...targetPrefix, ...partsThrough(interception.index, index)];
|
|
147
145
|
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* The index in `match.segments` of a segment, or -1.
|
|
151
|
-
*
|
|
152
|
-
* Split out so the three slot call sites and the layout-depth one derive their
|
|
153
|
-
* slice point identically — `indexOf` plus `consumedUrlParts` — instead of
|
|
154
|
-
* each inlining the pair.
|
|
155
|
-
*/
|
|
156
|
-
export function consumedPartsThroughSegment(
|
|
157
|
-
segment: ManifestSegmentNode,
|
|
158
|
-
match: RouteMatch
|
|
159
|
-
): string[] {
|
|
160
|
-
const index = match.segments.indexOf(segment);
|
|
161
|
-
if (index < 0) return [];
|
|
162
|
-
return consumedUrlParts(match.segments as ManifestSegmentNode[], index, match);
|
|
163
|
-
}
|