@timber-js/app 0.2.0-alpha.244 → 0.2.0-alpha.245
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-D_LiN5xG.js → actions-C7_xl9iA.js} +9 -5
- package/dist/_chunks/actions-C7_xl9iA.js.map +1 -0
- package/dist/_chunks/als-registry-C-iwbtvI.js.map +1 -1
- package/dist/_chunks/{cli-check-BE9BnXwi.js → cli-check-CetL-6Us.js} +2 -2
- package/dist/_chunks/{cli-check-BE9BnXwi.js.map → cli-check-CetL-6Us.js.map} +1 -1
- package/dist/_chunks/{codegen-vaCyFyVN.js → codegen-BxJGInWa.js} +76 -20
- package/dist/_chunks/codegen-BxJGInWa.js.map +1 -0
- package/dist/_chunks/{convention-lint-DkSDlsPH.js → convention-lint-BWbKAV4x.js} +17 -9
- package/dist/_chunks/convention-lint-BWbKAV4x.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/native/rsc/manifest.json +1 -0
- package/dist/native/rsc/routing/descendant-params.js +28 -0
- package/dist/native/rsc/routing/descendant-params.js.map +1 -0
- package/dist/native/rsc/server/als-registry.js.map +1 -1
- package/dist/native/rsc/server/request-context.js +1 -1
- package/dist/native/rsc/server/request-context.js.map +1 -1
- package/dist/native/rsc/server/route-element-builder.js +3 -2
- package/dist/native/rsc/server/route-element-builder.js.map +1 -1
- package/dist/native/rsc/server/segment-lifetime/read-rule.js +7 -3
- package/dist/native/rsc/server/segment-lifetime/read-rule.js.map +1 -1
- package/dist/native/rsc/server/segment-lifetime/read-scope.js +3 -1
- package/dist/native/rsc/server/segment-lifetime/read-scope.js.map +1 -1
- package/dist/native/rsc/server/segment-lifetime/segment-key.js +2 -1
- package/dist/native/rsc/server/segment-lifetime/segment-key.js.map +1 -1
- package/dist/native/rsc/server/segment-lifetime/slot-outlets.js +1 -1
- package/dist/native/rsc/server/segment-lifetime/slot-outlets.js.map +1 -1
- package/dist/native/ssr/server/als-registry.js.map +1 -1
- package/dist/native/ssr/server/request-context.js +1 -1
- package/dist/native/ssr/server/request-context.js.map +1 -1
- package/dist/native/ssr/server/segment-lifetime/read-rule.js +7 -3
- package/dist/native/ssr/server/segment-lifetime/read-rule.js.map +1 -1
- package/dist/native/ssr/server/segment-lifetime/read-scope.js.map +1 -1
- package/dist/routing/codegen-types.d.ts +9 -0
- package/dist/routing/codegen-types.d.ts.map +1 -1
- package/dist/routing/codegen.d.ts.map +1 -1
- package/dist/routing/descendant-params.d.ts +46 -0
- package/dist/routing/descendant-params.d.ts.map +1 -0
- package/dist/routing/index.js +1 -1
- package/dist/routing/route-options-lint.d.ts.map +1 -1
- package/dist/routing/route-options.d.ts +1 -1
- package/dist/routing/route-options.d.ts.map +1 -1
- package/dist/server/als-registry.d.ts +13 -0
- package/dist/server/als-registry.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/internal.js +1 -1
- package/dist/server/internal.js.map +1 -1
- package/dist/server/route-element-builder.d.ts.map +1 -1
- package/dist/server/segment-lifetime/read-rule.d.ts +8 -1
- package/dist/server/segment-lifetime/read-rule.d.ts.map +1 -1
- package/dist/server/segment-lifetime/read-scope.d.ts +8 -2
- package/dist/server/segment-lifetime/read-scope.d.ts.map +1 -1
- package/dist/server/segment-lifetime/segment-key.d.ts +7 -2
- package/dist/server/segment-lifetime/segment-key.d.ts.map +1 -1
- package/dist/server/segment-lifetime/slot-outlets.d.ts.map +1 -1
- package/dist/server/types.d.ts +3 -2
- package/dist/server/types.d.ts.map +1 -1
- package/docs/api/30-api-server.mdx +2 -2
- package/package.json +1 -1
- package/src/routing/codegen-types.ts +9 -0
- package/src/routing/codegen.ts +34 -20
- package/src/routing/descendant-params.ts +76 -0
- package/src/routing/route-options-lint.ts +28 -9
- package/src/routing/route-options.ts +3 -2
- package/src/server/als-registry.ts +13 -0
- package/src/server/request-context.ts +1 -1
- package/src/server/route-element-builder.ts +9 -2
- package/src/server/segment-lifetime/read-rule.ts +32 -3
- package/src/server/segment-lifetime/read-scope.ts +11 -2
- package/src/server/segment-lifetime/segment-key.ts +18 -3
- package/src/server/segment-lifetime/slot-outlets.ts +3 -1
- package/src/server/types.ts +3 -2
- package/dist/_chunks/actions-D_LiN5xG.js.map +0 -1
- package/dist/_chunks/codegen-vaCyFyVN.js.map +0 -1
- package/dist/_chunks/convention-lint-DkSDlsPH.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-element-builder.d.ts","sourceRoot":"","sources":["../../src/server/route-element-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAQ9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"route-element-builder.d.ts","sourceRoot":"","sources":["../../src/server/route-element-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAQ9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAazD,OAAO,EAA+B,KAAK,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAQpG;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,UAAU,GAChB,MAAM,EAAE,CAGV;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAID,+CAA+C;AAC/C,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;IAC3C,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAED,+CAA+C;AAC/C,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,OAAO,EAAE,cAAc,CAAC;IACxB,wDAAwD;IACxD,gBAAgB,EAAE,oBAAoB,EAAE,CAAC;IACzC,qCAAqC;IACrC,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,4DAA4D;IAC5D,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,EAAE,CAAC;CACjC;AAqDD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,UAAU,EACjB,YAAY,EAAE,mBAAmB,GAAG,SAAS,EAC7C,MAAM,EAAE,aAAa,EACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3C,OAAO,CAAC,kBAAkB,CAAC,CAmZ7B"}
|
|
@@ -45,5 +45,12 @@ export declare function checkCookieRead(name: string, codec?: unknown): void;
|
|
|
45
45
|
* own keys are only the params in the key, so spreading it, or passing it to
|
|
46
46
|
* a client component, carries exactly what the segment may depend on.
|
|
47
47
|
*/
|
|
48
|
-
export declare function scopedParams<T extends CoercedParams>(params: T
|
|
48
|
+
export declare function scopedParams<T extends CoercedParams>(params: T,
|
|
49
|
+
/**
|
|
50
|
+
* `'slot'` when `params` is a slot's record merged over the main route's
|
|
51
|
+
* (`getSegmentParams(slotPath)`). A key computes a descendant's param from
|
|
52
|
+
* the main route's record, and a slot may define the same name with another
|
|
53
|
+
* value, so a keyed descendant name is refused through it.
|
|
54
|
+
*/
|
|
55
|
+
record?: 'route' | 'slot'): T;
|
|
49
56
|
//# sourceMappingURL=read-rule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-rule.d.ts","sourceRoot":"","sources":["../../../src/server/segment-lifetime/read-rule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,oFAAoF;AACpF,wBAAgB,gBAAgB,IAAI,iBAAiB,GAAG,SAAS,CAEhE;AAwDD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,iBAAiB,GAAG,eAAe,CAyChG;AAED,4FAA4F;AAC5F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAGpD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CActE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAYnE;AAiBD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,aAAa,
|
|
1
|
+
{"version":3,"file":"read-rule.d.ts","sourceRoot":"","sources":["../../../src/server/segment-lifetime/read-rule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,oFAAoF;AACpF,wBAAgB,gBAAgB,IAAI,iBAAiB,GAAG,SAAS,CAEhE;AAwDD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,iBAAiB,GAAG,eAAe,CAyChG;AAED,4FAA4F;AAC5F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAGpD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CActE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAYnE;AAiBD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,aAAa,EAClD,MAAM,EAAE,CAAC;AACT;;;;;GAKG;AACH,MAAM,GAAE,OAAO,GAAG,MAAgB,GACjC,CAAC,CAiDH"}
|
|
@@ -64,8 +64,14 @@ import { type ReactElement, type ReactNode } from 'react';
|
|
|
64
64
|
import { type DocumentReadScope } from '../als-registry.ts';
|
|
65
65
|
import { type ServerComponent } from '../subtree-walk.ts';
|
|
66
66
|
import type { DocumentLifetime } from './segment-key.ts';
|
|
67
|
-
/**
|
|
68
|
-
|
|
67
|
+
/**
|
|
68
|
+
* The read scope of one `'document'` segment.
|
|
69
|
+
*
|
|
70
|
+
* @param pathParams Every param on the segment's path: the default key.
|
|
71
|
+
* @param descendants The params its `children` chain defines (a layout's;
|
|
72
|
+
* none for a page), which a key may also name.
|
|
73
|
+
*/
|
|
74
|
+
export declare function readScopeFor(segmentPath: string, lifetime: DocumentLifetime, pathParams: readonly string[], descendants: Iterable<string>): DocumentReadScope;
|
|
69
75
|
/**
|
|
70
76
|
* The segment's component, run inside its read scope with every server
|
|
71
77
|
* component it returns rewritten to run there too.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-scope.d.ts","sourceRoot":"","sources":["../../../src/server/segment-lifetime/read-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,OAAO,EAA2B,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEnF,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAElF,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD
|
|
1
|
+
{"version":3,"file":"read-scope.d.ts","sourceRoot":"","sources":["../../../src/server/segment-lifetime/read-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,OAAO,EAA2B,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEnF,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAElF,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,GAC5B,iBAAiB,CAkBnB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,iBAAiB,GAAG,eAAe,CAGjG;AAuDD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,YAAY,CAGhG"}
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* definition that owns it, so two requests that differ only in a way the
|
|
10
10
|
* segment cannot observe produce the same string:
|
|
11
11
|
*
|
|
12
|
-
* - **segment params** — the coerced params (each segment's codec applied)
|
|
12
|
+
* - **segment params** — the coerced params (each segment's codec applied),
|
|
13
|
+
* with a param absent from the record tagged apart from one present as
|
|
14
|
+
* `undefined`, since the segment can tell them apart (`in`, `Object.keys`);
|
|
13
15
|
* - **search params** — `def.buildSearchParams(def.parse(…))`, which applies
|
|
14
16
|
* defaults, aliases (`withUrlKey`) and drops values that parse to the default;
|
|
15
17
|
* - **headers** — each named header's value as `Headers.get` returns it
|
|
@@ -60,7 +62,10 @@ export declare function readDocumentLifetime(mod: Record<string, unknown>, kind:
|
|
|
60
62
|
*
|
|
61
63
|
* @param pathParams Every param name on the segment's path, outermost first —
|
|
62
64
|
* the default `segmentParams`.
|
|
63
|
-
* @param params The coerced
|
|
65
|
+
* @param params The matched route's coerced params, the record the segment
|
|
66
|
+
* reads. A keyed name may be absent from it: an optional catch-all with no
|
|
67
|
+
* segments, or a param a layout's `children` chain defines on other routes
|
|
68
|
+
* (design/53 §"Keying on a descendant's param").
|
|
64
69
|
*/
|
|
65
70
|
export declare function readKeyValues(lifetime: DocumentLifetime, pathParams: readonly string[], params: CoercedParams): string;
|
|
66
71
|
//# sourceMappingURL=segment-key.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segment-key.d.ts","sourceRoot":"","sources":["../../../src/server/segment-lifetime/segment-key.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"segment-key.d.ts","sourceRoot":"","sources":["../../../src/server/segment-lifetime/segment-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAwB,KAAK,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAInG,OAAO,EAAsB,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,oFAAoF;AACpF,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,UAAU,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,EAC1C,WAAW,EAAE,sBAAsB,GAClC,sBAAsB,CAGxB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,IAAI,EAAE,gBAAgB,EACtB,QAAQ,EAAE,sBAAsB,GAC/B,gBAAgB,GAAG,SAAS,CAe9B;AAkBD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,MAAM,EAAE,aAAa,GACpB,MAAM,CA0BR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot-outlets.d.ts","sourceRoot":"","sources":["../../../src/server/segment-lifetime/slot-outlets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAO1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,E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AU,CACR,IAAI,EAAE,mBAAmB,EACzB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,IAAI,EAAE,MAAM,GAAG,QAAQ,GACtB,gBAAgB,GAAG,SAAS,CAK9B;IAED,uDAAuD;IACjD,IAAI,CACR,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,YAAY,CAAC,CAUvB;IAED;;;OAGG;IACG,MAAM,CACV,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,YAAY,GACpD,OAAO,CAAC,YAAY,CAAC,CAevB;IAED;;;OAGG;IACH,MAAM,CACJ,IAAI,EAAE,mBAAmB,EACzB,IAAI,EAAE,MAAM,GAAG,QAAQ,EACvB,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,eAAe,GACzB,eAAe,CAMjB;IAED,OAAO,CAAC,QAAQ;IAUhB,qFAAqF;IACrF,OAAO,CAAC,UAAU;IAOlB,oFAAoF;IACpF,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,KAAK;CAKd"}
|
package/dist/server/types.d.ts
CHANGED
|
@@ -88,8 +88,9 @@ export type SegmentLifetime = 'request' | 'document';
|
|
|
88
88
|
*/
|
|
89
89
|
export interface SegmentKey {
|
|
90
90
|
/**
|
|
91
|
-
* Param names on the segment's path
|
|
92
|
-
*
|
|
91
|
+
* Param names on the segment's path, or, for a main-chain layout, names a
|
|
92
|
+
* page below it binds (absent on the routes that do not). Default: every
|
|
93
|
+
* param on the path. Any other name fails the build.
|
|
93
94
|
*/
|
|
94
95
|
segmentParams?: readonly string[];
|
|
95
96
|
/** A search-params definition, often a `.pick()`. Default: none. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../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AM,GAAG,MAAM,EAAE,CAAC;SAC9B,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;IACD;;;;;;OAMG;IACH,KAAY,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC;AAEhG;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,cAAc,GAAG,cAAc,IAAI,MAC3E,OAAO,GACP,OAAO,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -217,11 +217,11 @@ export const pageOptions = {
|
|
|
217
217
|
| Option | Applies to | Meaning |
|
|
218
218
|
| ------------------ | ------------ | ----------------------------------------------------------------------------------------------------------- |
|
|
219
219
|
| `lifetime` | layout, page | `'request'` (default) or `'document'`: render once per loaded document and skip on client navigations until `key` changes ([Document lifetime](/docs/client-navigation#document-lifetime)). Slots included. |
|
|
220
|
-
| `key` | layout, page | What a `'document'` segment depends on: `segmentParams` (names on its path; default all
|
|
220
|
+
| `key` | layout, page | What a `'document'` segment depends on: `segmentParams` (names on its path, or for a layout, names its child pages bind; default all on its path), `searchParams` (a definition), `cookies` (definitions), `headers` (header names). |
|
|
221
221
|
| `prerender` | layout, page | Render at build time ([route-level sugar](/docs/api-cache#route-level-sugar)). Layouts cascade it to pages, slot pages included. |
|
|
222
222
|
| `deferSuspenseFor` | layout, page | Hold the SSR stream up to N ms ([`deferSuspenseFor`](/docs/streaming#defersuspensefor)). Main route only, not parallel slots. |
|
|
223
223
|
|
|
224
|
-
The build reads these objects from source, so write them as one object literal with literal values. The exception is `key.searchParams` and `key.cookies`, which name the definitions you import. A `key.segmentParams` name that is not on the segment's path, or a `key` on a segment that is not `'document'`, fails the build. A layout that declares no `lifetime` takes the app's [`layoutDefaults.lifetime`](/docs/client-navigation#making-layouts-document-by-default), so under a `'document'` default it may declare `key` alone. A spread, a computed key, a value from a variable, an unknown key, or `layoutOptions` in a page (or the reverse) fails the build with a message naming the fix. An option where it would do nothing also fails the build: in a `'use client'` file, in `default.tsx`, on an intercepting route, or `deferSuspenseFor` in a parallel slot. `satisfies` adds editor completion and type errors; the build checks the object either way. MDX pages are not checked, and `prerender` has no effect in them. `metadata`, `searchParams` and `segmentParams` stay separate exports.
|
|
224
|
+
The build reads these objects from source, so write them as one object literal with literal values. The exception is `key.searchParams` and `key.cookies`, which name the definitions you import. A `key.segmentParams` name that is not on the segment's path, or a `key` on a segment that is not `'document'`, fails the build. A layout outside a parallel slot may also name a param that a page below it binds, such as `artistSlug` from `artists/[artistSlug]/`, but not one only a parallel slot or a `route.ts` defines. That param is absent on the routes without it, and absence is a value of its own: the layout renders again when the param appears, changes or goes away. A layout that declares no `lifetime` takes the app's [`layoutDefaults.lifetime`](/docs/client-navigation#making-layouts-document-by-default), so under a `'document'` default it may declare `key` alone. A spread, a computed key, a value from a variable, an unknown key, or `layoutOptions` in a page (or the reverse) fails the build with a message naming the fix. An option where it would do nothing also fails the build: in a `'use client'` file, in `default.tsx`, on an intercepting route, or `deferSuspenseFor` in a parallel slot. `satisfies` adds editor completion and type errors; the build checks the object either way. MDX pages are not checked, and `prerender` has no effect in them. `metadata`, `searchParams` and `segmentParams` stay separate exports.
|
|
225
225
|
|
|
226
226
|
## Tracing
|
|
227
227
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timber-js/app",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.245",
|
|
4
4
|
"description": "Vite-native React framework built for Servers and Serverless Platforms — correct HTTP semantics, real status codes, pages that work without JavaScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare-workers",
|
|
@@ -15,6 +15,15 @@ export interface RouteEntry {
|
|
|
15
15
|
segmentPath: string;
|
|
16
16
|
/** Accumulated params from all ancestor dynamic segments */
|
|
17
17
|
params: ParamEntry[];
|
|
18
|
+
/**
|
|
19
|
+
* Params a segment on this segment's `children` chain defines below it.
|
|
20
|
+
* Present only on the routes that pass through that segment, so they are
|
|
21
|
+
* optional in the `getSegmentParams(SEGMENT_PATH)` overload, which code in
|
|
22
|
+
* this segment (a layout, middleware, access.ts) reads at runtime. Kept out
|
|
23
|
+
* of `TimberSegmentParams` and the urlPath-keyed emissions, which describe
|
|
24
|
+
* the route itself (design/53 §"Keying on a descendant's param").
|
|
25
|
+
*/
|
|
26
|
+
descendantParams: ParamEntry[];
|
|
18
27
|
/** Whether this is an API route (route.ts) vs page route */
|
|
19
28
|
isApiRoute: boolean;
|
|
20
29
|
/**
|
package/src/routing/codegen.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type { RouteTree, SegmentNode } from './types.ts';
|
|
|
14
14
|
import type { ParamEntry, RouteEntry } from './codegen-types.ts';
|
|
15
15
|
import { buildSchemaParamType } from './codegen-shared.ts';
|
|
16
16
|
import { effectiveUrlSegment, type UrlSegmentIdentity } from './segment-classify.ts';
|
|
17
|
+
import { childrenChainParams } from './descendant-params.ts';
|
|
17
18
|
import {
|
|
18
19
|
buildResolvedPattern,
|
|
19
20
|
formatLinkCatchAllOverloads,
|
|
@@ -100,13 +101,7 @@ function collectRoutes(
|
|
|
100
101
|
// ancestor param too.
|
|
101
102
|
const urlSegment = effectiveUrlSegment(node);
|
|
102
103
|
const params = [...ancestorParams];
|
|
103
|
-
if (urlSegment.paramName)
|
|
104
|
-
params.push({
|
|
105
|
-
name: urlSegment.paramName,
|
|
106
|
-
bracketName: bracketNameForSegment(urlSegment),
|
|
107
|
-
type: paramTypeForSegment(urlSegment.segmentType),
|
|
108
|
-
});
|
|
109
|
-
}
|
|
104
|
+
if (urlSegment.paramName) params.push(paramEntry(urlSegment.paramName, urlSegment));
|
|
110
105
|
|
|
111
106
|
// Check if this segment is a leaf route (has page or route file)
|
|
112
107
|
const isPage = !!node.page;
|
|
@@ -132,6 +127,11 @@ function collectRoutes(
|
|
|
132
127
|
urlPath: node.urlPath,
|
|
133
128
|
segmentPath: treePath || '/',
|
|
134
129
|
params,
|
|
130
|
+
// A page renders only for its own route; a layout, middleware or
|
|
131
|
+
// access.ts runs for the routes below, so their params may be present.
|
|
132
|
+
descendantParams: hostsCode
|
|
133
|
+
? [...childrenChainParams(node)].map(([name, segment]) => paramEntry(name, segment))
|
|
134
|
+
: [],
|
|
135
135
|
isApiRoute,
|
|
136
136
|
isRoutable: isPage || isApiRoute,
|
|
137
137
|
isSlotRoute: insideSlot,
|
|
@@ -195,9 +195,14 @@ function dedupeRoutesByUrlPath(routes: RouteEntry[]): RouteEntry[] {
|
|
|
195
195
|
return [...byPath.values()];
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
function paramEntry(name: string, segment: UrlSegmentIdentity): ParamEntry {
|
|
199
|
+
return {
|
|
200
|
+
name,
|
|
201
|
+
bracketName: bracketNameForSegment(segment),
|
|
202
|
+
type: paramTypeForSegment(segment.segmentType),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
201
206
|
/**
|
|
202
207
|
* Derive the bracket key for schema/codegen lookup.
|
|
203
208
|
* For bare segments like `[id]` this is the segmentName itself.
|
|
@@ -402,15 +407,18 @@ function formatDeclarationFile(
|
|
|
402
407
|
// getSegmentParams / useSegmentParams are segmentPath-keyed → full list,
|
|
403
408
|
// so slot segments keep their own typed overloads.
|
|
404
409
|
const dynamicRoutes = routes.filter((r) => r.params.length > 0);
|
|
410
|
+
// The server overloads also type what a segment's descendants define, as
|
|
411
|
+
// optional: a layout reads them at runtime, and may key on them (design/53).
|
|
412
|
+
const serverRoutes = routes.filter((r) => r.params.length > 0 || r.descendantParams.length > 0);
|
|
405
413
|
|
|
406
414
|
// Generate @timber-js/app/server augmentation — typed getSegmentParams
|
|
407
|
-
if (
|
|
415
|
+
if (serverRoutes.length > 0) {
|
|
408
416
|
lines.push("declare module '@timber-js/app/server' {");
|
|
409
417
|
if (hasSchema) {
|
|
410
418
|
lines.push(" import type { AllSegmentParams } from '@timber-js/app'");
|
|
411
419
|
}
|
|
412
|
-
for (const route of
|
|
413
|
-
const paramsType = formatParamsType(route.params, hasSchema);
|
|
420
|
+
for (const route of serverRoutes) {
|
|
421
|
+
const paramsType = formatParamsType(route.params, hasSchema, route.descendantParams);
|
|
414
422
|
lines.push(
|
|
415
423
|
` export function getSegmentParams(segmentPath: '${route.segmentPath}'): ${paramsType}`
|
|
416
424
|
);
|
|
@@ -487,20 +495,26 @@ function formatDeclarationFile(
|
|
|
487
495
|
}
|
|
488
496
|
|
|
489
497
|
/**
|
|
490
|
-
* Format the params type for a route entry.
|
|
498
|
+
* Format the params type for a route entry. `optional` params (those a
|
|
499
|
+
* descendant defines) may be absent: `name?: T | undefined`.
|
|
491
500
|
*/
|
|
492
|
-
function formatParamsType(
|
|
493
|
-
|
|
501
|
+
function formatParamsType(
|
|
502
|
+
params: ParamEntry[],
|
|
503
|
+
hasSchema?: boolean,
|
|
504
|
+
optional: ParamEntry[] = []
|
|
505
|
+
): string {
|
|
506
|
+
if (params.length === 0 && optional.length === 0) {
|
|
494
507
|
return '{}';
|
|
495
508
|
}
|
|
496
509
|
|
|
497
510
|
// Without a schema a URL segment is an uninterpreted string — that IS
|
|
498
511
|
// its type. Per-segment codec chains used to narrow it here; TIM-1342
|
|
499
512
|
// deleted them along with params.ts.
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
513
|
+
const codecType = (p: ParamEntry) => (hasSchema ? buildSchemaParamType(p) : p.type);
|
|
514
|
+
const fields = [
|
|
515
|
+
...params.map((p) => `${p.name}: ${codecType(p)}`),
|
|
516
|
+
...optional.map((p) => `${p.name}?: (${codecType(p)}) | undefined`),
|
|
517
|
+
];
|
|
504
518
|
return `{ ${fields.join('; ')} }`;
|
|
505
519
|
}
|
|
506
520
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The params a segment's `children` chain defines below it: what a layout may
|
|
3
|
+
* name in `key.segmentParams` besides the params on its path
|
|
4
|
+
* (design/53-segment-lifetime.md §"Keying on a descendant's param").
|
|
5
|
+
*
|
|
6
|
+
* Read by the build lint (`route-options-lint.ts`), codegen (`codegen.ts`) and
|
|
7
|
+
* the runtime read scope (`server/segment-lifetime/read-scope.ts`), so the three
|
|
8
|
+
* agree on what a layout can key.
|
|
9
|
+
*
|
|
10
|
+
* - **`children` only.** A slot's subtree is excluded at every depth: a
|
|
11
|
+
* main-chain layout reads the main route's params, so a name only a slot
|
|
12
|
+
* defines could never be present in what it reads.
|
|
13
|
+
* - **Intercepting directories count**, read through `effectiveUrlSegment`
|
|
14
|
+
* (`(.)[id]` defines `id`): a children-path interception publishes the
|
|
15
|
+
* intercepted params into the same store.
|
|
16
|
+
* - **Only params a page binds.** A param counts only when a `page` sits at or
|
|
17
|
+
* below the segment defining it: a layout never renders for a `route.ts`,
|
|
18
|
+
* or for a directory with no page, so a name only those define would never
|
|
19
|
+
* be present when the key is read.
|
|
20
|
+
* - **Memoized per node**, one post-order pass over the tree however many
|
|
21
|
+
* layouts ask. Keyed weakly on the node object, which the scanner (build)
|
|
22
|
+
* and the manifest (runtime) each build once.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { effectiveUrlSegment, type UrlSegmentIdentity } from './segment-classify.ts';
|
|
26
|
+
import type { SegmentType } from './types.ts';
|
|
27
|
+
|
|
28
|
+
/** The fields of a scanned or manifest segment node this walk reads. */
|
|
29
|
+
interface DescendantNode {
|
|
30
|
+
segmentName: string;
|
|
31
|
+
segmentType: SegmentType;
|
|
32
|
+
paramName?: string;
|
|
33
|
+
paramPrefix?: string;
|
|
34
|
+
paramSuffix?: string;
|
|
35
|
+
interceptedSegmentName?: string;
|
|
36
|
+
page?: unknown;
|
|
37
|
+
children: readonly DescendantNode[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const MEMO = new WeakMap<DescendantNode, ReadonlyMap<string, UrlSegmentIdentity>>();
|
|
41
|
+
const RENDERS_PAGE = new WeakMap<DescendantNode, boolean>();
|
|
42
|
+
|
|
43
|
+
/** Whether a page sits at or below `node` on its `children` chain. */
|
|
44
|
+
function rendersPage(node: DescendantNode): boolean {
|
|
45
|
+
let found = RENDERS_PAGE.get(node);
|
|
46
|
+
if (found === undefined) {
|
|
47
|
+
found = !!node.page || node.children.some(rendersPage);
|
|
48
|
+
RENDERS_PAGE.set(node, found);
|
|
49
|
+
}
|
|
50
|
+
return found;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Every param a segment on `node`'s `children` chain defines, at any depth,
|
|
55
|
+
* by name, with the segment that defines it (its bracket form, for codegen).
|
|
56
|
+
* Excludes `node`'s own param. A name defined in several branches appears
|
|
57
|
+
* once: the scanner already requires one bracket form per name across the
|
|
58
|
+
* tree (`validateUniqueBracketForms`).
|
|
59
|
+
*/
|
|
60
|
+
export function childrenChainParams(node: DescendantNode): ReadonlyMap<string, UrlSegmentIdentity> {
|
|
61
|
+
const memo = MEMO.get(node);
|
|
62
|
+
if (memo) return memo;
|
|
63
|
+
const params = new Map<string, UrlSegmentIdentity>();
|
|
64
|
+
for (const child of node.children) {
|
|
65
|
+
if (!rendersPage(child)) continue;
|
|
66
|
+
const identity = effectiveUrlSegment(child);
|
|
67
|
+
if (identity.paramName && !params.has(identity.paramName)) {
|
|
68
|
+
params.set(identity.paramName, identity);
|
|
69
|
+
}
|
|
70
|
+
for (const [name, deeper] of childrenChainParams(child)) {
|
|
71
|
+
if (!params.has(name)) params.set(name, deeper);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
MEMO.set(node, params);
|
|
75
|
+
return params;
|
|
76
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import type { ConventionWarning } from './convention-lint.ts';
|
|
9
9
|
import { fileHasAnyExport, isScriptExtension } from './export-detect.ts';
|
|
10
|
+
import { childrenChainParams } from './descendant-params.ts';
|
|
10
11
|
import { readRouteOptions } from './route-options.ts';
|
|
11
12
|
import type { RouteFile, SegmentNode } from './types.ts';
|
|
12
13
|
import type { LayoutOptions, PageOptions, SegmentLifetime } from '../server/types.ts';
|
|
@@ -41,7 +42,11 @@ export function checkRouteOptions(
|
|
|
41
42
|
const { options, problems } = readRouteOptions(file.filePath, kind);
|
|
42
43
|
problems.push(
|
|
43
44
|
...inertOptions(options, here),
|
|
44
|
-
...
|
|
45
|
+
...unkeyableParams(
|
|
46
|
+
options,
|
|
47
|
+
pathParams,
|
|
48
|
+
kind === 'layout' && here === 'main' ? descendantsOf(node) : []
|
|
49
|
+
),
|
|
45
50
|
...keyWithoutDocument(options, kind === 'layout' ? layoutLifetimeDefault : 'request')
|
|
46
51
|
);
|
|
47
52
|
if (problems.length === 0) continue;
|
|
@@ -95,25 +100,39 @@ function keyWithoutDocument(
|
|
|
95
100
|
];
|
|
96
101
|
}
|
|
97
102
|
|
|
103
|
+
/** The params a layout's `children` chain defines below it, its path's excluded. */
|
|
104
|
+
function descendantsOf(node: SegmentNode): string[] {
|
|
105
|
+
return [...childrenChainParams(node).keys()];
|
|
106
|
+
}
|
|
107
|
+
|
|
98
108
|
/**
|
|
99
109
|
* A key's `segmentParams` must name params on the segment's path — the
|
|
100
|
-
* segment's own and every ancestor's, slots included
|
|
101
|
-
*
|
|
102
|
-
*
|
|
110
|
+
* segment's own and every ancestor's, slots included — or, for a main-chain
|
|
111
|
+
* layout, a param a page on its `children` chain binds (design/53 §"Keying on
|
|
112
|
+
* a descendant's param"). A page never renders for a deeper route. A slot
|
|
113
|
+
* layout's key reads the slot's own record, and a slot's intercepting routes
|
|
114
|
+
* take no keys, so it keeps its path params. Any other name is never in the params the segment reads, so
|
|
115
|
+
* the key would silently ignore what the author meant (design/53 §"Segment
|
|
116
|
+
* keys").
|
|
103
117
|
*/
|
|
104
|
-
function
|
|
118
|
+
function unkeyableParams(
|
|
105
119
|
options: LayoutOptions | PageOptions | undefined,
|
|
106
|
-
pathParams: readonly string[]
|
|
120
|
+
pathParams: readonly string[],
|
|
121
|
+
descendants: readonly string[]
|
|
107
122
|
): string[] {
|
|
108
123
|
const declared = options?.key?.segmentParams ?? [];
|
|
109
124
|
return declared
|
|
110
|
-
.filter((name) => !pathParams.includes(name))
|
|
125
|
+
.filter((name) => !pathParams.includes(name) && !descendants.includes(name))
|
|
111
126
|
.map(
|
|
112
127
|
(name) =>
|
|
113
|
-
`key.segmentParams names "${name}", which is not a param on this segment's path
|
|
128
|
+
`key.segmentParams names "${name}", which is not a param on this segment's path` +
|
|
129
|
+
(descendants.length > 0 ? ' or one its child routes define. ' : '. ') +
|
|
114
130
|
(pathParams.length > 0
|
|
115
131
|
? `Params on the path: ${pathParams.join(', ')}.`
|
|
116
|
-
: 'This path has no params.')
|
|
132
|
+
: 'This path has no params.') +
|
|
133
|
+
(descendants.length > 0
|
|
134
|
+
? ` Params its child routes define: ${descendants.join(', ')}.`
|
|
135
|
+
: '')
|
|
117
136
|
);
|
|
118
137
|
}
|
|
119
138
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* `server/route-module-loader.ts`; `lifetime` and `key`, in
|
|
12
12
|
* `server/segment-lifetime/segment-key.ts`). A key's `searchParams` and
|
|
13
13
|
* `cookies` name definitions, so they are the one place a non-literal value is
|
|
14
|
-
* accepted; `segmentParams` is checked against the segment
|
|
14
|
+
* accepted; `segmentParams` is checked against the params the segment can key by
|
|
15
15
|
* `routing/route-options-lint.ts`. The whole object follows one rule so that
|
|
16
16
|
* every key is checkable: this reader accepts one spelling —
|
|
17
17
|
* `export const xOptions = { … }` of literal values, optionally behind
|
|
@@ -196,7 +196,8 @@ function readLifetime(node: Node): Read<SegmentLifetime> {
|
|
|
196
196
|
* and `cookies` name definitions — code the build cannot evaluate — so only
|
|
197
197
|
* their shape is checked here; their values take effect from the loaded
|
|
198
198
|
* module (`server/segment-lifetime/`). The route-options lint checks the
|
|
199
|
-
* param names against the segment
|
|
199
|
+
* param names against what the segment can key (its path, and for a layout its
|
|
200
|
+
* child routes' params).
|
|
200
201
|
*/
|
|
201
202
|
type BuildTimeKey = Pick<SegmentKey, 'segmentParams' | 'headers'>;
|
|
202
203
|
|
|
@@ -351,6 +351,19 @@ export interface DocumentReadScope {
|
|
|
351
351
|
segmentPath: string;
|
|
352
352
|
/** Segment param names in the key. */
|
|
353
353
|
params: ReadonlySet<string>;
|
|
354
|
+
/**
|
|
355
|
+
* Every param name a key may name: those on the segment's path and, for a
|
|
356
|
+
* layout, those its `children` chain defines (design/53 §"Keying on a
|
|
357
|
+
* descendant's param"). A refused read of any other has a different fix
|
|
358
|
+
* (`read-rule.ts`).
|
|
359
|
+
*/
|
|
360
|
+
keyableParams: ReadonlySet<string>;
|
|
361
|
+
/**
|
|
362
|
+
* Every param name on the segment's path. A keyed name outside it is a
|
|
363
|
+
* descendant's, keyed from the main route's record, so it may be read only
|
|
364
|
+
* through that record, never through a slot's (`read-rule.ts`).
|
|
365
|
+
*/
|
|
366
|
+
pathParams: ReadonlySet<string>;
|
|
354
367
|
/**
|
|
355
368
|
* The fields of the key's search-params definition, each with the codec and
|
|
356
369
|
* URL key it is read through — a field of another definition matches only
|
|
@@ -150,7 +150,7 @@ export function getSegmentParams(segmentPath?: string): CoercedParams {
|
|
|
150
150
|
// documented API cannot drift (TIM-1285).
|
|
151
151
|
const slotResolved = resolveSegmentParams(store.segmentParams, store.slotParams, segmentPath);
|
|
152
152
|
// Inside a 'document' segment, a param outside its key is refused (design/53).
|
|
153
|
-
if (slotResolved !== store.segmentParams) return scopedParams(slotResolved);
|
|
153
|
+
if (slotResolved !== store.segmentParams) return scopedParams(slotResolved, 'slot');
|
|
154
154
|
|
|
155
155
|
// Dev-mode validation: warn when the segment path expects dynamic
|
|
156
156
|
// segments that don't exist on the actual matched segment. This catches
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
pageOutletKey,
|
|
45
45
|
} from '../routing/segment-keys.ts';
|
|
46
46
|
import { documentOutletFor, pathParamNames } from './segment-lifetime/document-outlet.ts';
|
|
47
|
+
import { childrenChainParams } from '../routing/descendant-params.ts';
|
|
47
48
|
import { getSegmentParams } from './request-context.ts';
|
|
48
49
|
import { inReadScope, readScopeFor } from './segment-lifetime/read-scope.ts';
|
|
49
50
|
import type { ServerComponent } from './subtree-walk.ts';
|
|
@@ -246,7 +247,8 @@ export async function buildRouteElement(
|
|
|
246
247
|
readScopeFor(
|
|
247
248
|
pageOutletKey(segmentTreePaths[segments.length - 1]),
|
|
248
249
|
documentLifetimes.page,
|
|
249
|
-
pathParamNames(segments, segments.length - 1)
|
|
250
|
+
pathParamNames(segments, segments.length - 1),
|
|
251
|
+
[]
|
|
250
252
|
)
|
|
251
253
|
)
|
|
252
254
|
: LoadedPage;
|
|
@@ -458,7 +460,12 @@ export async function buildRouteElement(
|
|
|
458
460
|
const layoutComponentRef = layoutLifetime
|
|
459
461
|
? inReadScope(
|
|
460
462
|
layoutComponent as ServerComponent,
|
|
461
|
-
readScopeFor(
|
|
463
|
+
readScopeFor(
|
|
464
|
+
layoutOutletPath,
|
|
465
|
+
layoutLifetime,
|
|
466
|
+
pathParamNames(segments, i),
|
|
467
|
+
childrenChainParams(segment).keys()
|
|
468
|
+
)
|
|
462
469
|
)
|
|
463
470
|
: layoutComponent;
|
|
464
471
|
const layoutDenyPages = denyPageChains.get(i);
|
|
@@ -195,16 +195,28 @@ const OBJECT_PROBES: ReadonlySet<string> = new Set([
|
|
|
195
195
|
* own keys are only the params in the key, so spreading it, or passing it to
|
|
196
196
|
* a client component, carries exactly what the segment may depend on.
|
|
197
197
|
*/
|
|
198
|
-
export function scopedParams<T extends CoercedParams>(
|
|
198
|
+
export function scopedParams<T extends CoercedParams>(
|
|
199
|
+
params: T,
|
|
200
|
+
/**
|
|
201
|
+
* `'slot'` when `params` is a slot's record merged over the main route's
|
|
202
|
+
* (`getSegmentParams(slotPath)`). A key computes a descendant's param from
|
|
203
|
+
* the main route's record, and a slot may define the same name with another
|
|
204
|
+
* value, so a keyed descendant name is refused through it.
|
|
205
|
+
*/
|
|
206
|
+
record: 'route' | 'slot' = 'route'
|
|
207
|
+
): T {
|
|
199
208
|
const scope = currentReadScope();
|
|
200
209
|
if (!scope) return params;
|
|
210
|
+
const throughSlot = (name: string) => record === 'slot' && !scope.pathParams.has(name);
|
|
201
211
|
// Refused: every name the key leaves out — a param on the segment's path, a
|
|
202
212
|
// descendant's or a slot's, present in this request or not. Absence is a
|
|
203
213
|
// value too: a layout reading a child's param that this URL lacks would
|
|
204
214
|
// freeze `undefined` across the URLs that have it. Only the names runtimes
|
|
205
215
|
// probe on any object pass.
|
|
206
216
|
const refused = (name: string | symbol) =>
|
|
207
|
-
typeof name === 'string' &&
|
|
217
|
+
typeof name === 'string' &&
|
|
218
|
+
(!scope.params.has(name) || throughSlot(name)) &&
|
|
219
|
+
!OBJECT_PROBES.has(name);
|
|
208
220
|
const allowed = (name: string | symbol) => !refused(name);
|
|
209
221
|
// Over a copy: the trap hides keys, which a frozen or non-configurable
|
|
210
222
|
// target would forbid, and the request's own record stays untouched.
|
|
@@ -215,7 +227,24 @@ export function scopedParams<T extends CoercedParams>(params: T): T {
|
|
|
215
227
|
return new Proxy(target, {
|
|
216
228
|
get(target, name, receiver) {
|
|
217
229
|
if (refused(name)) {
|
|
218
|
-
|
|
230
|
+
// A key may name only params on the segment's path or, for a layout,
|
|
231
|
+
// ones its children define (the build refuses any other), so "add it
|
|
232
|
+
// to the key" would be a build error here.
|
|
233
|
+
const key = name as string;
|
|
234
|
+
refuseRead(
|
|
235
|
+
scope,
|
|
236
|
+
`the segment param "${key}"`,
|
|
237
|
+
'segmentParams',
|
|
238
|
+
scope.params.has(key)
|
|
239
|
+
? `It is keyed from the route's params, and was read through a slot's, which may ` +
|
|
240
|
+
`hold another value: read it with getSegmentParams() and no slot path.`
|
|
241
|
+
: !scope.keyableParams.has(key)
|
|
242
|
+
? `No key on this segment can name it: it is not on the segment's path, and it is ` +
|
|
243
|
+
`not a param a page below a main-chain layout binds (a page or a slot segment ` +
|
|
244
|
+
`keys only its path). Render what reads it in a segment whose path has it, or ` +
|
|
245
|
+
`declare lifetime: 'request'.`
|
|
246
|
+
: undefined
|
|
247
|
+
);
|
|
219
248
|
}
|
|
220
249
|
return Reflect.get(target, name, receiver);
|
|
221
250
|
},
|
|
@@ -74,16 +74,25 @@ import {
|
|
|
74
74
|
import { clientComponents } from '../vite-handoff-rsc.ts';
|
|
75
75
|
import type { DocumentLifetime } from './segment-key.ts';
|
|
76
76
|
|
|
77
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* The read scope of one `'document'` segment.
|
|
79
|
+
*
|
|
80
|
+
* @param pathParams Every param on the segment's path: the default key.
|
|
81
|
+
* @param descendants The params its `children` chain defines (a layout's;
|
|
82
|
+
* none for a page), which a key may also name.
|
|
83
|
+
*/
|
|
78
84
|
export function readScopeFor(
|
|
79
85
|
segmentPath: string,
|
|
80
86
|
lifetime: DocumentLifetime,
|
|
81
|
-
pathParams: readonly string[]
|
|
87
|
+
pathParams: readonly string[],
|
|
88
|
+
descendants: Iterable<string>
|
|
82
89
|
): DocumentReadScope {
|
|
83
90
|
const { key } = lifetime;
|
|
84
91
|
return {
|
|
85
92
|
segmentPath,
|
|
86
93
|
params: new Set(key.segmentParams ?? pathParams),
|
|
94
|
+
keyableParams: new Set([...pathParams, ...descendants]),
|
|
95
|
+
pathParams: new Set(pathParams),
|
|
87
96
|
searchParams: new Map(
|
|
88
97
|
Object.entries(key.searchParams?.codecs ?? {}).map(([field, codec]) => [
|
|
89
98
|
field,
|