@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,7 +12,7 @@
|
|
|
12
12
|
* smuggling primitive that the encoding contract closes.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { checkCookieRead, checkUnscopedRead } from './segment-lifetime/read-rule.ts';
|
|
16
16
|
import { COOKIE_READ_THROUGH, type CookieReadThrough } from '../shared/cookie-read-through.ts';
|
|
17
17
|
import { requestContextAls, type RequestContextStore } from './als-registry.ts';
|
|
18
18
|
import { isDebug } from './debug.ts';
|
|
@@ -80,29 +80,29 @@ export function getCookieJar(): RequestCookies {
|
|
|
80
80
|
// warn if React.cache may have memoized the old value (TIM-1529 D3).
|
|
81
81
|
// Inside a 'document' segment, only the cookies in its key (design/53).
|
|
82
82
|
get(name: string): string | undefined {
|
|
83
|
-
|
|
83
|
+
checkCookieRead(name);
|
|
84
84
|
noteCookieReadForReactCache(name);
|
|
85
85
|
return map.get(name);
|
|
86
86
|
},
|
|
87
87
|
// A typed definition's read: allowed for a keyed cookie read through the
|
|
88
88
|
// key's own definition (shared/cookie-read-through.ts).
|
|
89
89
|
[COOKIE_READ_THROUGH](name: string, codec: unknown): string | undefined {
|
|
90
|
-
|
|
90
|
+
checkCookieRead(name, codec);
|
|
91
91
|
noteCookieReadForReactCache(name);
|
|
92
92
|
return map.get(name);
|
|
93
93
|
},
|
|
94
94
|
has(name: string): boolean {
|
|
95
|
-
|
|
95
|
+
checkCookieRead(name);
|
|
96
96
|
noteCookieReadForReactCache(name);
|
|
97
97
|
return map.has(name);
|
|
98
98
|
},
|
|
99
99
|
getAll(): Array<{ name: string; value: string }> {
|
|
100
|
-
|
|
100
|
+
checkUnscopedRead('every cookie');
|
|
101
101
|
noteCookieReadForReactCache(ANY_COOKIE);
|
|
102
102
|
return Array.from(map.entries()).map(([name, value]) => ({ name, value }));
|
|
103
103
|
},
|
|
104
104
|
get size(): number {
|
|
105
|
-
|
|
105
|
+
checkUnscopedRead('the number of cookies');
|
|
106
106
|
noteCookieReadForReactCache(ANY_COOKIE);
|
|
107
107
|
return map.size;
|
|
108
108
|
},
|
|
@@ -248,7 +248,7 @@ export function getCookieJar(): RequestCookies {
|
|
|
248
248
|
},
|
|
249
249
|
|
|
250
250
|
toString(): string {
|
|
251
|
-
|
|
251
|
+
checkUnscopedRead('every cookie');
|
|
252
252
|
noteCookieReadForReactCache(ANY_COOKIE);
|
|
253
253
|
// Re-encode values when serializing as a Cookie header — the
|
|
254
254
|
// RYW map holds decoded logical values, but a Cookie header has
|
|
@@ -43,6 +43,7 @@ import { isDenySignal } from './signal-identity.ts';
|
|
|
43
43
|
import { loadFallbackModule } from './pipeline-helpers.ts';
|
|
44
44
|
import type { ManifestLoader } from './safe-load.ts';
|
|
45
45
|
import { withSpan } from './tracing.ts';
|
|
46
|
+
import { fallbackAfter } from './segment-lifetime/read-scope.ts';
|
|
46
47
|
import { isValidElementType, type LoadedComponent } from './utils/element-type.ts';
|
|
47
48
|
import type { ManifestSegmentNode } from './route-matcher.ts';
|
|
48
49
|
|
|
@@ -426,7 +427,9 @@ export function handleCaughtDeny(
|
|
|
426
427
|
|
|
427
428
|
if (placement?.kind === 'render') {
|
|
428
429
|
setDenyStatus(error.status);
|
|
429
|
-
|
|
430
|
+
// A deny from a 'document' segment that read outside its key: the page
|
|
431
|
+
// must not be kept under the key digest (design/53 §"Reads outside the key").
|
|
432
|
+
return fallbackAfter(error, placement.element);
|
|
430
433
|
}
|
|
431
434
|
if (placement?.kind === 'hoist') {
|
|
432
435
|
setDenyStatus(error.status);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reports a problem the request survived to the dev server's error overlay.
|
|
3
|
+
*
|
|
4
|
+
* The dev server hands the RSC entry its overlay through `setDevHooks`
|
|
5
|
+
* (`plugins/dev-server.ts`); the entry sets the reporter here, so render code
|
|
6
|
+
* that cannot see the entry can still report. Unset in production, in tests,
|
|
7
|
+
* and under any server that is not timber's dev server: the caller logs instead.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
let reporter: ((error: Error) => void) | undefined;
|
|
11
|
+
|
|
12
|
+
/** Set (or clear) the reporter. Called by the RSC entry's `setDevHooks`. */
|
|
13
|
+
export function setDevOverlayReporter(report: ((error: Error) => void) | undefined): void {
|
|
14
|
+
reporter = report;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Report `error` to the overlay; false when no dev server is listening. */
|
|
18
|
+
export function reportToDevOverlay(error: Error): boolean {
|
|
19
|
+
if (!reporter) return false;
|
|
20
|
+
reporter(error);
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
@@ -73,8 +73,6 @@ export interface NodeFlightAbort {
|
|
|
73
73
|
signal?: AbortSignal;
|
|
74
74
|
/** Abort with a `RenderTimeoutError` after this long, if still rendering. */
|
|
75
75
|
timeoutMs?: number;
|
|
76
|
-
/** Shown every chunk, and the end (`FlightRenderOptions.tap`). */
|
|
77
|
-
tap?: { observe(chunk: Uint8Array): void; end(): void };
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
/**
|
|
@@ -95,7 +93,7 @@ export interface NodeFlightAbort {
|
|
|
95
93
|
*/
|
|
96
94
|
export function pipeFlightToNode(
|
|
97
95
|
flight: PipeableFlight,
|
|
98
|
-
{ signal, timeoutMs
|
|
96
|
+
{ signal, timeoutMs }: NodeFlightAbort
|
|
99
97
|
): Readable {
|
|
100
98
|
const scope = new AbortController();
|
|
101
99
|
const timer =
|
|
@@ -109,11 +107,9 @@ export function pipeFlightToNode(
|
|
|
109
107
|
objectMode: true,
|
|
110
108
|
transform(chunk: NodeFlightChunk, _encoding, callback) {
|
|
111
109
|
const out = typeof chunk === 'string' ? chunk.toWellFormed() : chunk;
|
|
112
|
-
tap?.observe(typeof out === 'string' ? Buffer.from(out) : out);
|
|
113
110
|
callback(null, out);
|
|
114
111
|
},
|
|
115
112
|
destroy(error, callback) {
|
|
116
|
-
tap?.end();
|
|
117
113
|
endScope(scope);
|
|
118
114
|
clearTimeout(timer);
|
|
119
115
|
// Flight ended the stream (React calls `end()` once the render is
|
|
@@ -25,7 +25,6 @@ import type { Readable } from 'node:stream';
|
|
|
25
25
|
import { isAppStackFrame } from './framework-stack-frames.ts';
|
|
26
26
|
import { nodeStreamsPlatform } from './node-streams-platform.ts';
|
|
27
27
|
import { releaseReason } from './render-utils.ts';
|
|
28
|
-
import { withTimeout } from './render-timeout.ts';
|
|
29
28
|
import {
|
|
30
29
|
concatBytes,
|
|
31
30
|
drainWithDeadline,
|
|
@@ -76,30 +75,6 @@ export interface FlightRenderOptions {
|
|
|
76
75
|
* themselves.
|
|
77
76
|
*/
|
|
78
77
|
timeoutMs?: number;
|
|
79
|
-
/**
|
|
80
|
-
* Observes every chunk the render writes, and its end — the segment hash
|
|
81
|
-
* tap (segment-hash/stream-tap.ts). Chunks pass through unchanged.
|
|
82
|
-
*/
|
|
83
|
-
tap?: FlightTap;
|
|
84
|
-
/**
|
|
85
|
-
* Values to write as opaque references (`$T<id>`) instead of serializing —
|
|
86
|
-
* Flight's temporary references, keyed by the value. A segment-hash capture
|
|
87
|
-
* writes its nested outlets this way so decoding it can put the live outlet
|
|
88
|
-
* back (segment-hash/capture.ts).
|
|
89
|
-
*/
|
|
90
|
-
temporaryReferences?: WeakMap<object, string>;
|
|
91
|
-
/**
|
|
92
|
-
* Prefix for the ids `useId()` returns in server components. Each render
|
|
93
|
-
* counts from zero, so two renders whose output shares one document — the
|
|
94
|
-
* main render and a segment-hash capture — need different prefixes.
|
|
95
|
-
*/
|
|
96
|
-
identifierPrefix?: string;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/** An observer of a Flight render's output. */
|
|
100
|
-
export interface FlightTap {
|
|
101
|
-
observe(chunk: Uint8Array): void;
|
|
102
|
-
end(): void;
|
|
103
78
|
}
|
|
104
79
|
|
|
105
80
|
/**
|
|
@@ -125,8 +100,6 @@ export type WebFlightRenderer = (
|
|
|
125
100
|
options?: {
|
|
126
101
|
onError?: (error: unknown) => string | void;
|
|
127
102
|
signal?: AbortSignal;
|
|
128
|
-
temporaryReferences?: WeakMap<object, string>;
|
|
129
|
-
identifierPrefix?: string;
|
|
130
103
|
filterStackFrame?: (url: string, functionName: string) => boolean;
|
|
131
104
|
}
|
|
132
105
|
) => ReadableStream<Uint8Array>;
|
|
@@ -136,8 +109,6 @@ export type NodeFlightRenderer = (
|
|
|
136
109
|
model: unknown,
|
|
137
110
|
options?: {
|
|
138
111
|
onError?: (error: unknown) => string | void;
|
|
139
|
-
temporaryReferences?: WeakMap<object, string>;
|
|
140
|
-
identifierPrefix?: string;
|
|
141
112
|
filterStackFrame?: (url: string, functionName: string) => boolean;
|
|
142
113
|
}
|
|
143
114
|
) => import('./flight-source-node.ts').PipeableFlight;
|
|
@@ -164,14 +135,11 @@ export function createRenderFlight(
|
|
|
164
135
|
stream: pipeFlightToNode(
|
|
165
136
|
node(model, {
|
|
166
137
|
onError: options.onError,
|
|
167
|
-
temporaryReferences: options.temporaryReferences,
|
|
168
|
-
identifierPrefix: options.identifierPrefix,
|
|
169
138
|
filterStackFrame: isAppStackFrame,
|
|
170
139
|
}),
|
|
171
140
|
{
|
|
172
141
|
signal: options.signal,
|
|
173
142
|
timeoutMs: options.timeoutMs ?? defaultRenderTimeoutMs,
|
|
174
|
-
tap: options.tap,
|
|
175
143
|
}
|
|
176
144
|
),
|
|
177
145
|
});
|
|
@@ -180,60 +148,12 @@ export function createRenderFlight(
|
|
|
180
148
|
const stream = web(model, {
|
|
181
149
|
onError: options.onError,
|
|
182
150
|
signal: options.signal,
|
|
183
|
-
temporaryReferences: options.temporaryReferences,
|
|
184
|
-
identifierPrefix: options.identifierPrefix,
|
|
185
151
|
filterStackFrame: isAppStackFrame,
|
|
186
152
|
});
|
|
187
|
-
|
|
188
|
-
return {
|
|
189
|
-
kind: 'web',
|
|
190
|
-
stream: options.tap ? tapWebFlight(stream, options.tap, timeoutMs) : stream,
|
|
191
|
-
};
|
|
153
|
+
return { kind: 'web', stream };
|
|
192
154
|
};
|
|
193
155
|
}
|
|
194
156
|
|
|
195
|
-
/**
|
|
196
|
-
* Pass a Web Flight stream through unchanged, showing each chunk to `tap`,
|
|
197
|
-
* and its end — whether it finished, failed, or was cancelled.
|
|
198
|
-
*/
|
|
199
|
-
function tapWebFlight(
|
|
200
|
-
source: ReadableStream<Uint8Array>,
|
|
201
|
-
tap: FlightTap,
|
|
202
|
-
timeoutMs: number | undefined
|
|
203
|
-
): ReadableStream<Uint8Array> {
|
|
204
|
-
const reader = source.getReader();
|
|
205
|
-
// The wrapper reads upstream, so its reads are guarded like every stream
|
|
206
|
-
// read (design/02 §"Always Timeout-Guard Stream Reads"): one deadline for
|
|
207
|
-
// the whole render, after which the upstream is cancelled.
|
|
208
|
-
const deadline = timeoutMs === undefined ? undefined : Date.now() + timeoutMs;
|
|
209
|
-
return new ReadableStream<Uint8Array>({
|
|
210
|
-
async pull(controller) {
|
|
211
|
-
try {
|
|
212
|
-
const read = reader.read();
|
|
213
|
-
const result =
|
|
214
|
-
deadline === undefined
|
|
215
|
-
? await read
|
|
216
|
-
: await withTimeout(read, Math.max(0, deadline - Date.now()), 'Flight render');
|
|
217
|
-
if (result.done) {
|
|
218
|
-
tap.end();
|
|
219
|
-
controller.close();
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
tap.observe(result.value);
|
|
223
|
-
controller.enqueue(result.value);
|
|
224
|
-
} catch (error) {
|
|
225
|
-
tap.end();
|
|
226
|
-
reader.cancel(releaseReason(error)).catch(() => {});
|
|
227
|
-
controller.error(error);
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
cancel(reason) {
|
|
231
|
-
tap.end();
|
|
232
|
-
return reader.cancel(releaseReason(reason));
|
|
233
|
-
},
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
|
|
237
157
|
// ─── Reading ────────────────────────────────────────────────────────────────
|
|
238
158
|
|
|
239
159
|
/** A pull reader over a Flight source, of either kind. */
|
|
@@ -7,10 +7,7 @@
|
|
|
7
7
|
* `node_modules` as app code. Installed, timber sits in `node_modules`; run
|
|
8
8
|
* from source (this repo, its examples, a linked checkout) its own files would
|
|
9
9
|
* count as app code, and its internal awaits would be written into every dev
|
|
10
|
-
* payload.
|
|
11
|
-
* segment's decoded content, so a skipped segment's content would be sent as
|
|
12
|
-
* the debug value of the read a decision chained through
|
|
13
|
-
* (design/52-segment-hash-dedupe.md §"Capture").
|
|
10
|
+
* payload.
|
|
14
11
|
*
|
|
15
12
|
* Next.js passes its own `filterStackFrameDEV` for the same reason; its code
|
|
16
13
|
* is always in `node_modules`, so it filters by source map instead.
|
package/src/server/logger.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { generateTraceId, getTraceStore } from './tracing.ts';
|
|
12
12
|
import { createDefaultLogger } from './default-logger.ts';
|
|
13
13
|
import { isDevMode } from './debug.ts';
|
|
14
|
+
import { reportToDevOverlay } from './dev-overlay-report.ts';
|
|
14
15
|
import { isControlFlowSignal } from './signal-identity.ts';
|
|
15
16
|
import type { CsrfRejectReason } from './csrf.ts';
|
|
16
17
|
|
|
@@ -86,6 +87,18 @@ export function logCsrfRejected(
|
|
|
86
87
|
_logger.warn(`CSRF origin check failed: ${detail}`, fields);
|
|
87
88
|
}
|
|
88
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Report a `'document'` segment's read outside its key. The render survives
|
|
92
|
+
* it: the segment degrades to `'request'` for the client that rendered it
|
|
93
|
+
* (design/53-segment-lifetime.md §"Reads outside the key"). Under the dev
|
|
94
|
+
* server it goes to the error overlay, which also prints it; otherwise it is
|
|
95
|
+
* logged at warn, and this line is the only sign the key is wrong.
|
|
96
|
+
*/
|
|
97
|
+
export function logDocumentReadOutsideKey(error: Error, data: { segment: string }): void {
|
|
98
|
+
if (reportToDevOverlay(error)) return;
|
|
99
|
+
_logger.warn(error.message, withTraceContext(data));
|
|
100
|
+
}
|
|
101
|
+
|
|
89
102
|
/** Log a completed request. Level: info. */
|
|
90
103
|
export function logRequestCompleted(data: {
|
|
91
104
|
method: string;
|
|
@@ -258,7 +258,7 @@ export function resolveInterceptedRoute(
|
|
|
258
258
|
// `[…owner ancestors, interceptingNode, …descendants]`, which renders
|
|
259
259
|
// as an ordinary route. `interception` stays unset — there is no slot
|
|
260
260
|
// to intercept into, and setting it would additionally arm the modal
|
|
261
|
-
// path for
|
|
261
|
+
// path for the owner's slots, which the swap does not render into.
|
|
262
262
|
//
|
|
263
263
|
// A null here means the scope named nothing in this manifest, or no
|
|
264
264
|
// intercepting child matched the target. Both fall through to the
|
|
@@ -278,12 +278,21 @@ export function resolveInterceptedRoute(
|
|
|
278
278
|
// a valid tree: the rewrite hijacks the navigation and no slot exists
|
|
279
279
|
// to render the intercepting page. Fall through to the canonical
|
|
280
280
|
// target route instead.
|
|
281
|
+
//
|
|
282
|
+
// Passing through the scope is enough: the owner is then on the chain
|
|
283
|
+
// with its layout, because the build rejects a slot whose owner has no
|
|
284
|
+
// layout (`validateSlotPlacement`, TIM-1443) — and only the winning
|
|
285
|
+
// owner's slots intercept, so a winner that could not resolve its
|
|
286
|
+
// slots would render the source page with no modal at all.
|
|
281
287
|
const rendersTheSlot =
|
|
282
288
|
sourceMatch !== null &&
|
|
283
289
|
computeSegmentTreePaths(sourceMatch.segments).includes(rewrite.interceptingScope);
|
|
284
290
|
if (rendersTheSlot) {
|
|
285
291
|
match = sourceMatch;
|
|
286
|
-
interception = {
|
|
292
|
+
interception = {
|
|
293
|
+
targetPathname: canonicalPathname,
|
|
294
|
+
interceptingScope: rewrite.interceptingScope,
|
|
295
|
+
};
|
|
287
296
|
}
|
|
288
297
|
}
|
|
289
298
|
}
|
package/src/server/pipeline.ts
CHANGED
|
@@ -99,10 +99,22 @@ export type MetadataRouteMatcher = (
|
|
|
99
99
|
pathname: string
|
|
100
100
|
) => import('./route-matcher.ts').MetadataRouteMatch | null;
|
|
101
101
|
|
|
102
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* The pipeline's decision for a modal-shape interception — which rewrite won,
|
|
104
|
+
* stated once, for the slot resolver to consume rather than re-derive.
|
|
105
|
+
*/
|
|
103
106
|
export interface InterceptionContext {
|
|
104
107
|
/** The URL the user is navigating TO (the intercepted route). */
|
|
105
108
|
targetPathname: string;
|
|
109
|
+
/**
|
|
110
|
+
* The winning rewrite's `interceptingScope`: the tree path of the segment
|
|
111
|
+
* whose slots hold the interception. Only that owner's slots intercept. The
|
|
112
|
+
* re-matched chain can pass through other owners with interceptors for the
|
|
113
|
+
* same URL — `app/@modal/(...)photo` above `app/feed/@modal/(..)photo` —
|
|
114
|
+
* and those lost the deepest-scope ranking, so they render as on any other
|
|
115
|
+
* navigation (TIM-1443, design/07-routing.md §"Selection Between Owners").
|
|
116
|
+
*/
|
|
117
|
+
interceptingScope: string;
|
|
106
118
|
}
|
|
107
119
|
|
|
108
120
|
/** Function that renders a matched route into a Response. */
|
|
@@ -34,8 +34,10 @@ import {
|
|
|
34
34
|
import { isDebug } from './debug.ts';
|
|
35
35
|
import { runWithReactCacheScope, type ReactCacheScope } from './react-cache-scope.ts';
|
|
36
36
|
import {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
checkSearchParamsRead,
|
|
38
|
+
checkUnscopedRead,
|
|
39
|
+
currentReadScope,
|
|
40
|
+
keyedHeaders,
|
|
39
41
|
scopedParams,
|
|
40
42
|
} from './segment-lifetime/read-rule.ts';
|
|
41
43
|
import type { ReactFormState } from 'react-dom/client';
|
|
@@ -59,11 +61,10 @@ export function getHeaders(): ReadonlyHeaders {
|
|
|
59
61
|
'It can only be used in middleware, access checks, server components, and server actions.'
|
|
60
62
|
);
|
|
61
63
|
}
|
|
62
|
-
// A 'document' segment may
|
|
63
|
-
// which
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return store.headers;
|
|
64
|
+
// A 'document' segment may read only the headers in its key — never all of
|
|
65
|
+
// them, which would include the pathname (design/53).
|
|
66
|
+
const scope = currentReadScope();
|
|
67
|
+
return scope ? keyedHeaders(store.headers, scope) : store.headers;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
/**
|
|
@@ -98,8 +99,8 @@ export function getSearchParams(reader?: SearchParamsReader): URLSearchParams {
|
|
|
98
99
|
}
|
|
99
100
|
// A definition's `.get()` passes what it parses; a 'document' segment may
|
|
100
101
|
// read only fields its key reads the same way, and never the raw params.
|
|
101
|
-
if (reader)
|
|
102
|
-
else
|
|
102
|
+
if (reader) checkSearchParamsRead(reader);
|
|
103
|
+
else checkUnscopedRead('the raw search params');
|
|
103
104
|
|
|
104
105
|
return store.searchParams;
|
|
105
106
|
}
|
|
@@ -148,7 +149,7 @@ export function getSegmentParams(segmentPath?: string): CoercedParams {
|
|
|
148
149
|
// client's useSegmentParams() also reads, so the two halves of one
|
|
149
150
|
// documented API cannot drift (TIM-1285).
|
|
150
151
|
const slotResolved = resolveSegmentParams(store.segmentParams, store.slotParams, segmentPath);
|
|
151
|
-
// Inside a 'document' segment, a param outside its key
|
|
152
|
+
// Inside a 'document' segment, a param outside its key is refused (design/53).
|
|
152
153
|
if (slotResolved !== store.segmentParams) return scopedParams(slotResolved);
|
|
153
154
|
|
|
154
155
|
// Dev-mode validation: warn when the segment path expects dynamic
|
|
@@ -341,7 +342,7 @@ export function getRequestSearchString(): string {
|
|
|
341
342
|
const store = requestContextAls.getStore();
|
|
342
343
|
// A 'document' segment's redirect cannot carry search params outside its
|
|
343
344
|
// key (design/53): what it redirects to would freeze.
|
|
344
|
-
if (store)
|
|
345
|
+
if (store) checkUnscopedRead('the raw search params');
|
|
345
346
|
return store?.searchString ?? '';
|
|
346
347
|
}
|
|
347
348
|
|
|
@@ -47,7 +47,7 @@ import { documentOutletFor, pathParamNames } from './segment-lifetime/document-o
|
|
|
47
47
|
import { getSegmentParams } from './request-context.ts';
|
|
48
48
|
import { inReadScope, readScopeFor } from './segment-lifetime/read-scope.ts';
|
|
49
49
|
import type { ServerComponent } from './subtree-walk.ts';
|
|
50
|
-
import { outletGate, type OutletSpec, type
|
|
50
|
+
import { outletGate, type OutletSpec, type SegmentRender } from './segment-lifetime/outlet-gate.ts';
|
|
51
51
|
import { METADATA_OUTLET_PATH } from '../shared/outlet-decision.ts';
|
|
52
52
|
import { setFirstDeniedSegmentIndex } from './deny-boundary.ts';
|
|
53
53
|
import { loadModule, type ManifestLoader } from './safe-load.ts';
|
|
@@ -187,7 +187,7 @@ export async function buildRouteElement(
|
|
|
187
187
|
req: Request,
|
|
188
188
|
match: RouteMatch,
|
|
189
189
|
interception: InterceptionContext | undefined,
|
|
190
|
-
render:
|
|
190
|
+
render: SegmentRender,
|
|
191
191
|
metadataRouteHashes?: Record<string, string>
|
|
192
192
|
): Promise<RouteElementResult> {
|
|
193
193
|
const segments = match.segments;
|
|
@@ -237,8 +237,8 @@ export async function buildRouteElement(
|
|
|
237
237
|
// compares against. One derivation, so a slot cannot be keyed two ways.
|
|
238
238
|
const segmentTreePaths = computeSegmentTreePaths(segments);
|
|
239
239
|
|
|
240
|
-
// A 'document' page runs in its read scope: a read outside its key
|
|
241
|
-
// (segment-lifetime/read-scope.ts). A client page never runs on the server.
|
|
240
|
+
// A 'document' page runs in its read scope: a read outside its key is
|
|
241
|
+
// refused (segment-lifetime/read-scope.ts). A client page never runs on the server.
|
|
242
242
|
const PageComponent =
|
|
243
243
|
documentLifetimes.page && !isClientReference(LoadedPage)
|
|
244
244
|
? inReadScope(
|
|
@@ -331,7 +331,7 @@ export async function buildRouteElement(
|
|
|
331
331
|
mainParams
|
|
332
332
|
),
|
|
333
333
|
};
|
|
334
|
-
element = outletGate(pageOutlet
|
|
334
|
+
element = outletGate(pageOutlet);
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
// Metadata is its own outlet, a SIBLING of the page rather than a wrapper.
|
|
@@ -340,8 +340,7 @@ export async function buildRouteElement(
|
|
|
340
340
|
// <head> regardless of tree position. Both resolve before onShellReady
|
|
341
341
|
// (outside Suspense), but they overlap. As its own outlet, a title that
|
|
342
342
|
// changes does not resend the page beside it, and a page's title does not
|
|
343
|
-
// land in the output of
|
|
344
|
-
// own unit"). See TIM-1363, TIM-1367, design/16-metadata.md.
|
|
343
|
+
// land in the output of a 'document' layout above it, which may be skipped. See TIM-1363, TIM-1367, design/16-metadata.md.
|
|
345
344
|
const metadataOutlet: OutletSpec = {
|
|
346
345
|
segmentPath: METADATA_OUTLET_PATH,
|
|
347
346
|
content: h(MetadataHead, {
|
|
@@ -352,7 +351,7 @@ export async function buildRouteElement(
|
|
|
352
351
|
}),
|
|
353
352
|
nested: [],
|
|
354
353
|
};
|
|
355
|
-
element = h(Fragment, null, outletGate(metadataOutlet
|
|
354
|
+
element = h(Fragment, null, outletGate(metadataOutlet), element);
|
|
356
355
|
|
|
357
356
|
// Build a lookup of layout components by segment for O(1) access.
|
|
358
357
|
const layoutBySegment = new Map(
|
|
@@ -362,7 +361,7 @@ export async function buildRouteElement(
|
|
|
362
361
|
// The outlets built so far that no outlet built so far contains — the ones
|
|
363
362
|
// the next outlet out will hold directly. A skipped outlet carries their
|
|
364
363
|
// decisions, because the client's cached copy of it still holds the old
|
|
365
|
-
// ones (segment-
|
|
364
|
+
// ones (segment-lifetime/outlet-gate.ts).
|
|
366
365
|
let unclaimedOutlets: OutletSpec[] = pageOutlet ? [metadataOutlet, pageOutlet] : [metadataOutlet];
|
|
367
366
|
|
|
368
367
|
for (let i = segments.length - 1; i >= 0; i--) {
|
|
@@ -411,8 +410,8 @@ export async function buildRouteElement(
|
|
|
411
410
|
const layoutOutletPath = layoutLifetime ? layoutOutletKey(segmentTreePaths[i]) : segmentId;
|
|
412
411
|
|
|
413
412
|
// Everything this layout receives as `children` is one outlet, and the
|
|
414
|
-
// layout's own outlet below is another:
|
|
415
|
-
// chrome, not what renders under it.
|
|
413
|
+
// layout's own outlet below is another: skipping a 'document' layout
|
|
414
|
+
// skips its chrome, not what renders under it.
|
|
416
415
|
const childrenOutlet: OutletSpec = {
|
|
417
416
|
segmentPath: childrenOutletKey(segmentId),
|
|
418
417
|
content: element,
|
|
@@ -435,7 +434,7 @@ export async function buildRouteElement(
|
|
|
435
434
|
|
|
436
435
|
const segmentPath = computeLayoutSegmentPath(segments, i, match);
|
|
437
436
|
const parallelRouteKeys = Object.keys(segment.slots ?? {});
|
|
438
|
-
const layoutProps = { ...slots.props, children: outletGate(childrenOutlet
|
|
437
|
+
const layoutProps = { ...slots.props, children: outletGate(childrenOutlet) };
|
|
439
438
|
|
|
440
439
|
// Build the layout element.
|
|
441
440
|
// Keep the descendant tree in a SERVER layout's children prop. Moving it
|
|
@@ -526,7 +525,7 @@ export async function buildRouteElement(
|
|
|
526
525
|
segmentPath.length
|
|
527
526
|
),
|
|
528
527
|
};
|
|
529
|
-
element = outletGate(layoutOutlet
|
|
528
|
+
element = outletGate(layoutOutlet);
|
|
530
529
|
unclaimedOutlets = [layoutOutlet];
|
|
531
530
|
}
|
|
532
531
|
|
|
@@ -536,9 +535,9 @@ export async function buildRouteElement(
|
|
|
536
535
|
// exactly once, during render, inside React.cache scope — layouts
|
|
537
536
|
// share the cache. See TIM-1363, design/04-authorization.md.
|
|
538
537
|
//
|
|
539
|
-
// It sits in the enclosing outlet's content,
|
|
540
|
-
//
|
|
541
|
-
//
|
|
538
|
+
// It sits in the enclosing outlet's content, outside a 'document'
|
|
539
|
+
// layout's own outlet, so it runs on every request even when that layout
|
|
540
|
+
// is skipped (design/53 §"access.ts and metadata still run").
|
|
542
541
|
const accessFn = gateFor(i);
|
|
543
542
|
if (accessFn) {
|
|
544
543
|
element = wrapAccessGate(
|
|
@@ -15,7 +15,7 @@ import type { SegmentInfo } from '../../shared/segment-info.ts';
|
|
|
15
15
|
* interception scoping (design/07-routing.md §"Intercepting Routes").
|
|
16
16
|
*
|
|
17
17
|
* Nothing here is about caching — what the client may reuse is decided by
|
|
18
|
-
*
|
|
18
|
+
* the outlet decisions in the payload itself (design/53-segment-lifetime.md).
|
|
19
19
|
*/
|
|
20
20
|
export function buildSegmentInfo(
|
|
21
21
|
segments: ManifestSegmentNode[],
|
|
@@ -92,8 +92,10 @@ import { StatusPageMarker } from '../../client/status-page-marker.tsx';
|
|
|
92
92
|
import { SlotOutlet } from '../../client/slot-outlet.tsx';
|
|
93
93
|
import { SlotsProvider } from '../../client/slot-provider.tsx';
|
|
94
94
|
import { DenyLastResort } from '../../client/deny-last-resort.tsx';
|
|
95
|
+
import { DocumentWithdrawal } from '../../client/document-withdrawal.tsx';
|
|
95
96
|
import { provideRscViteHandoff } from '../vite-handoff-rsc.ts';
|
|
96
97
|
import { markRouteModulesImmutable } from '../safe-load.ts';
|
|
98
|
+
import { setDevOverlayReporter } from '../dev-overlay-report.ts';
|
|
97
99
|
|
|
98
100
|
// Before anything can render: the runtime reads these at call and render
|
|
99
101
|
// time through server/vite-handoff-rsc.ts (design/51-native-dev-runtime.md).
|
|
@@ -117,6 +119,7 @@ provideRscViteHandoff({
|
|
|
117
119
|
SlotOutlet,
|
|
118
120
|
SlotsProvider,
|
|
119
121
|
DenyLastResort,
|
|
122
|
+
DocumentWithdrawal,
|
|
120
123
|
},
|
|
121
124
|
});
|
|
122
125
|
|
|
@@ -145,6 +148,10 @@ let devHooks: DevHooks = {};
|
|
|
145
148
|
*/
|
|
146
149
|
export function setDevHooks(hooks: DevHooks): void {
|
|
147
150
|
devHooks = hooks;
|
|
151
|
+
// Problems a render survives (a 'document' segment's read outside its key)
|
|
152
|
+
// reach the overlay without failing the request.
|
|
153
|
+
const { onPipelineError } = hooks;
|
|
154
|
+
setDevOverlayReporter(onPipelineError && ((error) => onPipelineError(error, 'render')));
|
|
148
155
|
}
|
|
149
156
|
|
|
150
157
|
/**
|
|
@@ -266,8 +273,6 @@ async function createRequestHandler(manifest: typeof routeManifest, runtimeConfi
|
|
|
266
273
|
| { disabled: boolean; enableHMRInDev: boolean }
|
|
267
274
|
| undefined;
|
|
268
275
|
const clientJsDisabled = clientJsConfig?.disabled ?? false;
|
|
269
|
-
const clientSegmentCache =
|
|
270
|
-
((runtimeConfig as Record<string, unknown>).clientSegmentCache as boolean) ?? false;
|
|
271
276
|
// Written by `plugins/entries.ts` as exactly 'request' or 'document'.
|
|
272
277
|
const defaultLayoutLifetime: SegmentLifetime =
|
|
273
278
|
(runtimeConfig as Record<string, unknown>).defaultLayoutLifetime === 'document'
|
|
@@ -393,7 +398,6 @@ async function createRequestHandler(manifest: typeof routeManifest, runtimeConfi
|
|
|
393
398
|
{
|
|
394
399
|
clientBootstrap,
|
|
395
400
|
clientJsDisabled,
|
|
396
|
-
clientSegmentCache,
|
|
397
401
|
keyDigestSigner,
|
|
398
402
|
defaultLayoutLifetime,
|
|
399
403
|
renderDenyFallback,
|