@timber-js/app 0.2.0-alpha.241 → 0.2.0-alpha.243
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-BCYVyoFl.js → actions-DoTj0Jd3.js} +78 -32
- package/dist/_chunks/actions-DoTj0Jd3.js.map +1 -0
- package/dist/_chunks/{als-registry-fabsRnPY.js → als-registry-C-iwbtvI.js} +1 -2
- package/dist/_chunks/{als-registry-fabsRnPY.js.map → als-registry-C-iwbtvI.js.map} +1 -1
- package/dist/_chunks/{cache-api-n5FL4wFs.js → cache-api-D3HmgsFh.js} +5 -5
- package/dist/_chunks/{cache-api-n5FL4wFs.js.map → cache-api-D3HmgsFh.js.map} +1 -1
- package/dist/_chunks/{chains-IswOWMnq.js → chains-BpvDwp08.js} +2 -2
- package/dist/_chunks/{chains-IswOWMnq.js.map → chains-BpvDwp08.js.map} +1 -1
- package/dist/_chunks/chains-CjlZZ5ad.js +1 -0
- package/dist/_chunks/{classify-B08RCF6s.js → classify-Bbb_lKjH.js} +2 -2
- package/dist/_chunks/{classify-B08RCF6s.js.map → classify-Bbb_lKjH.js.map} +1 -1
- package/dist/_chunks/{cli-check-tpFb6pBU.js → cli-check-DlQBSKIN.js} +3 -3
- package/dist/_chunks/{cli-check-tpFb6pBU.js.map → cli-check-DlQBSKIN.js.map} +1 -1
- package/dist/_chunks/{cli-schema-sync-DRNJutey.js → cli-schema-sync-CWkGFlYu.js} +2 -2
- package/dist/_chunks/{cli-schema-sync-DRNJutey.js.map → cli-schema-sync-CWkGFlYu.js.map} +1 -1
- package/dist/_chunks/{cli-schema-sync-C0pXBtzG.js → cli-schema-sync-Dyvdkv_I.js} +1 -1
- package/dist/_chunks/{client-dep-entries-Dw5Dvatr.js → client-dep-entries-Dka67elj.js} +2 -2
- package/dist/_chunks/{client-dep-entries-Dw5Dvatr.js.map → client-dep-entries-Dka67elj.js.map} +1 -1
- package/dist/_chunks/{convention-lint-BfC_dAhZ.js → convention-lint-CGGcseNn.js} +19 -5
- package/dist/_chunks/convention-lint-CGGcseNn.js.map +1 -0
- package/dist/_chunks/dev-server-DrjLscqT.js +1 -0
- package/dist/_chunks/{dev-server-3R6Bl9_R.js → dev-server-LO4McfQi.js} +3 -4
- package/dist/_chunks/dev-server-LO4McfQi.js.map +1 -0
- package/dist/_chunks/{error-boundary-Dfhxigko.js → error-boundary-wuNvAJ4n.js} +8 -15
- package/dist/_chunks/error-boundary-wuNvAJ4n.js.map +1 -0
- package/dist/_chunks/{flight-source-node-QOpWZATb.js → flight-source-node-BeF00Wo_.js} +4 -7
- package/dist/_chunks/flight-source-node-BeF00Wo_.js.map +1 -0
- package/dist/_chunks/{interception-CtNt9jPt.js → interception-D1dCGNmQ.js} +6 -6
- package/dist/_chunks/{interception-CtNt9jPt.js.map → interception-D1dCGNmQ.js.map} +1 -1
- package/dist/_chunks/{json-lossy-check-5KFcC1yt.js → json-lossy-check-DpXneTBm.js} +2 -2
- package/dist/_chunks/{json-lossy-check-5KFcC1yt.js.map → json-lossy-check-DpXneTBm.js.map} +1 -1
- package/dist/_chunks/key-headers-uIig1_mU.js +40 -0
- package/dist/_chunks/key-headers-uIig1_mU.js.map +1 -0
- package/dist/_chunks/{live-graph-D1dfVqoT.js → live-graph-DXhz6A_X.js} +4 -4
- package/dist/_chunks/{live-graph-D1dfVqoT.js.map → live-graph-DXhz6A_X.js.map} +1 -1
- package/dist/_chunks/{logger-BvGxPd1e.js → logger-D1sWX2I0.js} +18 -3
- package/dist/_chunks/logger-D1sWX2I0.js.map +1 -0
- package/dist/_chunks/metadata-routes-MXNjWOt5.js.map +1 -1
- package/dist/_chunks/{node-response-D5cfiyWP.js → node-response-Cp62CtH1.js} +2 -2
- package/dist/_chunks/{node-response-D5cfiyWP.js.map → node-response-Cp62CtH1.js.map} +1 -1
- package/dist/_chunks/{poison-scan-CX02ilxN.js → poison-scan-DdkJoHvP.js} +2 -2
- package/dist/_chunks/{poison-scan-CX02ilxN.js.map → poison-scan-DdkJoHvP.js.map} +1 -1
- package/dist/_chunks/{scanner-DneYxQoY.js → scanner-B6V2RqqF.js} +20 -3
- package/dist/_chunks/scanner-B6V2RqqF.js.map +1 -0
- package/dist/_chunks/{sizeof-BtQ3ErLf.js → sizeof-BKA6qOZq.js} +2 -2
- package/dist/_chunks/{sizeof-BtQ3ErLf.js.map → sizeof-BKA6qOZq.js.map} +1 -1
- package/dist/_chunks/{walkers-C9R2A4jN.js → walkers-BAZoAlfI.js} +3 -3
- package/dist/_chunks/{walkers-C9R2A4jN.js.map → walkers-BAZoAlfI.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/router-init.d.ts +0 -1
- package/dist/client/browser-entry/router-init.d.ts.map +1 -1
- package/dist/client/document-withdrawal.d.ts +2 -0
- package/dist/client/document-withdrawal.d.ts.map +1 -0
- package/dist/client/error-boundary.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.js +3 -5
- package/dist/client/internal.js.map +1 -1
- package/dist/client/navigation-commit.d.ts +0 -7
- package/dist/client/navigation-commit.d.ts.map +1 -1
- package/dist/client/outlet-content-cache.d.ts +28 -42
- package/dist/client/outlet-content-cache.d.ts.map +1 -1
- package/dist/client/outlet-scope-context.d.ts +9 -4
- package/dist/client/outlet-scope-context.d.ts.map +1 -1
- package/dist/client/params-context.d.ts +1 -1
- package/dist/client/router-types.d.ts +3 -13
- package/dist/client/router-types.d.ts.map +1 -1
- package/dist/client/router.d.ts.map +1 -1
- package/dist/client/segment-cache.d.ts +2 -2
- package/dist/client/segment-outlet.d.ts +12 -15
- package/dist/client/segment-outlet.d.ts.map +1 -1
- package/dist/client/stale-segment.d.ts +2 -2
- package/dist/config-types.d.ts +2 -18
- package/dist/config-types.d.ts.map +1 -1
- package/dist/config-validation.d.ts.map +1 -1
- package/dist/index.js +7 -8
- package/dist/index.js.map +1 -1
- package/dist/native/rsc/manifest.json +3 -4
- package/dist/native/rsc/routing/segment-keys.js.map +1 -1
- package/dist/native/rsc/server/als-registry.js +1 -2
- package/dist/native/rsc/server/als-registry.js.map +1 -1
- package/dist/native/rsc/server/client-state-tree.js +1 -5
- package/dist/native/rsc/server/client-state-tree.js.map +1 -1
- package/dist/native/rsc/server/cookie-context.js +7 -7
- package/dist/native/rsc/server/cookie-context.js.map +1 -1
- package/dist/native/rsc/server/deny-boundary.js +2 -1
- package/dist/native/rsc/server/deny-boundary.js.map +1 -1
- package/dist/native/rsc/server/dev-overlay-report.js +13 -0
- package/dist/native/rsc/server/dev-overlay-report.js.map +1 -0
- package/dist/native/rsc/server/flight-source-node.js +2 -5
- package/dist/native/rsc/server/flight-source-node.js.map +1 -1
- package/dist/native/rsc/server/flight-source.js +6 -41
- package/dist/native/rsc/server/flight-source.js.map +1 -1
- package/dist/native/rsc/server/framework-stack-frames.js.map +1 -1
- package/dist/native/rsc/server/logger.js +6 -1
- package/dist/native/rsc/server/logger.js.map +1 -1
- package/dist/native/rsc/server/pipeline-interception.js +4 -1
- package/dist/native/rsc/server/pipeline-interception.js.map +1 -1
- package/dist/native/rsc/server/pipeline.js.map +1 -1
- package/dist/native/rsc/server/request-context.js +6 -6
- package/dist/native/rsc/server/request-context.js.map +1 -1
- package/dist/native/rsc/server/route-element-builder.js +5 -5
- package/dist/native/rsc/server/route-element-builder.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/render-route.js +4 -30
- package/dist/native/rsc/server/rsc-entry/render-route.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js +0 -2
- package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/rsc-stream.js +2 -5
- package/dist/native/rsc/server/rsc-entry/rsc-stream.js.map +1 -1
- package/dist/native/rsc/server/segment-lifetime/outlet-gate.js +44 -0
- package/dist/native/rsc/server/segment-lifetime/outlet-gate.js.map +1 -0
- package/dist/native/rsc/server/segment-lifetime/read-rule.js +45 -12
- package/dist/native/rsc/server/segment-lifetime/read-rule.js.map +1 -1
- package/dist/native/rsc/server/segment-lifetime/read-scope.js +50 -8
- package/dist/native/rsc/server/segment-lifetime/read-scope.js.map +1 -1
- package/dist/native/rsc/server/segment-lifetime/segment-key.js +17 -3
- package/dist/native/rsc/server/segment-lifetime/segment-key.js.map +1 -1
- package/dist/native/rsc/server/segment-lifetime/slot-outlets.js +4 -4
- package/dist/native/rsc/server/segment-lifetime/slot-outlets.js.map +1 -1
- package/dist/native/rsc/server/slot-resolver.js +8 -7
- package/dist/native/rsc/server/slot-resolver.js.map +1 -1
- package/dist/native/rsc/server/slot-subtree-contain.js +2 -1
- package/dist/native/rsc/server/slot-subtree-contain.js.map +1 -1
- package/dist/native/rsc/server/subtree-walk.js +14 -5
- package/dist/native/rsc/server/subtree-walk.js.map +1 -1
- package/dist/native/rsc/server/vite-handoff-rsc.js.map +1 -1
- package/dist/native/rsc/shared/key-headers.js +20 -0
- package/dist/native/rsc/shared/key-headers.js.map +1 -0
- package/dist/native/rsc/shared/outlet-decision.js.map +1 -1
- package/dist/native/ssr/client/document-withdrawal.js +17 -0
- package/dist/native/ssr/client/document-withdrawal.js.map +1 -0
- package/dist/native/ssr/client/outlet-content-cache.js +10 -25
- package/dist/native/ssr/client/outlet-content-cache.js.map +1 -1
- package/dist/native/ssr/client/outlet-scope-context.js.map +1 -1
- package/dist/native/ssr/client/segment-outlet.js +17 -21
- package/dist/native/ssr/client/segment-outlet.js.map +1 -1
- package/dist/native/ssr/manifest.json +6 -1
- package/dist/native/ssr/server/als-registry.js +0 -1
- package/dist/native/ssr/server/als-registry.js.map +1 -1
- package/dist/native/ssr/server/client-state-tree.js +1 -5
- package/dist/native/ssr/server/client-state-tree.js.map +1 -1
- package/dist/native/ssr/server/cookie-context.js +7 -7
- package/dist/native/ssr/server/cookie-context.js.map +1 -1
- package/dist/native/ssr/server/deny-boundary.js +2 -1
- package/dist/native/ssr/server/deny-boundary.js.map +1 -1
- package/dist/native/ssr/server/dev-overlay-report.js +6 -0
- package/dist/native/ssr/server/dev-overlay-report.js.map +1 -0
- package/dist/native/ssr/server/flight-source-node.js +2 -5
- package/dist/native/ssr/server/flight-source-node.js.map +1 -1
- package/dist/native/ssr/server/flight-source.js +0 -1
- package/dist/native/ssr/server/flight-source.js.map +1 -1
- package/dist/native/ssr/server/framework-stack-frames.js.map +1 -1
- package/dist/native/ssr/server/logger.js +6 -1
- package/dist/native/ssr/server/logger.js.map +1 -1
- package/dist/native/ssr/server/pipeline-interception.js +4 -1
- package/dist/native/ssr/server/pipeline-interception.js.map +1 -1
- package/dist/native/ssr/server/pipeline.js.map +1 -1
- package/dist/native/ssr/server/request-context.js +6 -6
- package/dist/native/ssr/server/request-context.js.map +1 -1
- package/dist/native/ssr/server/segment-lifetime/outlet-gate.js +11 -0
- package/dist/native/ssr/server/segment-lifetime/outlet-gate.js.map +1 -0
- package/dist/native/ssr/server/segment-lifetime/read-rule.js +45 -12
- package/dist/native/ssr/server/segment-lifetime/read-rule.js.map +1 -1
- package/dist/native/ssr/server/segment-lifetime/read-scope.js +16 -0
- package/dist/native/ssr/server/segment-lifetime/read-scope.js.map +1 -0
- package/dist/native/ssr/server/subtree-walk.js +149 -0
- package/dist/native/ssr/server/subtree-walk.js.map +1 -0
- package/dist/native/ssr/server/utils/element-type.js +21 -9
- package/dist/native/ssr/server/utils/element-type.js.map +1 -1
- package/dist/native/ssr/server/vite-handoff-rsc.js.map +1 -1
- package/dist/native/ssr/shared/key-headers.js +13 -0
- package/dist/native/ssr/shared/key-headers.js.map +1 -0
- package/dist/plugins/entries.d.ts.map +1 -1
- package/dist/routing/index.js +3 -3
- package/dist/routing/route-options.d.ts.map +1 -1
- package/dist/routing/segment-keys.d.ts +3 -4
- package/dist/routing/segment-keys.d.ts.map +1 -1
- package/dist/routing/slot-placement.d.ts +23 -4
- package/dist/routing/slot-placement.d.ts.map +1 -1
- package/dist/server/als-registry.d.ts +20 -16
- package/dist/server/als-registry.d.ts.map +1 -1
- package/dist/server/client-state-tree.d.ts +5 -11
- package/dist/server/client-state-tree.d.ts.map +1 -1
- package/dist/server/deny-boundary.d.ts.map +1 -1
- package/dist/server/dev-overlay-report.d.ts +13 -0
- package/dist/server/dev-overlay-report.d.ts.map +1 -0
- package/dist/server/flight-source-node.d.ts +1 -6
- package/dist/server/flight-source-node.d.ts.map +1 -1
- package/dist/server/flight-source.d.ts +0 -27
- package/dist/server/flight-source.d.ts.map +1 -1
- package/dist/server/framework-stack-frames.d.ts +1 -4
- package/dist/server/framework-stack-frames.d.ts.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/internal.js +105 -26
- package/dist/server/internal.js.map +1 -1
- package/dist/server/logger.d.ts +10 -0
- package/dist/server/logger.d.ts.map +1 -1
- package/dist/server/pipeline-interception.d.ts.map +1 -1
- package/dist/server/pipeline.d.ts +13 -1
- package/dist/server/pipeline.d.ts.map +1 -1
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/route-element-builder.d.ts +2 -2
- package/dist/server/route-element-builder.d.ts.map +1 -1
- package/dist/server/rsc-entry/helpers.d.ts +1 -1
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/render-route.d.ts +0 -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-stream.d.ts +2 -11
- package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
- package/dist/server/segment-lifetime/outlet-gate.d.ts +58 -0
- package/dist/server/segment-lifetime/outlet-gate.d.ts.map +1 -0
- package/dist/server/segment-lifetime/read-rule.d.ts +19 -13
- package/dist/server/segment-lifetime/read-rule.d.ts.map +1 -1
- package/dist/server/segment-lifetime/read-scope.d.ts +48 -6
- package/dist/server/segment-lifetime/read-scope.d.ts.map +1 -1
- package/dist/server/segment-lifetime/segment-key.d.ts +3 -0
- package/dist/server/segment-lifetime/segment-key.d.ts.map +1 -1
- package/dist/server/segment-lifetime/slot-outlets.d.ts +3 -3
- package/dist/server/segment-lifetime/slot-outlets.d.ts.map +1 -1
- package/dist/server/slot-resolver.d.ts +5 -5
- package/dist/server/slot-resolver.d.ts.map +1 -1
- package/dist/server/slot-subtree-contain.d.ts.map +1 -1
- package/dist/server/subtree-walk.d.ts +17 -3
- package/dist/server/subtree-walk.d.ts.map +1 -1
- package/dist/server/types.d.ts +8 -2
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/vite-handoff-rsc.d.ts +3 -10
- package/dist/server/vite-handoff-rsc.d.ts.map +1 -1
- package/dist/shared/key-headers.d.ts +13 -0
- package/dist/shared/key-headers.d.ts.map +1 -0
- package/dist/shared/outlet-decision.d.ts +13 -44
- package/dist/shared/outlet-decision.d.ts.map +1 -1
- package/dist/shared/payload-root.d.ts +1 -1
- package/dist/shared/segment-info.d.ts +3 -7
- package/dist/shared/segment-info.d.ts.map +1 -1
- package/docs/api/30-api-server.mdx +1 -1
- package/docs/api/34-api-config.mdx +1 -1
- package/package.json +1 -1
- package/src/client/browser-entry/index.ts +0 -2
- package/src/client/browser-entry/router-init.ts +2 -4
- package/src/client/document-withdrawal.tsx +41 -0
- package/src/client/error-boundary.tsx +1 -1
- package/src/client/navigation-commit.ts +4 -18
- package/src/client/outlet-content-cache.ts +38 -60
- package/src/client/outlet-scope-context.ts +10 -5
- package/src/client/params-context.ts +1 -1
- package/src/client/router-types.ts +3 -14
- package/src/client/router.ts +0 -2
- package/src/client/rsc-fetch.ts +1 -1
- package/src/client/segment-cache.ts +2 -2
- package/src/client/segment-outlet.tsx +28 -54
- package/src/client/stale-segment.ts +2 -2
- package/src/config-types.ts +2 -18
- package/src/config-validation.ts +0 -1
- package/src/plugins/entries.ts +0 -1
- package/src/routing/interception.ts +5 -5
- package/src/routing/route-options.ts +20 -4
- package/src/routing/scanner.ts +1 -1
- package/src/routing/segment-keys.ts +3 -4
- package/src/routing/slot-placement.ts +41 -4
- package/src/rsc-runtime/vendor-types.d.ts +1 -1
- package/src/server/als-registry.ts +16 -23
- package/src/server/client-state-tree.ts +7 -18
- package/src/server/cookie-context.ts +7 -7
- package/src/server/deny-boundary.ts +4 -1
- package/src/server/dev-overlay-report.ts +22 -0
- package/src/server/flight-source-node.ts +1 -5
- package/src/server/flight-source.ts +1 -81
- package/src/server/framework-stack-frames.ts +1 -4
- package/src/server/logger.ts +13 -0
- package/src/server/pipeline-interception.ts +11 -2
- package/src/server/pipeline.ts +13 -1
- package/src/server/request-context.ts +12 -11
- package/src/server/route-element-builder.ts +15 -16
- package/src/server/rsc-entry/helpers.ts +1 -1
- package/src/server/rsc-entry/index.ts +7 -3
- package/src/server/rsc-entry/render-route.ts +7 -54
- package/src/server/rsc-entry/revalidate-renderer.ts +0 -2
- package/src/server/rsc-entry/rsc-stream.ts +3 -23
- package/src/server/segment-lifetime/outlet-gate.ts +102 -0
- package/src/server/segment-lifetime/read-rule.ts +110 -22
- package/src/server/segment-lifetime/read-scope.ts +131 -15
- package/src/server/segment-lifetime/segment-key.ts +31 -3
- package/src/server/segment-lifetime/slot-outlets.ts +6 -6
- package/src/server/slot-resolver.ts +30 -18
- package/src/server/slot-subtree-contain.ts +2 -1
- package/src/server/subtree-walk.ts +34 -9
- package/src/server/types.ts +8 -2
- package/src/server/vite-handoff-rsc.ts +3 -12
- package/src/shared/key-headers.ts +42 -0
- package/src/shared/outlet-decision.ts +13 -48
- package/src/shared/payload-root.ts +1 -1
- package/src/shared/segment-info.ts +3 -7
- package/dist/_chunks/actions-BCYVyoFl.js.map +0 -1
- package/dist/_chunks/chains-DPZAMMav.js +0 -1
- package/dist/_chunks/convention-lint-BfC_dAhZ.js.map +0 -1
- package/dist/_chunks/dev-server-3DNTXQV-.js +0 -1
- package/dist/_chunks/dev-server-3R6Bl9_R.js.map +0 -1
- package/dist/_chunks/error-boundary-Dfhxigko.js.map +0 -1
- package/dist/_chunks/flight-source-node-QOpWZATb.js.map +0 -1
- package/dist/_chunks/logger-BvGxPd1e.js.map +0 -1
- package/dist/_chunks/scanner-DneYxQoY.js.map +0 -1
- package/dist/native/rsc/server/segment-hash/capture.js +0 -107
- package/dist/native/rsc/server/segment-hash/capture.js.map +0 -1
- package/dist/native/rsc/server/segment-hash/outlet.js +0 -101
- package/dist/native/rsc/server/segment-hash/outlet.js.map +0 -1
- package/dist/native/rsc/server/segment-hash/stream-tap.js +0 -139
- package/dist/native/rsc/server/segment-hash/stream-tap.js.map +0 -1
- package/dist/native/rsc/server/segment-hash/value-hash.js +0 -171
- package/dist/native/rsc/server/segment-hash/value-hash.js.map +0 -1
- package/dist/native/ssr/server/segment-hash/value-hash.js +0 -162
- package/dist/native/ssr/server/segment-hash/value-hash.js.map +0 -1
- package/dist/server/segment-hash/capture.d.ts +0 -77
- package/dist/server/segment-hash/capture.d.ts.map +0 -1
- package/dist/server/segment-hash/outlet.d.ts +0 -93
- package/dist/server/segment-hash/outlet.d.ts.map +0 -1
- package/dist/server/segment-hash/stream-tap.d.ts +0 -49
- package/dist/server/segment-hash/stream-tap.d.ts.map +0 -1
- package/dist/server/segment-hash/value-hash.d.ts +0 -70
- package/dist/server/segment-hash/value-hash.d.ts.map +0 -1
- package/src/server/segment-hash/capture.ts +0 -232
- package/src/server/segment-hash/outlet.ts +0 -229
- package/src/server/segment-hash/stream-tap.ts +0 -244
- package/src/server/segment-hash/value-hash.ts +0 -338
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* A skipped outlet renders its cached content, and that content still holds
|
|
6
6
|
* the nested `SegmentOutlet` elements from when it was committed — with
|
|
7
|
-
* their old decisions. The skip carries the new ones (`
|
|
7
|
+
* their old decisions. The skip carries the new ones (`DocumentSkip.outlets`)
|
|
8
8
|
* and provides them here, so each old outlet element renders its segment's
|
|
9
9
|
* new decision in place: same element type, same position, so React keeps
|
|
10
10
|
* every component's state below it.
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
* segment was sent or skipped.
|
|
15
15
|
*
|
|
16
16
|
* Singleton across bundler-duplicated chunks via `createGlobalContext`.
|
|
17
|
-
* See design/
|
|
17
|
+
* See design/53-segment-lifetime.md §"Skipping".
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
'use client';
|
|
21
21
|
|
|
22
|
-
import type {
|
|
22
|
+
import type { OutletDecision } from '../shared/outlet-decision.ts';
|
|
23
23
|
import { createGlobalContext } from './global-context.ts';
|
|
24
24
|
|
|
25
25
|
export interface OutletScope {
|
|
@@ -28,12 +28,17 @@ export interface OutletScope {
|
|
|
28
28
|
* entry in `decisions` would render a stale decision, so it refuses to.
|
|
29
29
|
*/
|
|
30
30
|
skipped: boolean;
|
|
31
|
-
decisions: ReadonlyMap<string,
|
|
31
|
+
decisions: ReadonlyMap<string, OutletDecision>;
|
|
32
|
+
/**
|
|
33
|
+
* The outlet this content belongs to: the nearest `SegmentOutlet` above.
|
|
34
|
+
* A `DocumentWithdrawal` marker withdraws it. Undefined outside any outlet.
|
|
35
|
+
*/
|
|
36
|
+
segmentPath?: string;
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
export const LIVE_OUTLET_SCOPE: OutletScope = Object.freeze({
|
|
35
40
|
skipped: false,
|
|
36
|
-
decisions: new Map<string,
|
|
41
|
+
decisions: new Map<string, OutletDecision>(),
|
|
37
42
|
});
|
|
38
43
|
|
|
39
44
|
export const OutletScopeContext = createGlobalContext<OutletScope>(
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* to be there and it has to be alone: a segment the server skipped renders the
|
|
20
20
|
* content the client cached for it, which carries no provider of its own, so a
|
|
21
21
|
* provider *inside* the payload would never reach a reader in a skipped layout
|
|
22
|
-
* (TIM-1297, design/
|
|
22
|
+
* (TIM-1297, design/53-segment-lifetime.md).
|
|
23
23
|
*
|
|
24
24
|
* Ordering still holds without a bootstrap contract, for the same reason it
|
|
25
25
|
* did when the provider was in the tree: a provider renders before its own
|
|
@@ -154,20 +154,9 @@ export interface RouterDeps {
|
|
|
154
154
|
scrollToHash?: (hash: string) => boolean;
|
|
155
155
|
|
|
156
156
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* It does NOT gate the `treePaths` half of X-Timber-State-Tree. Those
|
|
162
|
-
* describe the tree currently mounted, and interception scoping needs them
|
|
163
|
-
* to open a modal on top of a modal — a routing behaviour, not a caching
|
|
164
|
-
* optimization, so it must not depend on a performance opt-in (TIM-1282).
|
|
165
|
-
*/
|
|
166
|
-
clientSegmentCache?: boolean;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* The router's record of committed outlet content and its hashes — the
|
|
170
|
-
* source of the hashes the router advertises. Absent outside a browser.
|
|
157
|
+
* The router's record of committed `'document'` content and its key
|
|
158
|
+
* digests — the source of the digests the router advertises. Absent
|
|
159
|
+
* outside a browser.
|
|
171
160
|
*/
|
|
172
161
|
outletContentCache?: OutletContentCache;
|
|
173
162
|
}
|
package/src/client/router.ts
CHANGED
|
@@ -55,8 +55,6 @@ export function createRouter(deps: RouterDeps): RouterInstance {
|
|
|
55
55
|
const { prepareNavigation, currentStateTree, committedSegmentInfo } = createNavigationCommitter({
|
|
56
56
|
segmentCache,
|
|
57
57
|
historyStack,
|
|
58
|
-
clientSegmentCache: () => deps.clientSegmentCache,
|
|
59
|
-
outletHashes: () => deps.outletContentCache?.hashes() ?? {},
|
|
60
58
|
outletDocuments: () => deps.outletContentCache?.documents() ?? {},
|
|
61
59
|
});
|
|
62
60
|
|
package/src/client/rsc-fetch.ts
CHANGED
|
@@ -481,7 +481,7 @@ export async function fetchRscPayload(
|
|
|
481
481
|
// Accept headers, so the route URL would return HTML.
|
|
482
482
|
const staticTarget = staticMode ? toStaticRscUrl(url) : null;
|
|
483
483
|
const fetchTarget = staticTarget ? staticTarget.url : url;
|
|
484
|
-
// Static hosts resolve neither
|
|
484
|
+
// Static hosts resolve neither key digests nor intercepting routes,
|
|
485
485
|
// so neither the state tree nor the source URL is sent — and neither may
|
|
486
486
|
// fragment the cache key of a file that does not vary on them.
|
|
487
487
|
const headers = staticMode
|
|
@@ -35,8 +35,8 @@ export interface PrefetchResult {
|
|
|
35
35
|
* interception scoping (TIM-1282).
|
|
36
36
|
*
|
|
37
37
|
* Content reuse is not decided here. The outlet content cache holds what the
|
|
38
|
-
* client can reuse, keyed by
|
|
39
|
-
* design/
|
|
38
|
+
* client can reuse, keyed by key digest (client/outlet-content-cache.ts,
|
|
39
|
+
* design/53-segment-lifetime.md).
|
|
40
40
|
*
|
|
41
41
|
* Written only by a navigation's commit (`navigation-commit.ts`), so a
|
|
42
42
|
* superseded navigation never describes the mounted tree (TIM-1301).
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
* SegmentOutlet — the client boundary around one segment: a layout's own
|
|
3
3
|
* chrome, a layout's `children`, a parallel slot, or the page's metadata.
|
|
4
4
|
*
|
|
5
|
-
* The server decides each outlet (server/segment-
|
|
5
|
+
* The server decides each outlet (server/segment-lifetime/outlet-gate.ts):
|
|
6
6
|
*
|
|
7
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
|
|
9
|
-
*
|
|
10
|
-
* - **Skip** — the client
|
|
11
|
-
*
|
|
12
|
-
* not render it at all). The outlet
|
|
8
|
+
* commits it, records it in the router's outlet content cache — beside its
|
|
9
|
+
* key digest when it is a `'document'` segment.
|
|
10
|
+
* - **Skip** — the client holds this `'document'` segment's content under
|
|
11
|
+
* the skip's key digest; the server did not render it at all. The outlet
|
|
13
12
|
* renders the cached copy, and provides the nested outlets' new decisions
|
|
14
13
|
* to the outlet elements inside that copy (client/outlet-scope-context.ts),
|
|
15
14
|
* so each renders its segment's new decision in place.
|
|
@@ -24,18 +23,14 @@
|
|
|
24
23
|
* what a later skip resolves to (TIM-1423).
|
|
25
24
|
*
|
|
26
25
|
* Security: performance only. The server runs every access.ts regardless, and
|
|
27
|
-
* a skip whose
|
|
26
|
+
* a skip whose digest the client does not hold leaves the SPA rather than show
|
|
28
27
|
* other content. See design/13-security.md §"State tree manipulation".
|
|
29
28
|
*/
|
|
30
29
|
|
|
31
30
|
'use client';
|
|
32
31
|
|
|
33
|
-
import { createElement,
|
|
34
|
-
import type {
|
|
35
|
-
CaptureHole,
|
|
36
|
-
OutletDecision,
|
|
37
|
-
OutletDecisionValue,
|
|
38
|
-
} from '../shared/outlet-decision.ts';
|
|
32
|
+
import { createElement, useContext, useLayoutEffect, useMemo, type ReactNode } from 'react';
|
|
33
|
+
import type { OutletDecision } from '../shared/outlet-decision.ts';
|
|
39
34
|
import { OutletContentCacheContext } from './outlet-content-cache.ts';
|
|
40
35
|
import { LIVE_OUTLET_SCOPE, OutletScopeContext, type OutletScope } from './outlet-scope-context.ts';
|
|
41
36
|
import { staleSegmentError } from './stale-segment.ts';
|
|
@@ -43,23 +38,13 @@ import { staleSegmentError } from './stale-segment.ts';
|
|
|
43
38
|
export interface SegmentOutletProps {
|
|
44
39
|
/**
|
|
45
40
|
* The outlet's key: a segment id (`/`, `/(marketing)`), a slot key
|
|
46
|
-
* (`/@sidebar`), a layout's children (`/dashboard/@children`),
|
|
47
|
-
* metadata
|
|
41
|
+
* (`/@sidebar`), a layout's children (`/dashboard/@children`), a
|
|
42
|
+
* `'document'` segment's tree-path key (`/#layout`), or the metadata
|
|
43
|
+
* outlet.
|
|
48
44
|
*/
|
|
49
45
|
segmentPath: string;
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
* a capture render emits, which never reach the client.
|
|
53
|
-
*/
|
|
54
|
-
decision?: OutletDecisionValue | CaptureHole;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function isCaptureHole(value: OutletDecisionValue | CaptureHole): value is CaptureHole {
|
|
58
|
-
return 'captureHole' in value;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function isThenable(value: OutletDecisionValue): value is PromiseLike<OutletDecision> {
|
|
62
|
-
return typeof (value as PromiseLike<OutletDecision>).then === 'function';
|
|
46
|
+
/** What the server decided for this segment. */
|
|
47
|
+
decision: OutletDecision;
|
|
63
48
|
}
|
|
64
49
|
|
|
65
50
|
export function SegmentOutlet({ segmentPath, decision }: SegmentOutletProps): ReactNode {
|
|
@@ -68,42 +53,31 @@ export function SegmentOutlet({ segmentPath, decision }: SegmentOutletProps): Re
|
|
|
68
53
|
|
|
69
54
|
// Inside a skipped segment's cached content this element is from an
|
|
70
55
|
// earlier render; the skip handed down this segment's new decision.
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
// through is a decision the client does not have.
|
|
74
|
-
if (value === undefined || isCaptureHole(value)) throw staleSegmentError(segmentPath);
|
|
75
|
-
const resolved = isThenable(value) ? use(value) : value;
|
|
56
|
+
const resolved = scope.skipped ? scope.decisions.get(segmentPath) : decision;
|
|
57
|
+
if (resolved === undefined) throw staleSegmentError(segmentPath);
|
|
76
58
|
|
|
77
|
-
const cached =
|
|
78
|
-
? undefined
|
|
79
|
-
: resolved.digest !== undefined
|
|
80
|
-
? cache?.lookupDocument(segmentPath, resolved.digest)
|
|
81
|
-
: cache?.lookup(segmentPath, resolved.hash);
|
|
59
|
+
const cached = resolved.skip ? cache?.lookup(segmentPath, resolved.digest) : undefined;
|
|
82
60
|
if (resolved.skip && !cached) throw staleSegmentError(segmentPath);
|
|
83
61
|
const content: ReactNode = resolved.skip ? cached!.content : resolved.children;
|
|
62
|
+
// One live scope per outlet, so its identity changes only with a skip's
|
|
63
|
+
// new decisions (`ResetOnNewDecisions` in error-boundary.tsx reads that).
|
|
64
|
+
const liveScope = useMemo<OutletScope>(
|
|
65
|
+
() => ({ ...LIVE_OUTLET_SCOPE, segmentPath }),
|
|
66
|
+
[segmentPath]
|
|
67
|
+
);
|
|
84
68
|
const childScope = useMemo<OutletScope>(
|
|
85
69
|
() =>
|
|
86
70
|
resolved.skip
|
|
87
|
-
? { skipped: true, decisions: new Map(Object.entries(resolved.outlets)) }
|
|
88
|
-
:
|
|
89
|
-
[resolved]
|
|
71
|
+
? { skipped: true, decisions: new Map(Object.entries(resolved.outlets)), segmentPath }
|
|
72
|
+
: liveScope,
|
|
73
|
+
[resolved, liveScope, segmentPath]
|
|
90
74
|
);
|
|
91
75
|
|
|
92
|
-
// Commit-time write: live content is recorded once React commits it
|
|
93
|
-
// its hash attached when the server's arrives.
|
|
76
|
+
// Commit-time write: live content is recorded once React commits it.
|
|
94
77
|
useLayoutEffect(() => {
|
|
95
78
|
if (cache === null) return;
|
|
96
|
-
if (resolved.skip)
|
|
97
|
-
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
const entry = cache.record(segmentPath, content, resolved.digest);
|
|
101
|
-
resolved.hash?.then(
|
|
102
|
-
(hash) => {
|
|
103
|
-
if (hash) cache.attachHash(segmentPath, entry, hash);
|
|
104
|
-
},
|
|
105
|
-
() => {}
|
|
106
|
-
);
|
|
79
|
+
if (resolved.skip) cache.touch(segmentPath, content);
|
|
80
|
+
else cache.record(segmentPath, content, resolved.digest);
|
|
107
81
|
}, [resolved, cache, segmentPath, content]);
|
|
108
82
|
|
|
109
83
|
return createElement(OutletScopeContext.Provider, { value: childScope }, content);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
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
|
|
3
|
+
* decided — a skip whose content the client no longer holds under that digest,
|
|
4
4
|
* or an outlet inside a skipped segment that received no new decision.
|
|
5
5
|
*
|
|
6
6
|
* Either means the client's record moved on between the request and the
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* evicted). Rendering anything else would show content the server did not
|
|
9
9
|
* produce, so the error passes every boundary to the terminal, which fetches
|
|
10
10
|
* the page again (`recoverFromStaleSegment`) — and leaves the SPA only if
|
|
11
|
-
* that misses too (design/
|
|
11
|
+
* that misses too (design/53-segment-lifetime.md §"Skipping").
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
export interface StaleSegmentDigest {
|
package/src/config-types.ts
CHANGED
|
@@ -328,23 +328,6 @@ export interface TimberUserConfig {
|
|
|
328
328
|
* ```
|
|
329
329
|
*/
|
|
330
330
|
buildDir?: string;
|
|
331
|
-
/**
|
|
332
|
-
* Skip unchanged segments on client navigation (segment hash dedupe).
|
|
333
|
-
*
|
|
334
|
-
* When enabled, every live segment the server sends carries a hash of its
|
|
335
|
-
* output, and the router advertises the hashes of the content it holds in
|
|
336
|
-
* `X-Timber-State-Tree`. The server still renders every segment; one whose
|
|
337
|
-
* output hashes the same as the client's copy is sent as a skip, and the
|
|
338
|
-
* client keeps its copy. Every segment renders once either way.
|
|
339
|
-
*
|
|
340
|
-
* When disabled (the default), every navigation gets a full RSC payload.
|
|
341
|
-
*
|
|
342
|
-
* This is a performance optimization only — not a security boundary.
|
|
343
|
-
* The server always runs all `access.ts` files regardless.
|
|
344
|
-
*
|
|
345
|
-
* See design/52-segment-hash-dedupe.md
|
|
346
|
-
*/
|
|
347
|
-
clientSegmentCache?: boolean;
|
|
348
331
|
/**
|
|
349
332
|
* The lifetime of every layout that does not declare one, slot layouts
|
|
350
333
|
* included. Pages are unaffected, and a layout's own
|
|
@@ -355,7 +338,8 @@ export interface TimberUserConfig {
|
|
|
355
338
|
* applies: the default key is every param on the layout's path, and the
|
|
356
339
|
* layout may read only the request inputs in its key. Check three things
|
|
357
340
|
* before turning it on: a layout that reads anything else (a header, a
|
|
358
|
-
* cookie outside its key)
|
|
341
|
+
* cookie outside its key) is reported (the dev overlay, or a warning) and
|
|
342
|
+
* renders as `'request'` for that visitor; a layout that shows data that changes
|
|
359
343
|
* during a visit (a cart badge) keeps the value it had at load; and a layout
|
|
360
344
|
* that hides its children in its body no longer keeps them out of the
|
|
361
345
|
* payload, since a skip never runs it. Declare
|
package/src/config-validation.ts
CHANGED
package/src/plugins/entries.ts
CHANGED
|
@@ -164,7 +164,6 @@ function generateConfigModule(ctx: PluginContext): string {
|
|
|
164
164
|
// Per-build deployment ID for version skew detection (TIM-446).
|
|
165
165
|
// Null in dev mode — HMR handles code updates without full reloads.
|
|
166
166
|
deploymentId: ctx.deploymentId ?? null,
|
|
167
|
-
clientSegmentCache: ctx.config.clientSegmentCache ?? false,
|
|
168
167
|
// Read by the RSC entry only: the lifetime of a layout that declares none
|
|
169
168
|
// (design/53 §"App-wide default").
|
|
170
169
|
defaultLayoutLifetime: ctx.config.defaultLayoutLifetime === 'document' ? 'document' : 'request',
|
|
@@ -350,11 +350,11 @@ export function validateInterceptionPlacement(root: SegmentNode): void {
|
|
|
350
350
|
* layout-bearing segment**, because those are the segments the client needs an
|
|
351
351
|
* outlet and a cache node for. `buildSegmentInfo` skips the rest.
|
|
352
352
|
*
|
|
353
|
-
* For the modal shape that set is exactly the set of possible scope owners
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
353
|
+
* For the modal shape that set is exactly the set of possible scope owners:
|
|
354
|
+
* a slot is only resolved inside its owner's layout, and `validateSlotPlacement`
|
|
355
|
+
* rejects a slot whose owner has none (TIM-1443). A children-path
|
|
356
|
+
* interception's owner is an ordinary directory rather than a slot owner, so
|
|
357
|
+
* that rule does not reach it — this one does.
|
|
358
358
|
*
|
|
359
359
|
* Left unchecked the result is a swap that works exactly once: the first soft
|
|
360
360
|
* navigation renders, then the client reports no such tree path, and the next
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
* nothing and its `deferSuspenseFor` is unvalidated.
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
|
+
import { headerKeyProblem } from '../shared/key-headers.ts';
|
|
36
37
|
import { existsSync } from 'node:fs';
|
|
37
38
|
import type {
|
|
38
39
|
LayoutOptions,
|
|
@@ -191,13 +192,23 @@ function readLifetime(node: Node): Read<SegmentLifetime> {
|
|
|
191
192
|
}
|
|
192
193
|
|
|
193
194
|
/**
|
|
194
|
-
* What the build can read of a segment key: the param names. `searchParams`
|
|
195
|
+
* What the build can read of a segment key: the param and header names. `searchParams`
|
|
195
196
|
* and `cookies` name definitions — code the build cannot evaluate — so only
|
|
196
197
|
* their shape is checked here; their values take effect from the loaded
|
|
197
198
|
* module (`server/segment-lifetime/`). The route-options lint checks the
|
|
198
199
|
* param names against the segment's path.
|
|
199
200
|
*/
|
|
200
|
-
type BuildTimeKey = Pick<SegmentKey, 'segmentParams'>;
|
|
201
|
+
type BuildTimeKey = Pick<SegmentKey, 'segmentParams' | 'headers'>;
|
|
202
|
+
|
|
203
|
+
function readHeaderNames(node: Node): Read<string[]> {
|
|
204
|
+
const names = readStringArray(node);
|
|
205
|
+
if (!names) return { problem: 'key.headers must be an array of header-name string literals.' };
|
|
206
|
+
for (const name of names) {
|
|
207
|
+
const problem = headerKeyProblem(name);
|
|
208
|
+
if (problem) return { problem };
|
|
209
|
+
}
|
|
210
|
+
return { value: names };
|
|
211
|
+
}
|
|
201
212
|
|
|
202
213
|
/** A value written in place, which cannot be a definition imported or declared elsewhere. */
|
|
203
214
|
function isInlineValue(node: Node): boolean {
|
|
@@ -215,7 +226,8 @@ function readKey(node: Node): Read<BuildTimeKey> {
|
|
|
215
226
|
const n = unwrap(node);
|
|
216
227
|
if (n.type !== 'ObjectExpression') {
|
|
217
228
|
return {
|
|
218
|
-
problem:
|
|
229
|
+
problem:
|
|
230
|
+
'key must be an object literal `{ segmentParams?, searchParams?, cookies?, headers? }`.',
|
|
219
231
|
};
|
|
220
232
|
}
|
|
221
233
|
const result: BuildTimeKey = {};
|
|
@@ -243,9 +255,13 @@ function readKey(node: Node): Read<BuildTimeKey> {
|
|
|
243
255
|
problem: 'key.cookies must be an array literal of cookie definitions (`defineCookie`).',
|
|
244
256
|
};
|
|
245
257
|
}
|
|
258
|
+
} else if (entry.key === 'headers') {
|
|
259
|
+
const headers = readHeaderNames(entry.value);
|
|
260
|
+
if ('problem' in headers) return headers;
|
|
261
|
+
result.headers = headers.value;
|
|
246
262
|
} else {
|
|
247
263
|
return {
|
|
248
|
-
problem: `Unknown key "${entry.key}" in key. Allowed: segmentParams, searchParams, cookies.`,
|
|
264
|
+
problem: `Unknown key "${entry.key}" in key. Allowed: segmentParams, searchParams, cookies, headers.`,
|
|
249
265
|
};
|
|
250
266
|
}
|
|
251
267
|
}
|
package/src/routing/scanner.ts
CHANGED
|
@@ -369,7 +369,7 @@ function scanChildren(dirPath: string, parentNode: SegmentNode, extSet: Set<stri
|
|
|
369
369
|
// `@children` is the implicit slot a layout's `children` prop fills, and
|
|
370
370
|
// the key of the outlet that carries it (`childrenOutletKey`). A slot
|
|
371
371
|
// directory by that name would claim the same outlet and be rendered in
|
|
372
|
-
// place of the children
|
|
372
|
+
// place of the children.
|
|
373
373
|
if (entry === '@children') {
|
|
374
374
|
throw new Error(
|
|
375
375
|
`Build error: "@children" is reserved and cannot be a slot directory.\n` +
|
|
@@ -150,10 +150,9 @@ export function computeSlotKey(parentSegmentId: string, slotName: string): strin
|
|
|
150
150
|
* The outlet key of a layout's `children`. A layout's own outlet covers its
|
|
151
151
|
* chrome; everything it receives as `children` — this segment's boundaries
|
|
152
152
|
* and metadata collectors, the next segment's access gate, the page — is a
|
|
153
|
-
* separate outlet, so
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* See design/52-segment-hash-dedupe.md §"The unit is the segment's own output".
|
|
153
|
+
* separate outlet, so a skipped 'document' layout never freezes what is under
|
|
154
|
+
* it. Keyed as the implicit `children` slot; the route scanner rejects an
|
|
155
|
+
* `@children` directory. See design/53-segment-lifetime.md §"Skipping".
|
|
157
156
|
*/
|
|
158
157
|
export function childrenOutletKey(segmentId: string): string {
|
|
159
158
|
return computeSlotKey(segmentId, '@children');
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parallel slot placement.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Two rules, both about slots no renderer reaches:
|
|
5
|
+
*
|
|
6
|
+
* 1. A slot is resolved only for a segment on the **matched route chain**,
|
|
7
|
+
* and a slot's own subtree is never on that chain. So a slot declared
|
|
8
|
+
* anywhere inside another slot's subtree can never render.
|
|
9
|
+
* 2. A slot is a prop of its owner's **layout**. A segment without a
|
|
10
|
+
* `layout.tsx` has nothing to hand the slot to, so its slots never render
|
|
11
|
+
* either (TIM-1443).
|
|
12
|
+
*
|
|
13
|
+
* Both are rejected at build time rather than left as directories the author
|
|
14
|
+
* will keep editing.
|
|
8
15
|
*
|
|
9
16
|
* See design/07-routing.md §"Parallel Routes".
|
|
10
17
|
*/
|
|
@@ -45,6 +52,18 @@ import type { SegmentNode } from './types.ts';
|
|
|
45
52
|
* it exactly as it does for any other chain segment. `(browse)/(...)photo/[id]/@side`
|
|
46
53
|
* renders; `feed/@modal/(.)photo/@side` does not. The discriminator is the slot
|
|
47
54
|
* boundary, which is what this walk tracks — not the marker.
|
|
55
|
+
*
|
|
56
|
+
* **The owner must have a layout.** `route-element-builder.ts` resolves a
|
|
57
|
+
* segment's slots only while building that segment's layout element — the
|
|
58
|
+
* slot props are the layout's props, and nothing else receives them. A slot on
|
|
59
|
+
* a layoutless segment is dead in exactly the way a nested slot is, with the
|
|
60
|
+
* same missing signal. (Next.js drops them the same way: a segment with no
|
|
61
|
+
* layout renders only `children`.) Interception made it worse than dead: only
|
|
62
|
+
* the winning owner's slots intercept, so a layoutless owner whose rewrite won
|
|
63
|
+
* — reachable through the address-bar scope channel — rendered the source page
|
|
64
|
+
* with no modal under the target URL. The client's mounted-scope channel never
|
|
65
|
+
* names such an owner, because `X-Timber-Segments` carries layout-bearing
|
|
66
|
+
* segments only; this rule makes the two channels agree by construction.
|
|
48
67
|
*/
|
|
49
68
|
export function validateSlotPlacement(root: SegmentNode): void {
|
|
50
69
|
walkForSlotPlacement(root, '', null);
|
|
@@ -67,6 +86,9 @@ function walkForSlotPlacement(
|
|
|
67
86
|
if (enclosingSlotPath !== null) {
|
|
68
87
|
throwNestedSlot(slotPath, enclosingSlotPath);
|
|
69
88
|
}
|
|
89
|
+
if (!node.layout) {
|
|
90
|
+
throwLayoutlessOwner(slotPath, path, slotName);
|
|
91
|
+
}
|
|
70
92
|
walkForSlotPlacement(slotNode, slotPath, slotPath);
|
|
71
93
|
}
|
|
72
94
|
|
|
@@ -79,6 +101,21 @@ function walkForSlotPlacement(
|
|
|
79
101
|
}
|
|
80
102
|
}
|
|
81
103
|
|
|
104
|
+
function throwLayoutlessOwner(slotPath: string, ownerPath: string, slotName: string): never {
|
|
105
|
+
const owner = ownerPath ? `app/${ownerPath}` : 'app';
|
|
106
|
+
throw new Error(
|
|
107
|
+
`Build error: parallel slot whose owner has no layout.\n` +
|
|
108
|
+
` Directory: app/${slotPath}\n` +
|
|
109
|
+
` Owner: ${owner}\n` +
|
|
110
|
+
`A parallel slot is passed to its owning segment's layout as a named prop, and ` +
|
|
111
|
+
`${owner} has no layout.tsx to receive it — so app/${slotPath} can never render, ` +
|
|
112
|
+
`and no request-time signal can tell you.\n` +
|
|
113
|
+
`Add ${owner}/layout.tsx and place the slot prop where it should appear, e.g. ` +
|
|
114
|
+
`({ children, ${slotName} }) => <>{children}{${slotName}}</>.\n` +
|
|
115
|
+
`See design/07-routing.md §"Parallel Routes".`
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
82
119
|
function throwNestedSlot(slotPath: string, enclosingSlotPath: string): never {
|
|
83
120
|
throw new Error(
|
|
84
121
|
`Build error: parallel slot nested inside another parallel slot.\n` +
|
|
@@ -75,7 +75,7 @@ declare module '@vitejs/plugin-rsc/vendor/react-server-dom/server.edge' {
|
|
|
75
75
|
exportName: string | null
|
|
76
76
|
): T;
|
|
77
77
|
|
|
78
|
-
// Tests render real client references
|
|
78
|
+
// Tests render real client references the way the
|
|
79
79
|
// use-client transform registers them.
|
|
80
80
|
export function registerClientReference<T>(
|
|
81
81
|
proxyImplementation: T,
|
|
@@ -340,29 +340,6 @@ export const prebuiltCaptureAls = getOrCreateAls<PrebuiltCaptureStore>(
|
|
|
340
340
|
Symbol.for('timber:prebuilt-capture-als')
|
|
341
341
|
);
|
|
342
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
|
-
);
|
|
365
|
-
|
|
366
343
|
// ─── 'document' segment read scope ────────────────────────────────────────
|
|
367
344
|
// Used by: segment-lifetime/read-scope.ts (set), request-context.ts and
|
|
368
345
|
// cookie-context.ts (checked by every request-input accessor).
|
|
@@ -385,6 +362,22 @@ export interface DocumentReadScope {
|
|
|
385
362
|
* holds: a keyed cookie may be read only through that definition.
|
|
386
363
|
*/
|
|
387
364
|
cookies: ReadonlyMap<string, unknown>;
|
|
365
|
+
/** The key's header names, lowercased. */
|
|
366
|
+
headers: ReadonlySet<string>;
|
|
367
|
+
/**
|
|
368
|
+
* Whether this segment render has reported a read outside its key: one
|
|
369
|
+
* report per segment render. Shared by every call in the render.
|
|
370
|
+
*/
|
|
371
|
+
reported: { done: boolean };
|
|
372
|
+
/**
|
|
373
|
+
* Whether this component call (and the work it awaits) read outside the
|
|
374
|
+
* key, so its output must withdraw the segment from the client (design/53
|
|
375
|
+
* §"Reads outside the key"). One per scoped component call: the scope runs
|
|
376
|
+
* each call in a copy of the scope with a fresh `call`
|
|
377
|
+
* (`segment-lifetime/read-scope.ts`). Set by the read rule
|
|
378
|
+
* (`segment-lifetime/read-rule.ts`).
|
|
379
|
+
*/
|
|
380
|
+
call: { read: boolean };
|
|
388
381
|
}
|
|
389
382
|
|
|
390
383
|
/** @internal — run and read via segment-lifetime/read-scope.ts */
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parsing of the client's `X-Timber-State-Tree` request header.
|
|
3
3
|
*
|
|
4
|
-
* The header carries
|
|
4
|
+
* The header carries two unrelated things:
|
|
5
5
|
*
|
|
6
|
-
* - `hashes` — the segment hashes the client holds content for, by outlet
|
|
7
|
-
* path. The outlet gates compare them with a capture of each segment and
|
|
8
|
-
* skip the ones that match (design/52-segment-hash-dedupe.md). Read only
|
|
9
|
-
* when the app opted into `clientSegmentCache`.
|
|
10
6
|
* - `documents` — the key digests of the `'document'` segments the client
|
|
11
7
|
* holds content for, by outlet path. An outlet gate skips a `'document'`
|
|
12
8
|
* segment without rendering it when the digest verifies against this
|
|
@@ -16,20 +12,17 @@
|
|
|
16
12
|
* now, for interception scoping (design/07-routing.md §"Intercepting
|
|
17
13
|
* Routes", TIM-1282).
|
|
18
14
|
*
|
|
19
|
-
*
|
|
20
|
-
* send a skip for content the client claims to hold; the client checks every
|
|
21
|
-
* against the
|
|
22
|
-
* regardless. See design/13-security.md §"State tree manipulation".
|
|
15
|
+
* Neither is a security input. A forged digest can only make the server
|
|
16
|
+
* send a skip for content the client claims to hold; the client checks every
|
|
17
|
+
* skip against the digest of what it actually holds, and every `access.ts`
|
|
18
|
+
* runs regardless. See design/13-security.md §"State tree manipulation".
|
|
23
19
|
*/
|
|
24
20
|
|
|
25
|
-
import { SEGMENT_HASH_LENGTH } from './segment-hash/value-hash.ts';
|
|
26
21
|
import { KEY_DIGEST_SHAPE } from './segment-lifetime/key-digest.ts';
|
|
27
22
|
import { swallow } from './logger.ts';
|
|
28
23
|
|
|
29
24
|
/** The parsed header. */
|
|
30
25
|
export interface ClientStateTree {
|
|
31
|
-
/** Segment hashes by outlet path, or null when none were sent. */
|
|
32
|
-
hashes: ReadonlyMap<string, string> | null;
|
|
33
26
|
/** `'document'` key digests by outlet path, or null when none were sent. */
|
|
34
27
|
documents: ReadonlyMap<string, string> | null;
|
|
35
28
|
/** Directory paths of the mounted segments, or null when none were sent. */
|
|
@@ -42,8 +35,6 @@ export interface ClientStateTree {
|
|
|
42
35
|
*/
|
|
43
36
|
const MAX_ENTRIES = 512;
|
|
44
37
|
|
|
45
|
-
const HASH_SHAPE = new RegExp(`^[A-Za-z0-9_-]{${SEGMENT_HASH_LENGTH}}$`);
|
|
46
|
-
|
|
47
38
|
/**
|
|
48
39
|
* Parse `X-Timber-State-Tree`. Null when the header is missing, malformed, or
|
|
49
40
|
* says nothing. Entries of the wrong shape are dropped, not trusted.
|
|
@@ -52,7 +43,7 @@ export function parseClientStateTree(req: Request): ClientStateTree | null {
|
|
|
52
43
|
const header = req.headers.get('X-Timber-State-Tree');
|
|
53
44
|
if (!header) return null;
|
|
54
45
|
|
|
55
|
-
let parsed: {
|
|
46
|
+
let parsed: { documents?: unknown; treePaths?: unknown };
|
|
56
47
|
try {
|
|
57
48
|
parsed = JSON.parse(header) as typeof parsed;
|
|
58
49
|
} catch (err) {
|
|
@@ -61,16 +52,14 @@ export function parseClientStateTree(req: Request): ClientStateTree | null {
|
|
|
61
52
|
}
|
|
62
53
|
if (!parsed || typeof parsed !== 'object') return null;
|
|
63
54
|
|
|
64
|
-
const hashes = readTokenMap(parsed.hashes, HASH_SHAPE);
|
|
65
55
|
const documents = readTokenMap(parsed.documents, KEY_DIGEST_SHAPE);
|
|
66
56
|
|
|
67
57
|
const treePaths = Array.isArray(parsed.treePaths)
|
|
68
58
|
? new Set(parsed.treePaths.filter((p): p is string => typeof p === 'string'))
|
|
69
59
|
: new Set<string>();
|
|
70
60
|
|
|
71
|
-
if (
|
|
61
|
+
if (documents.size === 0 && treePaths.size === 0) return null;
|
|
72
62
|
return {
|
|
73
|
-
hashes: hashes.size > 0 ? hashes : null,
|
|
74
63
|
documents: documents.size > 0 ? documents : null,
|
|
75
64
|
treePaths: treePaths.size > 0 ? treePaths : null,
|
|
76
65
|
};
|