@timber-js/app 0.2.0-alpha.242 → 0.2.0-alpha.244
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-BkwgRwCl.js → actions-D_LiN5xG.js} +57 -39
- package/dist/_chunks/actions-D_LiN5xG.js.map +1 -0
- package/dist/_chunks/als-registry-C-iwbtvI.js.map +1 -1
- package/dist/_chunks/{cache-api-BGA7c5qJ.js → cache-api-D3HmgsFh.js} +4 -4
- package/dist/_chunks/{cache-api-BGA7c5qJ.js.map → cache-api-D3HmgsFh.js.map} +1 -1
- package/dist/_chunks/{chains-Cuwwjv6T.js → chains-BpvDwp08.js} +2 -2
- package/dist/_chunks/{chains-Cuwwjv6T.js.map → chains-BpvDwp08.js.map} +1 -1
- package/dist/_chunks/chains-CjlZZ5ad.js +1 -0
- package/dist/_chunks/{classify-Y8S9C0Na.js → classify-Bbb_lKjH.js} +2 -2
- package/dist/_chunks/{classify-Y8S9C0Na.js.map → classify-Bbb_lKjH.js.map} +1 -1
- package/dist/_chunks/{cli-check-KeE1QaIx.js → cli-check-BE9BnXwi.js} +6 -6
- package/dist/_chunks/cli-check-BE9BnXwi.js.map +1 -0
- package/dist/_chunks/{cli-schema-sync-DZEF31wd.js → cli-schema-sync-CWkGFlYu.js} +2 -2
- package/dist/_chunks/{cli-schema-sync-DZEF31wd.js.map → cli-schema-sync-CWkGFlYu.js.map} +1 -1
- package/dist/_chunks/{cli-schema-sync-_y5O6MIg.js → cli-schema-sync-Dyvdkv_I.js} +1 -1
- package/dist/_chunks/{client-dep-entries-DpiwvoDi.js → client-dep-entries-Dka67elj.js} +2 -2
- package/dist/_chunks/{client-dep-entries-DpiwvoDi.js.map → client-dep-entries-Dka67elj.js.map} +1 -1
- package/dist/_chunks/{convention-lint-0AEsPK2T.js → convention-lint-DkSDlsPH.js} +38 -10
- package/dist/_chunks/convention-lint-DkSDlsPH.js.map +1 -0
- package/dist/_chunks/{dev-server-DYDr8KIc.js → dev-server-BZxFJNih.js} +68 -11
- package/dist/_chunks/{dev-server-DYDr8KIc.js.map → dev-server-BZxFJNih.js.map} +1 -1
- package/dist/_chunks/dev-server-C72bB9Kg.js +1 -0
- package/dist/_chunks/error-boundary-wuNvAJ4n.js.map +1 -1
- package/dist/_chunks/{flight-source-node-KQsX_OhS.js → flight-source-node-BeF00Wo_.js} +2 -2
- package/dist/_chunks/{flight-source-node-KQsX_OhS.js.map → flight-source-node-BeF00Wo_.js.map} +1 -1
- 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-BVDALqMf.js → json-lossy-check-DpXneTBm.js} +2 -2
- package/dist/_chunks/{json-lossy-check-BVDALqMf.js.map → json-lossy-check-DpXneTBm.js.map} +1 -1
- package/dist/_chunks/{key-headers-uIig1_mU.js → key-headers-CVpa6fpW.js} +6 -2
- package/dist/_chunks/key-headers-CVpa6fpW.js.map +1 -0
- package/dist/_chunks/{live-graph-VhzO7Ol9.js → live-graph-DXhz6A_X.js} +4 -4
- package/dist/_chunks/{live-graph-VhzO7Ol9.js.map → live-graph-DXhz6A_X.js.map} +1 -1
- package/dist/_chunks/{logger-C4m8rfMy.js → logger-D1sWX2I0.js} +17 -2
- package/dist/_chunks/logger-D1sWX2I0.js.map +1 -0
- package/dist/_chunks/{node-response-8Vz29cGS.js → node-response-Cp62CtH1.js} +2 -2
- package/dist/_chunks/{node-response-8Vz29cGS.js.map → node-response-Cp62CtH1.js.map} +1 -1
- package/dist/_chunks/{poison-scan-Dpl3ibG-.js → poison-scan-DdkJoHvP.js} +2 -2
- package/dist/_chunks/{poison-scan-Dpl3ibG-.js.map → poison-scan-DdkJoHvP.js.map} +1 -1
- package/dist/_chunks/{scanner-CCEHN9Jg.js → scanner-B6V2RqqF.js} +20 -3
- package/dist/_chunks/scanner-B6V2RqqF.js.map +1 -0
- package/dist/_chunks/{sizeof-CIF7fwSJ.js → sizeof-BKA6qOZq.js} +2 -2
- package/dist/_chunks/{sizeof-CIF7fwSJ.js.map → sizeof-BKA6qOZq.js.map} +1 -1
- package/dist/_chunks/{walkers-BbotBhNG.js → walkers-BAZoAlfI.js} +3 -3
- package/dist/_chunks/{walkers-BbotBhNG.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/cli-check.d.ts +3 -3
- package/dist/cli-check.d.ts.map +1 -1
- package/dist/cli.js +3 -3
- package/dist/client/document-withdrawal.d.ts +2 -0
- package/dist/client/document-withdrawal.d.ts.map +1 -0
- package/dist/client/outlet-content-cache.d.ts +13 -1
- package/dist/client/outlet-content-cache.d.ts.map +1 -1
- package/dist/client/outlet-scope-context.d.ts +5 -0
- package/dist/client/outlet-scope-context.d.ts.map +1 -1
- package/dist/client/segment-outlet.d.ts.map +1 -1
- package/dist/config-types.d.ts +43 -21
- package/dist/config-types.d.ts.map +1 -1
- package/dist/config-validation.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/native/rsc/manifest.json +2 -0
- package/dist/native/rsc/server/als-registry.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/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 +4 -4
- package/dist/native/rsc/server/request-context.js.map +1 -1
- package/dist/native/rsc/server/route-element-builder.js +1 -1
- package/dist/native/rsc/server/route-element-builder.js.map +1 -1
- package/dist/native/rsc/server/route-module-loader.js +5 -4
- package/dist/native/rsc/server/route-module-loader.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/render-route.js +1 -1
- package/dist/native/rsc/server/rsc-entry/render-route.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js +1 -1
- package/dist/native/rsc/server/rsc-entry/revalidate-renderer.js.map +1 -1
- package/dist/native/rsc/server/segment-lifetime/outlet-gate.js +2 -1
- package/dist/native/rsc/server/segment-lifetime/outlet-gate.js.map +1 -1
- package/dist/native/rsc/server/segment-lifetime/read-rule.js +31 -20
- package/dist/native/rsc/server/segment-lifetime/read-rule.js.map +1 -1
- package/dist/native/rsc/server/segment-lifetime/read-scope.js +48 -7
- package/dist/native/rsc/server/segment-lifetime/read-scope.js.map +1 -1
- package/dist/native/rsc/server/segment-lifetime/segment-key.js +13 -8
- package/dist/native/rsc/server/segment-lifetime/segment-key.js.map +1 -1
- package/dist/native/rsc/server/segment-lifetime/slot-outlets.js +5 -4
- package/dist/native/rsc/server/segment-lifetime/slot-outlets.js.map +1 -1
- package/dist/native/rsc/server/slot-resolver.js +5 -4
- 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 +4 -1
- package/dist/native/rsc/shared/key-headers.js.map +1 -1
- package/dist/native/rsc/shared/layout-defaults.js +19 -0
- package/dist/native/rsc/shared/layout-defaults.js.map +1 -0
- 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 +6 -1
- 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 +11 -2
- package/dist/native/ssr/client/segment-outlet.js.map +1 -1
- package/dist/native/ssr/manifest.json +6 -0
- package/dist/native/ssr/server/als-registry.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/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 +4 -4
- package/dist/native/ssr/server/request-context.js.map +1 -1
- package/dist/native/ssr/server/segment-lifetime/outlet-gate.js +12 -0
- package/dist/native/ssr/server/segment-lifetime/outlet-gate.js.map +1 -0
- package/dist/native/ssr/server/segment-lifetime/read-rule.js +31 -20
- 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 +4 -1
- package/dist/native/ssr/shared/key-headers.js.map +1 -1
- package/dist/native/ssr/shared/layout-defaults.js +9 -0
- package/dist/native/ssr/shared/layout-defaults.js.map +1 -0
- package/dist/plugins/entries.d.ts.map +1 -1
- package/dist/routing/convention-lint.d.ts +2 -2
- package/dist/routing/convention-lint.d.ts.map +1 -1
- package/dist/routing/index.js +3 -3
- package/dist/routing/route-options-lint.d.ts +2 -2
- package/dist/routing/route-options-lint.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 +18 -0
- package/dist/server/als-registry.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/index.js +2 -2
- package/dist/server/internal.js +97 -8
- 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/route-module-loader.d.ts +4 -3
- package/dist/server/route-module-loader.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/render-route.d.ts +3 -3
- package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
- package/dist/server/rsc-entry/revalidate-renderer.d.ts +3 -3
- package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -1
- package/dist/server/segment-lifetime/outlet-gate.d.ts +5 -5
- package/dist/server/segment-lifetime/outlet-gate.d.ts.map +1 -1
- package/dist/server/segment-lifetime/read-rule.d.ts +14 -18
- package/dist/server/segment-lifetime/read-rule.d.ts.map +1 -1
- package/dist/server/segment-lifetime/read-scope.d.ts +47 -6
- package/dist/server/segment-lifetime/read-scope.d.ts.map +1 -1
- package/dist/server/segment-lifetime/segment-key.d.ts +21 -18
- package/dist/server/segment-lifetime/segment-key.d.ts.map +1 -1
- package/dist/server/segment-lifetime/slot-outlets.d.ts +3 -4
- package/dist/server/segment-lifetime/slot-outlets.d.ts.map +1 -1
- 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 +4 -3
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/vite-handoff-rsc.d.ts +2 -0
- package/dist/server/vite-handoff-rsc.d.ts.map +1 -1
- package/dist/shared/key-headers.d.ts +2 -0
- package/dist/shared/key-headers.d.ts.map +1 -1
- package/dist/shared/layout-defaults.d.ts +30 -0
- package/dist/shared/layout-defaults.d.ts.map +1 -0
- package/docs/api/30-api-server.mdx +1 -1
- package/docs/api/34-api-config.mdx +20 -3
- package/package.json +1 -1
- package/src/cli-check.ts +6 -6
- package/src/client/document-withdrawal.tsx +41 -0
- package/src/client/outlet-content-cache.ts +18 -2
- package/src/client/outlet-scope-context.ts +5 -0
- package/src/client/segment-outlet.tsx +9 -3
- package/src/config-types.ts +44 -21
- package/src/config-validation.ts +96 -20
- package/src/index.ts +1 -1
- package/src/plugins/entries.ts +6 -3
- package/src/plugins/routing.ts +1 -1
- package/src/routing/convention-lint.ts +5 -3
- package/src/routing/interception.ts +5 -5
- package/src/routing/route-options-lint.ts +6 -6
- package/src/routing/slot-placement.ts +41 -4
- package/src/server/als-registry.ts +14 -0
- 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/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 +6 -6
- package/src/server/route-element-builder.ts +3 -3
- package/src/server/route-module-loader.ts +7 -6
- package/src/server/rsc-entry/index.ts +14 -8
- package/src/server/rsc-entry/render-route.ts +4 -4
- package/src/server/rsc-entry/revalidate-renderer.ts +4 -4
- package/src/server/segment-lifetime/outlet-gate.ts +6 -6
- package/src/server/segment-lifetime/read-rule.ts +67 -33
- package/src/server/segment-lifetime/read-scope.ts +128 -14
- package/src/server/segment-lifetime/segment-key.ts +32 -24
- package/src/server/segment-lifetime/slot-outlets.ts +8 -12
- package/src/server/slot-resolver.ts +22 -10
- package/src/server/slot-subtree-contain.ts +2 -1
- package/src/server/subtree-walk.ts +34 -9
- package/src/server/types.ts +4 -3
- package/src/server/vite-handoff-rsc.ts +2 -0
- package/src/shared/key-headers.ts +5 -0
- package/src/shared/layout-defaults.ts +43 -0
- package/dist/_chunks/actions-BkwgRwCl.js.map +0 -1
- package/dist/_chunks/chains-LGjBHfSN.js +0 -1
- package/dist/_chunks/cli-check-KeE1QaIx.js.map +0 -1
- package/dist/_chunks/convention-lint-0AEsPK2T.js.map +0 -1
- package/dist/_chunks/dev-server-CboXr8zX.js +0 -1
- package/dist/_chunks/key-headers-uIig1_mU.js.map +0 -1
- package/dist/_chunks/logger-C4m8rfMy.js.map +0 -1
- package/dist/_chunks/scanner-CCEHN9Jg.js.map +0 -1
|
@@ -25,8 +25,8 @@ export function checkRouteOptions(
|
|
|
25
25
|
node: SegmentNode,
|
|
26
26
|
warnings: ConventionWarning[],
|
|
27
27
|
position: RoutePosition,
|
|
28
|
-
/**
|
|
29
|
-
|
|
28
|
+
/** `layoutDefaults.lifetime`, resolved (design/53 §"App-wide defaults"). */
|
|
29
|
+
layoutLifetimeDefault: SegmentLifetime,
|
|
30
30
|
/** The params named on the path above this segment. */
|
|
31
31
|
ancestorParams: readonly string[] = []
|
|
32
32
|
): void {
|
|
@@ -42,7 +42,7 @@ export function checkRouteOptions(
|
|
|
42
42
|
problems.push(
|
|
43
43
|
...inertOptions(options, here),
|
|
44
44
|
...paramsOffPath(options, pathParams),
|
|
45
|
-
...keyWithoutDocument(options, kind === 'layout' ?
|
|
45
|
+
...keyWithoutDocument(options, kind === 'layout' ? layoutLifetimeDefault : 'request')
|
|
46
46
|
);
|
|
47
47
|
if (problems.length === 0) continue;
|
|
48
48
|
warnings.push({
|
|
@@ -71,18 +71,18 @@ export function checkRouteOptions(
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
for (const child of node.children) {
|
|
74
|
-
checkRouteOptions(child, warnings, here,
|
|
74
|
+
checkRouteOptions(child, warnings, here, layoutLifetimeDefault, pathParams);
|
|
75
75
|
}
|
|
76
76
|
for (const slot of Object.values(node.slots)) {
|
|
77
77
|
const slotPosition = here === 'intercepting' ? here : 'slot';
|
|
78
|
-
checkRouteOptions(slot, warnings, slotPosition,
|
|
78
|
+
checkRouteOptions(slot, warnings, slotPosition, layoutLifetimeDefault, pathParams);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* A `key` applies only to a `'document'` segment; on any other it would
|
|
84
84
|
* silently do nothing. A layout that declares no lifetime takes the app's
|
|
85
|
-
* `
|
|
85
|
+
* `layoutDefaults.lifetime`, so under a `'document'` default it may declare a
|
|
86
86
|
* key alone. A page always defaults to `'request'`.
|
|
87
87
|
*/
|
|
88
88
|
function keyWithoutDocument(
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parallel slot placement.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Two rules, both about slots no renderer reaches:
|
|
5
|
+
*
|
|
6
|
+
* 1. A slot is resolved only for a segment on the **matched route chain**,
|
|
7
|
+
* and a slot's own subtree is never on that chain. So a slot declared
|
|
8
|
+
* anywhere inside another slot's subtree can never render.
|
|
9
|
+
* 2. A slot is a prop of its owner's **layout**. A segment without a
|
|
10
|
+
* `layout.tsx` has nothing to hand the slot to, so its slots never render
|
|
11
|
+
* either (TIM-1443).
|
|
12
|
+
*
|
|
13
|
+
* Both are rejected at build time rather than left as directories the author
|
|
14
|
+
* will keep editing.
|
|
8
15
|
*
|
|
9
16
|
* See design/07-routing.md §"Parallel Routes".
|
|
10
17
|
*/
|
|
@@ -45,6 +52,18 @@ import type { SegmentNode } from './types.ts';
|
|
|
45
52
|
* it exactly as it does for any other chain segment. `(browse)/(...)photo/[id]/@side`
|
|
46
53
|
* renders; `feed/@modal/(.)photo/@side` does not. The discriminator is the slot
|
|
47
54
|
* boundary, which is what this walk tracks — not the marker.
|
|
55
|
+
*
|
|
56
|
+
* **The owner must have a layout.** `route-element-builder.ts` resolves a
|
|
57
|
+
* segment's slots only while building that segment's layout element — the
|
|
58
|
+
* slot props are the layout's props, and nothing else receives them. A slot on
|
|
59
|
+
* a layoutless segment is dead in exactly the way a nested slot is, with the
|
|
60
|
+
* same missing signal. (Next.js drops them the same way: a segment with no
|
|
61
|
+
* layout renders only `children`.) Interception made it worse than dead: only
|
|
62
|
+
* the winning owner's slots intercept, so a layoutless owner whose rewrite won
|
|
63
|
+
* — reachable through the address-bar scope channel — rendered the source page
|
|
64
|
+
* with no modal under the target URL. The client's mounted-scope channel never
|
|
65
|
+
* names such an owner, because `X-Timber-Segments` carries layout-bearing
|
|
66
|
+
* segments only; this rule makes the two channels agree by construction.
|
|
48
67
|
*/
|
|
49
68
|
export function validateSlotPlacement(root: SegmentNode): void {
|
|
50
69
|
walkForSlotPlacement(root, '', null);
|
|
@@ -67,6 +86,9 @@ function walkForSlotPlacement(
|
|
|
67
86
|
if (enclosingSlotPath !== null) {
|
|
68
87
|
throwNestedSlot(slotPath, enclosingSlotPath);
|
|
69
88
|
}
|
|
89
|
+
if (!node.layout) {
|
|
90
|
+
throwLayoutlessOwner(slotPath, path, slotName);
|
|
91
|
+
}
|
|
70
92
|
walkForSlotPlacement(slotNode, slotPath, slotPath);
|
|
71
93
|
}
|
|
72
94
|
|
|
@@ -79,6 +101,21 @@ function walkForSlotPlacement(
|
|
|
79
101
|
}
|
|
80
102
|
}
|
|
81
103
|
|
|
104
|
+
function throwLayoutlessOwner(slotPath: string, ownerPath: string, slotName: string): never {
|
|
105
|
+
const owner = ownerPath ? `app/${ownerPath}` : 'app';
|
|
106
|
+
throw new Error(
|
|
107
|
+
`Build error: parallel slot whose owner has no layout.\n` +
|
|
108
|
+
` Directory: app/${slotPath}\n` +
|
|
109
|
+
` Owner: ${owner}\n` +
|
|
110
|
+
`A parallel slot is passed to its owning segment's layout as a named prop, and ` +
|
|
111
|
+
`${owner} has no layout.tsx to receive it — so app/${slotPath} can never render, ` +
|
|
112
|
+
`and no request-time signal can tell you.\n` +
|
|
113
|
+
`Add ${owner}/layout.tsx and place the slot prop where it should appear, e.g. ` +
|
|
114
|
+
`({ children, ${slotName} }) => <>{children}{${slotName}}</>.\n` +
|
|
115
|
+
`See design/07-routing.md §"Parallel Routes".`
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
82
119
|
function throwNestedSlot(slotPath: string, enclosingSlotPath: string): never {
|
|
83
120
|
throw new Error(
|
|
84
121
|
`Build error: parallel slot nested inside another parallel slot.\n` +
|
|
@@ -364,6 +364,20 @@ export interface DocumentReadScope {
|
|
|
364
364
|
cookies: ReadonlyMap<string, unknown>;
|
|
365
365
|
/** The key's header names, lowercased. */
|
|
366
366
|
headers: ReadonlySet<string>;
|
|
367
|
+
/**
|
|
368
|
+
* Whether this segment render has reported a read outside its key: one
|
|
369
|
+
* report per segment render. Shared by every call in the render.
|
|
370
|
+
*/
|
|
371
|
+
reported: { done: boolean };
|
|
372
|
+
/**
|
|
373
|
+
* Whether this component call (and the work it awaits) read outside the
|
|
374
|
+
* key, so its output must withdraw the segment from the client (design/53
|
|
375
|
+
* §"Reads outside the key"). One per scoped component call: the scope runs
|
|
376
|
+
* each call in a copy of the scope with a fresh `call`
|
|
377
|
+
* (`segment-lifetime/read-scope.ts`). Set by the read rule
|
|
378
|
+
* (`segment-lifetime/read-rule.ts`).
|
|
379
|
+
*/
|
|
380
|
+
call: { read: boolean };
|
|
367
381
|
}
|
|
368
382
|
|
|
369
383
|
/** @internal — run and read via segment-lifetime/read-scope.ts */
|
|
@@ -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
|
+
}
|
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,8 @@ 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
39
|
currentReadScope,
|
|
40
40
|
keyedHeaders,
|
|
41
41
|
scopedParams,
|
|
@@ -99,8 +99,8 @@ export function getSearchParams(reader?: SearchParamsReader): URLSearchParams {
|
|
|
99
99
|
}
|
|
100
100
|
// A definition's `.get()` passes what it parses; a 'document' segment may
|
|
101
101
|
// read only fields its key reads the same way, and never the raw params.
|
|
102
|
-
if (reader)
|
|
103
|
-
else
|
|
102
|
+
if (reader) checkSearchParamsRead(reader);
|
|
103
|
+
else checkUnscopedRead('the raw search params');
|
|
104
104
|
|
|
105
105
|
return store.searchParams;
|
|
106
106
|
}
|
|
@@ -149,7 +149,7 @@ export function getSegmentParams(segmentPath?: string): CoercedParams {
|
|
|
149
149
|
// client's useSegmentParams() also reads, so the two halves of one
|
|
150
150
|
// documented API cannot drift (TIM-1285).
|
|
151
151
|
const slotResolved = resolveSegmentParams(store.segmentParams, store.slotParams, segmentPath);
|
|
152
|
-
// Inside a 'document' segment, a param outside its key
|
|
152
|
+
// Inside a 'document' segment, a param outside its key is refused (design/53).
|
|
153
153
|
if (slotResolved !== store.segmentParams) return scopedParams(slotResolved);
|
|
154
154
|
|
|
155
155
|
// Dev-mode validation: warn when the segment path expects dynamic
|
|
@@ -342,7 +342,7 @@ export function getRequestSearchString(): string {
|
|
|
342
342
|
const store = requestContextAls.getStore();
|
|
343
343
|
// A 'document' segment's redirect cannot carry search params outside its
|
|
344
344
|
// key (design/53): what it redirects to would freeze.
|
|
345
|
-
if (store)
|
|
345
|
+
if (store) checkUnscopedRead('the raw search params');
|
|
346
346
|
return store?.searchString ?? '';
|
|
347
347
|
}
|
|
348
348
|
|
|
@@ -208,7 +208,7 @@ export async function buildRouteElement(
|
|
|
208
208
|
deferSuspenseFor,
|
|
209
209
|
accessFns,
|
|
210
210
|
documentLifetimes,
|
|
211
|
-
} = await loadRouteModules(segments, req.url, render.
|
|
211
|
+
} = await loadRouteModules(segments, req.url, render.layoutDefaults);
|
|
212
212
|
// The coerced params every 'document' key on the main chain reads from —
|
|
213
213
|
// read only when a segment needs them.
|
|
214
214
|
const hasDocumentSegment =
|
|
@@ -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(
|
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { ManifestSegmentNode } from './route-matcher.ts';
|
|
12
|
-
import type { Metadata
|
|
12
|
+
import type { Metadata } from './types.ts';
|
|
13
|
+
import { NO_LAYOUT_DEFAULTS, type ResolvedLayoutDefaults } from '../shared/layout-defaults.ts';
|
|
13
14
|
import { loadModule } from './safe-load.ts';
|
|
14
15
|
import { ROUTE_OPTIONS_EXPORT } from '../shared/route-options-export.ts';
|
|
15
16
|
import { NoPageComponentError, type LayoutComponentEntry } from './route-element-builder.ts';
|
|
16
17
|
import {
|
|
17
|
-
|
|
18
|
+
layoutDefaultsAt,
|
|
18
19
|
readDocumentLifetime,
|
|
19
20
|
type DocumentLifetime,
|
|
20
21
|
} from './segment-lifetime/segment-key.ts';
|
|
@@ -112,8 +113,8 @@ function collectModuleExports(
|
|
|
112
113
|
export async function loadRouteModules(
|
|
113
114
|
segments: ManifestSegmentNode[],
|
|
114
115
|
requestUrl: string,
|
|
115
|
-
/** The app's `
|
|
116
|
-
|
|
116
|
+
/** The app's `layoutDefaults` (design/53 §"App-wide defaults"). */
|
|
117
|
+
layoutDefaults: ResolvedLayoutDefaults
|
|
117
118
|
): Promise<LoadedRouteModules> {
|
|
118
119
|
const metadataSources: MetadataSource[] = [];
|
|
119
120
|
const layoutComponents: LayoutComponentEntry[] = [];
|
|
@@ -131,7 +132,7 @@ export async function loadRouteModules(
|
|
|
131
132
|
documentLifetimes.layouts[i] = readDocumentLifetime(
|
|
132
133
|
mod,
|
|
133
134
|
'layout',
|
|
134
|
-
|
|
135
|
+
layoutDefaultsAt(segments.slice(0, i + 1), layoutDefaults)
|
|
135
136
|
);
|
|
136
137
|
if (mod.default) {
|
|
137
138
|
layoutComponents.push({
|
|
@@ -154,7 +155,7 @@ export async function loadRouteModules(
|
|
|
154
155
|
if (mod.default) {
|
|
155
156
|
PageComponent = mod.default as (...args: unknown[]) => unknown;
|
|
156
157
|
}
|
|
157
|
-
documentLifetimes.page = readDocumentLifetime(mod, 'page',
|
|
158
|
+
documentLifetimes.page = readDocumentLifetime(mod, 'page', NO_LAYOUT_DEFAULTS);
|
|
158
159
|
deferSuspenseFor = collectModuleExports(
|
|
159
160
|
mod,
|
|
160
161
|
segment,
|
|
@@ -45,7 +45,7 @@ import { buildActionDispatcher } from './action-dispatcher.ts';
|
|
|
45
45
|
import type { BodyLimitsConfig } from '../body-limits.ts';
|
|
46
46
|
import type { DevHooks } from '../../dev-tools/dev-page-shell.ts';
|
|
47
47
|
import type { BuildManifest } from '../build-manifest.ts';
|
|
48
|
-
import
|
|
48
|
+
import { resolveLayoutDefaults } from '../../shared/layout-defaults.ts';
|
|
49
49
|
import { resolveLogMode } from '../../dev-tools/logger.ts';
|
|
50
50
|
import { sendEarlyHints103 } from '../early-hints-sender.ts';
|
|
51
51
|
import { collectEarlyHintHeaders } from '../early-hints.ts';
|
|
@@ -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,11 +273,10 @@ async function createRequestHandler(manifest: typeof routeManifest, runtimeConfi
|
|
|
266
273
|
| { disabled: boolean; enableHMRInDev: boolean }
|
|
267
274
|
| undefined;
|
|
268
275
|
const clientJsDisabled = clientJsConfig?.disabled ?? false;
|
|
269
|
-
// Written by `plugins/entries.ts`
|
|
270
|
-
const
|
|
271
|
-
(runtimeConfig as Record<string, unknown>).
|
|
272
|
-
|
|
273
|
-
: 'request';
|
|
276
|
+
// Written by `plugins/entries.ts` in its config shape; resolved once, here.
|
|
277
|
+
const layoutDefaults = resolveLayoutDefaults(
|
|
278
|
+
(runtimeConfig as Record<string, unknown>).layoutDefaults
|
|
279
|
+
);
|
|
274
280
|
// One signer per server; it reads the secret on first use.
|
|
275
281
|
const keyDigestSigner = clientJsDisabled ? null : createKeyDigestSigner(encryptionKeySource);
|
|
276
282
|
const clientBootstrap = buildClientScripts({
|
|
@@ -392,7 +398,7 @@ async function createRequestHandler(manifest: typeof routeManifest, runtimeConfi
|
|
|
392
398
|
clientBootstrap,
|
|
393
399
|
clientJsDisabled,
|
|
394
400
|
keyDigestSigner,
|
|
395
|
-
|
|
401
|
+
layoutDefaults,
|
|
396
402
|
renderDenyFallback,
|
|
397
403
|
buildManifest: typedBuildManifest,
|
|
398
404
|
renderTimeoutMs: (config as Record<string, unknown>).renderTimeoutMs as number,
|
|
@@ -497,7 +503,7 @@ async function createRequestHandler(manifest: typeof routeManifest, runtimeConfi
|
|
|
497
503
|
coerceSegmentParams,
|
|
498
504
|
buildManifest: buildManifest as BuildManifest,
|
|
499
505
|
keyDigestSigner,
|
|
500
|
-
|
|
506
|
+
layoutDefaults,
|
|
501
507
|
}),
|
|
502
508
|
}),
|
|
503
509
|
};
|
|
@@ -34,7 +34,7 @@ import { recordTiming } from '../server-timing.ts';
|
|
|
34
34
|
import { parseClientStateTree } from '../client-state-tree.ts';
|
|
35
35
|
import type { SegmentRender } from '../segment-lifetime/outlet-gate.ts';
|
|
36
36
|
import type { KeyDigestSigner } from '../segment-lifetime/key-digest.ts';
|
|
37
|
-
import type {
|
|
37
|
+
import type { ResolvedLayoutDefaults } from '../../shared/layout-defaults.ts';
|
|
38
38
|
|
|
39
39
|
import { handleApiRoute } from './api-handler.ts';
|
|
40
40
|
import type { DenyFallbackRenderer } from './deny-fallback.ts';
|
|
@@ -59,8 +59,8 @@ export interface RenderRouteDeps {
|
|
|
59
59
|
* since no client router can hold a segment.
|
|
60
60
|
*/
|
|
61
61
|
keyDigestSigner: KeyDigestSigner | null;
|
|
62
|
-
/** The app's `
|
|
63
|
-
|
|
62
|
+
/** The app's `layoutDefaults` (design/53 §"App-wide defaults"). */
|
|
63
|
+
layoutDefaults: ResolvedLayoutDefaults;
|
|
64
64
|
renderDenyFallback: DenyFallbackRenderer;
|
|
65
65
|
buildManifest: BuildManifest;
|
|
66
66
|
/**
|
|
@@ -107,7 +107,7 @@ export async function renderRoute(
|
|
|
107
107
|
const signer = clientJsDisabled ? null : deps.keyDigestSigner;
|
|
108
108
|
const segmentRender: SegmentRender = {
|
|
109
109
|
documents: signer ? { client: clientState?.documents ?? null, signer } : null,
|
|
110
|
-
|
|
110
|
+
layoutDefaults: deps.layoutDefaults,
|
|
111
111
|
};
|
|
112
112
|
|
|
113
113
|
// Build the React element tree — runs access checks eagerly to gate
|
|
@@ -48,7 +48,7 @@ import type { CoercedParams } from '../../shared/param-value.ts';
|
|
|
48
48
|
|
|
49
49
|
import { runMiddlewareForAction } from './action-middleware-runner.ts';
|
|
50
50
|
import type { KeyDigestSigner } from '../segment-lifetime/key-digest.ts';
|
|
51
|
-
import type {
|
|
51
|
+
import type { ResolvedLayoutDefaults } from '../../shared/layout-defaults.ts';
|
|
52
52
|
import { RSC_CONTENT_TYPE } from '../../shared/rsc-media-type.ts';
|
|
53
53
|
|
|
54
54
|
/** Result of validating a `revalidatePath()` argument. */
|
|
@@ -146,8 +146,8 @@ export interface RevalidateRendererDeps {
|
|
|
146
146
|
* (design/53-segment-lifetime.md open question 4).
|
|
147
147
|
*/
|
|
148
148
|
keyDigestSigner: KeyDigestSigner | null;
|
|
149
|
-
/** The app's `
|
|
150
|
-
|
|
149
|
+
/** The app's `layoutDefaults` (design/53 §"App-wide defaults"). */
|
|
150
|
+
layoutDefaults: ResolvedLayoutDefaults;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
/**
|
|
@@ -351,7 +351,7 @@ export function createRevalidateRendererFactory(
|
|
|
351
351
|
undefined,
|
|
352
352
|
{
|
|
353
353
|
documents: deps.keyDigestSigner ? { client: null, signer: deps.keyDigestSigner } : null,
|
|
354
|
-
|
|
354
|
+
layoutDefaults: deps.layoutDefaults,
|
|
355
355
|
},
|
|
356
356
|
deps.buildManifest.metadataRouteHashes
|
|
357
357
|
);
|
|
@@ -17,7 +17,7 @@ import { createElement, type ReactElement, type ReactNode } from 'react';
|
|
|
17
17
|
import type { OutletDecision } from '../../shared/outlet-decision.ts';
|
|
18
18
|
import { clientComponents } from '../vite-handoff-rsc.ts';
|
|
19
19
|
import type { DocumentKeys, DocumentOutlet } from './document-outlet.ts';
|
|
20
|
-
import type
|
|
20
|
+
import { NO_LAYOUT_DEFAULTS, type ResolvedLayoutDefaults } from '../../shared/layout-defaults.ts';
|
|
21
21
|
|
|
22
22
|
/** One outlet in the element tree, and the outlets directly inside it. */
|
|
23
23
|
export interface OutletSpec {
|
|
@@ -36,17 +36,17 @@ export interface SegmentRender {
|
|
|
36
36
|
*/
|
|
37
37
|
documents: DocumentKeys | null;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
* `
|
|
41
|
-
*
|
|
39
|
+
* What a layout that declares no lifetime, or a key without `headers`,
|
|
40
|
+
* takes: the app's `layoutDefaults` (design/53 §"App-wide defaults").
|
|
41
|
+
* Pages take none.
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
layoutDefaults: ResolvedLayoutDefaults;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/** A render with no client router to hold segments: every outlet live. */
|
|
47
47
|
export const LIVE_ONLY_RENDER: SegmentRender = {
|
|
48
48
|
documents: null,
|
|
49
|
-
|
|
49
|
+
layoutDefaults: NO_LAYOUT_DEFAULTS,
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
/**
|