@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
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
* - **segment params** — the coerced params (each segment's codec applied);
|
|
13
13
|
* - **search params** — `def.buildSearchParams(def.parse(…))`, which applies
|
|
14
14
|
* defaults, aliases (`withUrlKey`) and drops values that parse to the default;
|
|
15
|
+
* - **headers** — each named header's value as `Headers.get` returns it
|
|
16
|
+
* (trimmed, repeats joined with ", "), or null when absent, by lowercased
|
|
17
|
+
* name; headers have no codec, so equivalent spellings differ;
|
|
15
18
|
* - **cookies** — `codec.serialize(codec.parse(raw))` per definition. The raw
|
|
16
19
|
* value comes from the request's cookie jar, which reflects cookies the
|
|
17
20
|
* current server action set (design/53 open question 4), so an action's
|
|
@@ -22,7 +25,8 @@
|
|
|
22
25
|
import type { CoercedParams } from '../../shared/param-value.ts';
|
|
23
26
|
import { ROUTE_OPTIONS_EXPORT, type RouteOptionsKind } from '../../shared/route-options-export.ts';
|
|
24
27
|
import { getCookieJar } from '../cookie-context.ts';
|
|
25
|
-
import { getSearchParams } from '../request-context.ts';
|
|
28
|
+
import { getHeaders, getSearchParams } from '../request-context.ts';
|
|
29
|
+
import { headerKeyProblem } from '../../shared/key-headers.ts';
|
|
26
30
|
import type { SegmentKey, SegmentLifetime } from '../types.ts';
|
|
27
31
|
|
|
28
32
|
/** A segment declared `lifetime: 'document'`, with the key it declared (if any). */
|
|
@@ -69,7 +73,25 @@ export function readDocumentLifetime(
|
|
|
69
73
|
const key = 'key' in options ? options.key : undefined;
|
|
70
74
|
// The module's own export, typed `satisfies LayoutOptions` / `PageOptions`
|
|
71
75
|
// in source and shape-checked by the build; at runtime it is an `object`.
|
|
72
|
-
|
|
76
|
+
const segmentKey = typeof key === 'object' && key !== null ? (key as SegmentKey) : {};
|
|
77
|
+
assertKeyableHeaders(segmentKey.headers);
|
|
78
|
+
return { key: segmentKey };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Refuse a header the key may not name, at runtime too: the build does not
|
|
83
|
+
* read every file kind (an MDX page's options go unlinted), and a credential
|
|
84
|
+
* must not become keyable — and readable — by skipping the lint.
|
|
85
|
+
*/
|
|
86
|
+
function assertKeyableHeaders(headers: unknown): void {
|
|
87
|
+
if (headers === undefined) return;
|
|
88
|
+
if (!Array.isArray(headers) || !headers.every((h) => typeof h === 'string')) {
|
|
89
|
+
throw new Error('[timber] key.headers must be an array of header names.');
|
|
90
|
+
}
|
|
91
|
+
for (const name of headers) {
|
|
92
|
+
const problem = headerKeyProblem(name);
|
|
93
|
+
if (problem) throw new Error(`[timber] ${problem}`);
|
|
94
|
+
}
|
|
73
95
|
}
|
|
74
96
|
|
|
75
97
|
/**
|
|
@@ -99,7 +121,13 @@ export function readKeyValues(
|
|
|
99
121
|
cookie.codec.serialize(cookie.codec.parse(jar?.get(cookie.name))),
|
|
100
122
|
]);
|
|
101
123
|
|
|
102
|
-
|
|
124
|
+
const requestHeaders = key.headers && key.headers.length > 0 ? getHeaders() : null;
|
|
125
|
+
const headers = (key.headers ?? []).map((name) => [
|
|
126
|
+
name.toLowerCase(),
|
|
127
|
+
requestHeaders?.get(name) ?? null,
|
|
128
|
+
]);
|
|
129
|
+
|
|
130
|
+
return JSON.stringify([segmentParams, searchParams, cookies, headers]);
|
|
103
131
|
}
|
|
104
132
|
|
|
105
133
|
/**
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
} from '../../routing/segment-keys.ts';
|
|
30
30
|
import type { CoercedParams } from '../../shared/param-value.ts';
|
|
31
31
|
import type { ManifestSegmentNode } from '../route-matcher.ts';
|
|
32
|
-
import { outletGate, type OutletSpec, type
|
|
32
|
+
import { outletGate, type OutletSpec, type SegmentRender } from './outlet-gate.ts';
|
|
33
33
|
import { documentOutletFor } from './document-outlet.ts';
|
|
34
34
|
import {
|
|
35
35
|
defaultLayoutLifetimeAt,
|
|
@@ -41,7 +41,7 @@ import type { ServerComponent } from '../subtree-walk.ts';
|
|
|
41
41
|
|
|
42
42
|
/** Everything a slot's `'document'` outlets need from the slot being resolved. */
|
|
43
43
|
export interface SlotDocumentContext {
|
|
44
|
-
render:
|
|
44
|
+
render: SegmentRender;
|
|
45
45
|
/** The slot's matched chain, slot root first. */
|
|
46
46
|
chain: readonly ManifestSegmentNode[];
|
|
47
47
|
/** The tree path of the segment that owns the slot. */
|
|
@@ -102,7 +102,7 @@ export class SlotDocumentOutlets {
|
|
|
102
102
|
document: await this.decision(node, segmentPath, lifetime),
|
|
103
103
|
};
|
|
104
104
|
this.unclaimed = [spec];
|
|
105
|
-
return outletGate(spec
|
|
105
|
+
return outletGate(spec);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/**
|
|
@@ -123,17 +123,17 @@ export class SlotDocumentOutlets {
|
|
|
123
123
|
};
|
|
124
124
|
const spec: OutletSpec = {
|
|
125
125
|
segmentPath,
|
|
126
|
-
content: buildLayout(outletGate(childrenOutlet
|
|
126
|
+
content: buildLayout(outletGate(childrenOutlet)),
|
|
127
127
|
nested: [childrenOutlet],
|
|
128
128
|
document: await this.decision(node, segmentPath, lifetime),
|
|
129
129
|
};
|
|
130
130
|
this.unclaimed = [spec];
|
|
131
|
-
return outletGate(spec
|
|
131
|
+
return outletGate(spec);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
135
|
* A 'document' slot segment's component, run in its read scope
|
|
136
|
-
* (`read-scope.ts`): a read outside its key
|
|
136
|
+
* (`read-scope.ts`): a read outside its key is refused.
|
|
137
137
|
*/
|
|
138
138
|
scoped(
|
|
139
139
|
node: ManifestSegmentNode,
|
|
@@ -34,14 +34,15 @@ import { extractUrlParts } from './chain-url-parts.ts';
|
|
|
34
34
|
import { findInterceptingMatch } from './slot-interception.ts';
|
|
35
35
|
import { computeSlotKey, slotChainTreePath } from '../routing/segment-keys.ts';
|
|
36
36
|
import {
|
|
37
|
-
|
|
37
|
+
LIVE_ONLY_RENDER,
|
|
38
38
|
outletGate,
|
|
39
39
|
type OutletSpec,
|
|
40
|
-
type
|
|
41
|
-
} from './segment-
|
|
40
|
+
type SegmentRender,
|
|
41
|
+
} from './segment-lifetime/outlet-gate.ts';
|
|
42
42
|
import { getSegmentParams } from './request-context.ts';
|
|
43
43
|
import { pathParamNames } from './segment-lifetime/document-outlet.ts';
|
|
44
44
|
import { SlotDocumentOutlets } from './segment-lifetime/slot-outlets.ts';
|
|
45
|
+
import { fallbackAfter } from './segment-lifetime/read-scope.ts';
|
|
45
46
|
import type { ServerComponent } from './subtree-walk.ts';
|
|
46
47
|
import { clientComponents } from './vite-handoff-rsc.ts';
|
|
47
48
|
|
|
@@ -97,15 +98,24 @@ export async function resolveSlotElement(
|
|
|
97
98
|
req: Request,
|
|
98
99
|
interception?: InterceptionContext,
|
|
99
100
|
parentTreePath?: string,
|
|
100
|
-
render:
|
|
101
|
+
render: SegmentRender = LIVE_ONLY_RENDER
|
|
101
102
|
): Promise<ResolvedSlotElement> {
|
|
102
|
-
// When interception is active
|
|
103
|
-
//
|
|
104
|
-
// it instead of the normal slot match
|
|
105
|
-
// the slot shows the intercepted content on soft
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
// When interception is active and this slot belongs to the winning owner,
|
|
104
|
+
// try to match intercepting children in this slot against the target
|
|
105
|
+
// pathname. If one matches, render it instead of the normal slot match —
|
|
106
|
+
// the modal pattern: the slot shows the intercepted content on soft
|
|
107
|
+
// navigation.
|
|
108
|
+
//
|
|
109
|
+
// The owner test consumes the pipeline's decision; it does not re-derive
|
|
110
|
+
// one. A slot on any other owner of the chain resolves as it would on a
|
|
111
|
+
// navigation nothing intercepted, even when it holds an interceptor for this
|
|
112
|
+
// very URL: that interceptor lost the deepest-scope ranking (TIM-1443). Two
|
|
113
|
+
// slots on the winning owner both intercept, one modal each — design/07
|
|
114
|
+
// §"Selection Between Owners".
|
|
115
|
+
const intercepting =
|
|
116
|
+
interception && interception.interceptingScope === parentTreePath
|
|
117
|
+
? findInterceptingMatch(slotNode, interception.targetPathname)
|
|
118
|
+
: null;
|
|
109
119
|
const slotMatch = intercepting ?? findSlotMatch(slotNode, match);
|
|
110
120
|
|
|
111
121
|
if (slotMatch) {
|
|
@@ -204,14 +214,16 @@ export async function resolveSlotElement(
|
|
|
204
214
|
if (isRedirectSignal(error)) {
|
|
205
215
|
throw error;
|
|
206
216
|
}
|
|
217
|
+
// A 'document' slot page that read outside its key and then threw
|
|
218
|
+
// must not have its fallback kept under the key digest (design/53).
|
|
207
219
|
if (isDenySignal(error)) {
|
|
208
|
-
return denyFallback;
|
|
220
|
+
return fallbackAfter(error, denyFallback);
|
|
209
221
|
}
|
|
210
222
|
// Report the error but don't re-throw — returning fallback ensures
|
|
211
223
|
// the Flight row is resolved and the page hydrates correctly.
|
|
212
224
|
// Nothing downstream sees it, so this is its one report.
|
|
213
225
|
reportRenderError(error, req, { segments: match.segments });
|
|
214
|
-
return denyFallback;
|
|
226
|
+
return fallbackAfter(error, denyFallback);
|
|
215
227
|
}
|
|
216
228
|
};
|
|
217
229
|
element = h(SafeSlotPage, {});
|
|
@@ -389,7 +401,7 @@ function ScopedSlotLayout(props: {
|
|
|
389
401
|
props.scope(() => props.layout({ children: props.children }))
|
|
390
402
|
);
|
|
391
403
|
} catch (error) {
|
|
392
|
-
if (isDenySignal(error)) return props.denyFallback;
|
|
404
|
+
if (isDenySignal(error)) return fallbackAfter(error, props.denyFallback);
|
|
393
405
|
throw error;
|
|
394
406
|
}
|
|
395
407
|
return containSlotSubtree(rendered as React.ReactNode, props.denyFallback, props.children);
|
|
@@ -584,7 +596,7 @@ interface ResolveSlotPropsArgs {
|
|
|
584
596
|
parentTreePath: string;
|
|
585
597
|
/** The request being rendered. */
|
|
586
598
|
req: Request;
|
|
587
|
-
render:
|
|
599
|
+
render: SegmentRender;
|
|
588
600
|
}
|
|
589
601
|
|
|
590
602
|
/** A layout's slot props, and the outlet of each slot. */
|
|
@@ -597,8 +609,8 @@ export interface ResolvedSlots {
|
|
|
597
609
|
* Resolve all parallel route slots for a layout, each in its own outlet.
|
|
598
610
|
*
|
|
599
611
|
* Every slot is resolved and every slot's access chain runs, on every render.
|
|
600
|
-
*
|
|
601
|
-
*
|
|
612
|
+
* A slot is skipped only through the 'document' segments on its chain
|
|
613
|
+
* (design/53-segment-lifetime.md §"Slots").
|
|
602
614
|
*/
|
|
603
615
|
export async function resolveSlotProps({
|
|
604
616
|
segment,
|
|
@@ -629,7 +641,7 @@ export async function resolveSlotProps({
|
|
|
629
641
|
nested,
|
|
630
642
|
};
|
|
631
643
|
outlets.push(spec);
|
|
632
|
-
props[slotName] = outletGate(spec
|
|
644
|
+
props[slotName] = outletGate(spec);
|
|
633
645
|
}
|
|
634
646
|
|
|
635
647
|
return { props, outlets };
|
|
@@ -43,10 +43,11 @@ import {
|
|
|
43
43
|
type ServerComponent,
|
|
44
44
|
type SubtreeRule,
|
|
45
45
|
} from './subtree-walk.ts';
|
|
46
|
+
import { fallbackAfter } from './segment-lifetime/read-scope.ts';
|
|
46
47
|
|
|
47
48
|
function denyToFallback(fallback: ReactNode): (error: unknown) => ReactNode {
|
|
48
49
|
return (error) => {
|
|
49
|
-
if (isDenySignal(error)) return fallback;
|
|
50
|
+
if (isDenySignal(error)) return fallbackAfter(error, fallback);
|
|
50
51
|
throw error;
|
|
51
52
|
};
|
|
52
53
|
}
|
|
@@ -140,12 +140,33 @@ export interface SubtreeRule {
|
|
|
140
140
|
/** Handles a rejection of a promise rendered as a child; rethrows by default. */
|
|
141
141
|
onRejected?: (reason: unknown) => unknown;
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
143
|
+
* The context for one async iterable a component returned: the work the walk
|
|
144
|
+
* defers past the component's return (advancing it) runs through `run`,
|
|
145
|
+
* each value it yields passes through `yielded` after it is rewritten, and
|
|
146
|
+
* `beforeClose` may name one last value to yield before it closes. Default:
|
|
147
|
+
* as is.
|
|
145
148
|
*/
|
|
146
|
-
|
|
149
|
+
iterate?: () => IterationContext;
|
|
147
150
|
}
|
|
148
151
|
|
|
152
|
+
/** How a rule runs and post-processes the steps of one async iterable. */
|
|
153
|
+
export interface IterationContext {
|
|
154
|
+
run<T>(fn: () => T): T;
|
|
155
|
+
yielded(value: unknown): unknown;
|
|
156
|
+
/**
|
|
157
|
+
* A value to yield before the iterable closes, or undefined for none. A
|
|
158
|
+
* value that must render cannot ride on the return value: React's
|
|
159
|
+
* iterable-child consumption does not render it.
|
|
160
|
+
*/
|
|
161
|
+
beforeClose(): unknown;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const AS_IS: IterationContext = {
|
|
165
|
+
run: (fn) => fn(),
|
|
166
|
+
yielded: (value) => value,
|
|
167
|
+
beforeClose: () => undefined,
|
|
168
|
+
};
|
|
169
|
+
|
|
149
170
|
/**
|
|
150
171
|
* Rewrite `node`, returning the input itself when nothing beneath it needed
|
|
151
172
|
* wrapping — so an unchanged subtree keeps its identity and Flight's own
|
|
@@ -233,15 +254,19 @@ function rewriteNode(node: object, rule: SubtreeRule, seen: Seen): unknown {
|
|
|
233
254
|
// value rewritten, inside the rule's context instead.
|
|
234
255
|
if (isAsyncIterable(node)) {
|
|
235
256
|
const source = node;
|
|
236
|
-
const runIn = rule.runIn ?? ((fn) => fn());
|
|
237
257
|
return {
|
|
238
258
|
async *[Symbol.asyncIterator]() {
|
|
239
|
-
const
|
|
259
|
+
const { run, yielded, beforeClose } = rule.iterate?.() ?? AS_IS;
|
|
260
|
+
const iterator = run(() => source[Symbol.asyncIterator]());
|
|
240
261
|
for (;;) {
|
|
241
|
-
const step = await
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
262
|
+
const step = await run(() => iterator.next());
|
|
263
|
+
if (step.done) {
|
|
264
|
+
const last = beforeClose();
|
|
265
|
+
if (last !== undefined) yield last;
|
|
266
|
+
// The return value travels too (Flight sends it in the close row).
|
|
267
|
+
return run(() => walk(step.value, rule, seen));
|
|
268
|
+
}
|
|
269
|
+
yield yielded(run(() => walk(step.value, rule, seen)));
|
|
245
270
|
}
|
|
246
271
|
},
|
|
247
272
|
};
|
package/src/server/types.ts
CHANGED
|
@@ -107,8 +107,8 @@ export type SegmentLifetime = 'request' | 'document';
|
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* The request inputs a `'document'` segment depends on — and the only ones it
|
|
110
|
-
* may read.
|
|
111
|
-
* codec. See design/53-segment-lifetime.md §"Segment keys".
|
|
110
|
+
* may read. Params, search params and cookies are compared after parsing,
|
|
111
|
+
* through each definition's codec; headers as `Headers.get` returns them. See design/53-segment-lifetime.md §"Segment keys".
|
|
112
112
|
*/
|
|
113
113
|
export interface SegmentKey {
|
|
114
114
|
/**
|
|
@@ -120,6 +120,12 @@ export interface SegmentKey {
|
|
|
120
120
|
searchParams?: SearchParamsDefinition<Record<string, unknown>>;
|
|
121
121
|
/** Cookie definitions (`defineCookie`). Default: none. */
|
|
122
122
|
cookies?: readonly ServerOnlyCookieDefinition<unknown>[];
|
|
123
|
+
/**
|
|
124
|
+
* Request header names, matched case-insensitively; values compared as
|
|
125
|
+
* `Headers.get` returns them (trimmed, repeats joined). Default: none. `cookie` (use `cookies`) and credential headers
|
|
126
|
+
* (`authorization`, `proxy-authorization`, `x-api-key`) fail the build.
|
|
127
|
+
*/
|
|
128
|
+
headers?: readonly string[];
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
/** Options for a `page.tsx`: `export const pageOptions = { … } satisfies PageOptions`. */
|
|
@@ -31,6 +31,7 @@ import type { StatusPageMarker } from '../client/status-page-marker.tsx';
|
|
|
31
31
|
import type { SlotOutlet } from '../client/slot-outlet.tsx';
|
|
32
32
|
import type { SlotsProvider } from '../client/slot-provider.tsx';
|
|
33
33
|
import type { DenyLastResort } from '../client/deny-last-resort.tsx';
|
|
34
|
+
import type { DocumentWithdrawal } from '../client/document-withdrawal.tsx';
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* plugin-rsc's Flight runtime, as `rsc-runtime/rsc.ts` adapts it, typed as
|
|
@@ -38,24 +39,13 @@ import type { DenyLastResort } from '../client/deny-last-resort.tsx';
|
|
|
38
39
|
* decoder; the runtime only ever passes a stream and inspects the result, and
|
|
39
40
|
* the narrower type is what a test double can satisfy.
|
|
40
41
|
*/
|
|
41
|
-
/**
|
|
42
|
-
* The decode half of Flight's temporary references: each `$T<id>` in the
|
|
43
|
-
* stream is replaced by `get('$' + id)`. React's client reads only `get`.
|
|
44
|
-
*/
|
|
45
|
-
export interface TemporaryReferenceLookup {
|
|
46
|
-
get(key: string): unknown;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
42
|
export interface RscFlightRuntime {
|
|
50
43
|
renderFlight: typeof FlightAdapter.renderFlight;
|
|
51
44
|
loadServerAction: typeof FlightAdapter.loadServerAction;
|
|
52
45
|
decodeReply: typeof FlightAdapter.decodeReply;
|
|
53
46
|
decodeAction: typeof FlightAdapter.decodeAction;
|
|
54
47
|
decodeFormState: typeof FlightAdapter.decodeFormState;
|
|
55
|
-
createFromReadableStream: (
|
|
56
|
-
stream: ReadableStream<Uint8Array>,
|
|
57
|
-
options?: { temporaryReferences?: TemporaryReferenceLookup }
|
|
58
|
-
) => Promise<unknown>;
|
|
48
|
+
createFromReadableStream: (stream: ReadableStream<Uint8Array>) => Promise<unknown>;
|
|
59
49
|
}
|
|
60
50
|
|
|
61
51
|
/**
|
|
@@ -73,6 +63,7 @@ export interface RscClientComponents {
|
|
|
73
63
|
SlotOutlet: typeof SlotOutlet;
|
|
74
64
|
SlotsProvider: typeof SlotsProvider;
|
|
75
65
|
DenyLastResort: typeof DenyLastResort;
|
|
66
|
+
DocumentWithdrawal: typeof DocumentWithdrawal;
|
|
76
67
|
}
|
|
77
68
|
|
|
78
69
|
export interface RscViteHandoff {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which request headers a `'document'` segment's key may name
|
|
3
|
+
* (design/53-segment-lifetime.md §"Segment keys"). One rule for the build
|
|
4
|
+
* (`routing/route-options.ts`), which reports it from source, and for the
|
|
5
|
+
* runtime (`server/segment-lifetime/segment-key.ts`), which refuses it too —
|
|
6
|
+
* the build cannot read every file kind (MDX pages are not linted), and a
|
|
7
|
+
* credential must not become keyable by skipping the lint.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** RFC 9110 §5.6.2 `token`: what a header field name may be. */
|
|
11
|
+
const HEADER_NAME = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Headers a key may not name. `cookie` is read through cookie definitions
|
|
15
|
+
* (`key.cookies`). Credentials are secret, and a key answers guesses about
|
|
16
|
+
* its values to whoever holds a digest (design/53 §"The key digest").
|
|
17
|
+
*/
|
|
18
|
+
const CREDENTIAL = 'It carries a credential, and a key must not hold secret values.';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A `Map`, not an object literal: a header may be named `constructor` or
|
|
22
|
+
* `__proto__`, and an index lookup would find `Object.prototype`'s.
|
|
23
|
+
*/
|
|
24
|
+
const UNKEYABLE_HEADERS: ReadonlyMap<string, string> = new Map([
|
|
25
|
+
['cookie', 'Key on cookie definitions with key.cookies instead.'],
|
|
26
|
+
['authorization', CREDENTIAL],
|
|
27
|
+
['proxy-authorization', CREDENTIAL],
|
|
28
|
+
['x-api-key', CREDENTIAL],
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
/** Why a key may not name `name`, or undefined when it may. */
|
|
32
|
+
export function headerKeyProblem(name: string): string | undefined {
|
|
33
|
+
if (!HEADER_NAME.test(name))
|
|
34
|
+
return `key.headers names "${name}", which is not a valid header name.`;
|
|
35
|
+
const refused = UNKEYABLE_HEADERS.get(name.toLowerCase());
|
|
36
|
+
return refused ? `key.headers may not name "${name}". ${refused}` : undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Whether a key may never name `name` (case-insensitive): a cookie or credential header. */
|
|
40
|
+
export function isUnkeyableHeader(name: string): boolean {
|
|
41
|
+
return UNKEYABLE_HEADERS.has(name.toLowerCase());
|
|
42
|
+
}
|
|
@@ -1,75 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What the server decided for one `SegmentOutlet` — the wire contract
|
|
3
|
-
* between the outlet gate (server/segment-
|
|
4
|
-
* outlet (client/segment-outlet.tsx).
|
|
3
|
+
* between the outlet gate (server/segment-lifetime/outlet-gate.ts) and the
|
|
4
|
+
* client outlet (client/segment-outlet.tsx).
|
|
5
5
|
*
|
|
6
6
|
* A segment is either sent or skipped:
|
|
7
7
|
*
|
|
8
|
-
* - **Live** — `children` is the segment's content. `
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* the
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* - **Skip** — the client already holds content with this `hash`, and the
|
|
17
|
-
* server just produced identical output; or, for a `'document'` segment,
|
|
18
|
-
* the client holds content rendered under this `digest` and the request's
|
|
19
|
-
* key values still match it, so the server did not render the segment at
|
|
20
|
-
* all. `outlets` carries the decisions for the segments nested directly
|
|
21
|
-
* inside it, because the client renders its cached copy of this segment
|
|
22
|
-
* and that copy still holds the old ones.
|
|
8
|
+
* - **Live** — `children` is the segment's content. A `'document'` segment
|
|
9
|
+
* (design/53-segment-lifetime.md) also carries `digest`: the key digest it
|
|
10
|
+
* rendered under.
|
|
11
|
+
* - **Skip** — only a `'document'` segment: the client holds content rendered
|
|
12
|
+
* under this `digest` and the request's key values still match it, so the
|
|
13
|
+
* server did not render the segment at all. `outlets` carries the decisions
|
|
14
|
+
* for the segments nested directly inside it, because the client renders
|
|
15
|
+
* its cached copy of this segment and that copy still holds the old ones.
|
|
23
16
|
*
|
|
24
|
-
*
|
|
25
|
-
* render the segment once before deciding, and as a plain value otherwise.
|
|
26
|
-
*
|
|
27
|
-
* See design/52-segment-hash-dedupe.md §"Wire format".
|
|
17
|
+
* See design/53-segment-lifetime.md §"Skipping".
|
|
28
18
|
*/
|
|
29
19
|
|
|
30
20
|
import type { ReactNode } from 'react';
|
|
31
21
|
|
|
32
|
-
export type OutletDecision = LiveDecision |
|
|
22
|
+
export type OutletDecision = LiveDecision | DocumentSkip;
|
|
33
23
|
|
|
34
24
|
export interface LiveDecision {
|
|
35
25
|
skip?: undefined;
|
|
36
|
-
hash?: PromiseLike<string | null>;
|
|
37
26
|
/** The key digest of a `'document'` segment's content. */
|
|
38
27
|
digest?: string;
|
|
39
28
|
children: ReactNode;
|
|
40
29
|
}
|
|
41
30
|
|
|
42
|
-
export type SkipDecision = HashSkip | DocumentSkip;
|
|
43
|
-
|
|
44
|
-
/** A segment the server rendered and found identical to what the client holds. */
|
|
45
|
-
export interface HashSkip {
|
|
46
|
-
skip: true;
|
|
47
|
-
hash: string;
|
|
48
|
-
digest?: undefined;
|
|
49
|
-
/** The decisions of the segments nested directly inside, by segment path. */
|
|
50
|
-
outlets: Record<string, OutletDecisionValue>;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
31
|
/** A `'document'` segment whose key is unchanged: never rendered. */
|
|
54
32
|
export interface DocumentSkip {
|
|
55
33
|
skip: true;
|
|
56
|
-
hash?: undefined;
|
|
57
34
|
digest: string;
|
|
58
35
|
/** The decisions of the segments nested directly inside, by segment path. */
|
|
59
|
-
outlets: Record<string,
|
|
36
|
+
outlets: Record<string, OutletDecision>;
|
|
60
37
|
}
|
|
61
38
|
|
|
62
|
-
/**
|
|
63
|
-
* What a nested outlet carries inside a segment-hash capture, in place of a
|
|
64
|
-
* decision: an opaque marker Flight writes as a temporary reference and the
|
|
65
|
-
* capture's decoder replaces with the real decision. Never reaches a client.
|
|
66
|
-
*/
|
|
67
|
-
export interface CaptureHole {
|
|
68
|
-
readonly captureHole: true;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/** A decision as an outlet receives it. */
|
|
72
|
-
export type OutletDecisionValue = OutletDecision | PromiseLike<OutletDecision>;
|
|
73
|
-
|
|
74
39
|
/** The `segmentPath` of the metadata outlet — one per payload. */
|
|
75
40
|
export const METADATA_OUTLET_PATH = '#metadata';
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* 1. **A provider inside the payload cannot reach a skipped segment.** A
|
|
13
13
|
* segment the server skipped renders the content the client cached for it
|
|
14
|
-
* (design/
|
|
14
|
+
* (design/53-segment-lifetime.md), and that copy carries whatever was
|
|
15
15
|
* inside it when it was committed — never the incoming route's provider.
|
|
16
16
|
* Params belong to the *navigation*, so the provider has to be owned by the
|
|
17
17
|
* client, above the payload root, and there must be exactly one.
|
|
@@ -35,10 +35,8 @@ export interface SegmentInfo {
|
|
|
35
35
|
/**
|
|
36
36
|
* The client's `X-Timber-State-Tree` request header.
|
|
37
37
|
*
|
|
38
|
-
* `
|
|
39
|
-
*
|
|
40
|
-
* `clientSegmentCache` (design/52-segment-hash-dedupe.md). `treePaths` is
|
|
41
|
-
* not caching: it describes the *shape* of the tree currently on screen, so
|
|
38
|
+
* `documents` are the key digests of the `'document'` segments the client
|
|
39
|
+
* holds. `treePaths` is not caching: it describes the *shape* of the tree currently on screen, so
|
|
42
40
|
* the server can answer "does the rendered route pass through the segment
|
|
43
41
|
* that owns this intercepting slot?" without re-deriving it from the address
|
|
44
42
|
* bar, which stops being the source route the moment a modal is open
|
|
@@ -47,11 +45,9 @@ export interface SegmentInfo {
|
|
|
47
45
|
* Neither is a security input. Every `access.ts` runs regardless.
|
|
48
46
|
*/
|
|
49
47
|
export interface StateTree {
|
|
50
|
-
hashes?: Record<string, string>;
|
|
51
48
|
/**
|
|
52
49
|
* The key digests of the `'document'` segments the client holds, by outlet
|
|
53
|
-
* path (design/53-segment-lifetime.md).
|
|
54
|
-
* not; left out of the `_rsc` cache key.
|
|
50
|
+
* path (design/53-segment-lifetime.md). Left out of the `_rsc` cache key.
|
|
55
51
|
*/
|
|
56
52
|
documents?: Record<string, string>;
|
|
57
53
|
treePaths?: string[];
|