@timber-js/app 0.2.0-alpha.134 → 0.2.0-alpha.135
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-B8Fhsosm.js → actions-CHFblsdT.js} +13 -9
- package/dist/_chunks/actions-CHFblsdT.js.map +1 -0
- package/dist/_chunks/{build-output-helper-K7oUCRqU.js → build-output-helper-CfBfOU9m.js} +1 -1
- package/dist/_chunks/{build-output-helper-K7oUCRqU.js.map → build-output-helper-CfBfOU9m.js.map} +1 -1
- package/dist/_chunks/{codec-registry-DqkeAydt.js → codec-registry-G9hD5LOq.js} +1 -1
- package/dist/_chunks/{codec-registry-DqkeAydt.js.map → codec-registry-G9hD5LOq.js.map} +1 -1
- package/dist/_chunks/{define-jeHDXZGq.js → define-DXWUJb-K.js} +3 -3
- package/dist/_chunks/{define-jeHDXZGq.js.map → define-DXWUJb-K.js.map} +1 -1
- package/dist/_chunks/{define-DMq-Yjp7.js → define-Dp-qu3ql.js} +3 -3
- package/dist/_chunks/{define-DMq-Yjp7.js.map → define-Dp-qu3ql.js.map} +1 -1
- package/dist/_chunks/fast-hash-DXZ7S2D5.js +36 -0
- package/dist/_chunks/fast-hash-DXZ7S2D5.js.map +1 -0
- package/dist/_chunks/{format-BjN9HLu9.js → format-CR6v1pWE.js} +1 -1
- package/dist/_chunks/{format-BjN9HLu9.js.map → format-CR6v1pWE.js.map} +1 -1
- package/dist/_chunks/{handler-store-bIAstrxQ.js → handler-store-aQMpqPe7.js} +1 -1
- package/dist/_chunks/{handler-store-bIAstrxQ.js.map → handler-store-aQMpqPe7.js.map} +1 -1
- package/dist/_chunks/{href-validation-BJmD5mZh.js → href-validation-2G-HZaQ8.js} +8 -8
- package/dist/_chunks/href-validation-2G-HZaQ8.js.map +1 -0
- package/dist/_chunks/{navigation-root-B5-RmsPi.js → navigation-root-BQqFQI-n.js} +3 -3
- package/dist/_chunks/{navigation-root-B5-RmsPi.js.map → navigation-root-BQqFQI-n.js.map} +1 -1
- package/dist/_chunks/{registry-BI9cgCt7.js → registry-Dp_hJL4s.js} +1 -1
- package/dist/_chunks/{registry-BI9cgCt7.js.map → registry-Dp_hJL4s.js.map} +1 -1
- package/dist/_chunks/{resolve-schema-DU2nbVOi.js → resolve-schema-D3CbcdCW.js} +2 -2
- package/dist/_chunks/{resolve-schema-DU2nbVOi.js.map → resolve-schema-D3CbcdCW.js.map} +1 -1
- package/dist/_chunks/{router-ref-B2-2kIIC.js → router-ref-B50j42zB.js} +2 -2
- package/dist/_chunks/{router-ref-B2-2kIIC.js.map → router-ref-B50j42zB.js.map} +1 -1
- package/dist/_chunks/{schema-bridge-o0SwFtXW.js → schema-bridge-Cuy8BaYu.js} +2 -2
- package/dist/_chunks/{schema-bridge-o0SwFtXW.js.map → schema-bridge-Cuy8BaYu.js.map} +1 -1
- package/dist/_chunks/{segment-context-Bg0pFbLT.js → segment-context-BnxoPSFQ.js} +1 -1
- package/dist/_chunks/{segment-context-Bg0pFbLT.js.map → segment-context-BnxoPSFQ.js.map} +1 -1
- package/dist/_chunks/{ssr-data-DVX8S7vj.js → ssr-data-DxXyoRrz.js} +1 -1
- package/dist/_chunks/{ssr-data-DVX8S7vj.js.map → ssr-data-DxXyoRrz.js.map} +1 -1
- package/dist/_chunks/{stale-reload-CCqb62Z3.js → stale-reload-DIIIVGh_.js} +1 -1
- package/dist/_chunks/{stale-reload-CCqb62Z3.js.map → stale-reload-DIIIVGh_.js.map} +1 -1
- package/dist/_chunks/{use-query-states-C9G6LP0F.js → use-query-states-D9SBlAfp.js} +2 -2
- package/dist/_chunks/{use-query-states-C9G6LP0F.js.map → use-query-states-D9SBlAfp.js.map} +1 -1
- package/dist/_chunks/{use-segment-params-CIeinIx2.js → use-segment-params-x2poKmk8.js} +2 -2
- package/dist/_chunks/use-segment-params-x2poKmk8.js.map +1 -0
- package/dist/_chunks/{validation-AfEFM5ze.js → validation-BoWM_qI1.js} +31 -2
- package/dist/_chunks/validation-BoWM_qI1.js.map +1 -0
- package/dist/_chunks/walkers-BbEu2_Pp.js.map +1 -1
- package/dist/adapters/cloudflare.js +1 -1
- package/dist/adapters/nitro.js +1 -1
- package/dist/cache/cache-api.d.ts +1 -1
- package/dist/cache/cache-api.d.ts.map +1 -1
- package/dist/cache/index.js +17 -39
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/timber-cache.d.ts +1 -1
- package/dist/cache/timber-cache.d.ts.map +1 -1
- package/dist/client/error-boundary.js +2 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +10 -10
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.js +8 -8
- package/dist/client/internal.js.map +1 -1
- package/dist/client/link.d.ts.map +1 -1
- package/dist/client/navigation-context.d.ts.map +1 -1
- package/dist/client/use-pathname.d.ts.map +1 -1
- package/dist/client/use-search-params.d.ts.map +1 -1
- package/dist/codec.js +1 -1
- package/dist/cookies/index.js +3 -3
- package/dist/cookies/validation.d.ts +11 -23
- package/dist/cookies/validation.d.ts.map +1 -1
- package/dist/dev-tools/error-page.d.ts.map +1 -1
- package/dist/fonts/virtual-modules.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +106 -3
- package/dist/index.js.map +1 -1
- package/dist/params/define-schema.d.ts.map +1 -1
- package/dist/params/index.js +2 -2
- package/dist/params/index.js.map +1 -1
- package/dist/plugins/cache.d.ts +31 -0
- package/dist/plugins/cache.d.ts.map +1 -0
- package/dist/routing/link-codegen.d.ts.map +1 -1
- package/dist/schema-bridge.d.ts.map +1 -1
- package/dist/search-params/index.js +3 -3
- package/dist/segment-params/index.js +1 -1
- package/dist/server/actions.d.ts.map +1 -1
- package/dist/server/body-limits.d.ts.map +1 -1
- package/dist/server/cookie-context.d.ts +2 -2
- package/dist/server/cookie-context.d.ts.map +1 -1
- package/dist/server/csrf.d.ts +3 -2
- package/dist/server/csrf.d.ts.map +1 -1
- package/dist/server/html-injector-core.d.ts.map +1 -1
- package/dist/server/html-injectors.d.ts.map +1 -1
- package/dist/server/index.js +17 -8
- package/dist/server/index.js.map +1 -1
- package/dist/server/internal.js +50 -13
- package/dist/server/internal.js.map +1 -1
- package/dist/server/pipeline.d.ts.map +1 -1
- package/dist/server/primitives.d.ts.map +1 -1
- package/dist/server/route-element-builder.d.ts.map +1 -1
- package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/revalidate-renderer.d.ts +108 -0
- package/dist/server/rsc-entry/revalidate-renderer.d.ts.map +1 -0
- package/dist/server/rsc-entry/ssr-renderer.d.ts +15 -0
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/sitemap-handler.d.ts.map +1 -1
- package/dist/server/ssr-wrappers.d.ts.map +1 -1
- package/dist/server/tree-builder.d.ts.map +1 -1
- package/dist/shared/href-validation.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/cache/cache-api.ts +3 -2
- package/src/cache/timber-cache.ts +27 -4
- package/src/cli.ts +0 -0
- package/src/client/index.ts +1 -0
- package/src/client/link.tsx +8 -5
- package/src/client/navigation-context.ts +2 -0
- package/src/client/use-pathname.ts +1 -0
- package/src/client/use-search-params.ts +1 -0
- package/src/client/use-segment-params.ts +1 -0
- package/src/config-validation.ts +1 -1
- package/src/cookies/validation.ts +58 -0
- package/src/dev-tools/error-page.ts +1 -0
- package/src/fonts/virtual-modules.ts +2 -0
- package/src/index.ts +5 -1
- package/src/params/define-schema.ts +1 -0
- package/src/plugins/cache.ts +180 -0
- package/src/routing/link-codegen.ts +5 -3
- package/src/schema-bridge.ts +3 -2
- package/src/server/action-client.ts +31 -13
- package/src/server/actions.ts +20 -3
- package/src/server/body-limits.ts +10 -2
- package/src/server/cookie-context.ts +7 -2
- package/src/server/cookie-parsing.ts +1 -1
- package/src/server/csrf.ts +39 -6
- package/src/server/html-injector-core.ts +6 -5
- package/src/server/html-injectors.ts +8 -5
- package/src/server/pipeline.ts +19 -10
- package/src/server/primitives.ts +11 -1
- package/src/server/route-element-builder.ts +2 -0
- package/src/server/rsc-entry/error-renderer.ts +4 -3
- package/src/server/rsc-entry/index.ts +16 -36
- package/src/server/rsc-entry/revalidate-renderer.ts +344 -0
- package/src/server/rsc-entry/ssr-renderer.ts +76 -0
- package/src/server/sitemap-handler.ts +24 -2
- package/src/server/slot-resolver.ts +8 -2
- package/src/server/ssr-wrappers.tsx +2 -0
- package/src/server/tree-builder.ts +2 -0
- package/src/server/types.ts +2 -2
- package/src/shared/href-validation.ts +12 -8
- package/LICENSE +0 -8
- package/dist/_chunks/actions-B8Fhsosm.js.map +0 -1
- package/dist/_chunks/href-validation-BJmD5mZh.js.map +0 -1
- package/dist/_chunks/use-segment-params-CIeinIx2.js.map +0 -1
- package/dist/_chunks/validation-AfEFM5ze.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/server/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAY3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAS9D;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,sEAAsE;IACtE,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IACjD;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IACrD,oEAAoE;IACpE,eAAe,EAAE,YAAY,EAAE,CAAC;CACjC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;GAaG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAqBrF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C;AAID;;;;;;;;;;GAUG;AACH,qBAAa,cAAe,SAAQ,KAAK;aAGrB,KAAK,EAAE,OAAO;gBAD9B,OAAO,EAAE,MAAM,EACC,KAAK,EAAE,OAAO;CAKjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-element-builder.d.ts","sourceRoot":"","sources":["../../src/server/route-element-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAY9D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAc7D,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;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAY9D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAc7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAyCzD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAM7D;AAID;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAID,qDAAqD;AACrD,M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C,kBAAkB,CAAC,CAob7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-renderer.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/error-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAYvD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"error-renderer.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/error-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAYvD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAsHD;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,gBAAgB,EAAE,WAAW,EAAE,EAC/B,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,UAAU,EACjB,eAAe,EAAE,OAAO,EACxB,eAAe,EAAE,qBAAqB,EACtC,WAAW,CAAC,EAAE,eAAe,GAC5B,OAAO,CAAC,QAAQ,CAAC,CAwCnB;AAqID;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,OAAO,EACZ,WAAW,EAAE,mBAAmB,EAChC,eAAe,EAAE,OAAO,EACxB,eAAe,EAAE,qBAAqB,GACrC,OAAO,CAAC,QAAQ,CAAC,CAuCnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/index.ts"],"names":[],"mappings":"AAuBA,OAAO,uCAAuC,CAAC;AAqB/C,OAAO,KAAK,EAAuB,cAAc,EAAc,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/index.ts"],"names":[],"mappings":"AAuBA,OAAO,uCAAuC,CAAC;AAqB/C,OAAO,KAAK,EAAuB,cAAc,EAAc,MAAM,gBAAgB,CAAC;AAoCtF;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAE5E;AAiWD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAInE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,QAAA,MAAiB,QAAQ,qCAGxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,gBAAkB,CAAC;AAE9C,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Revalidation renderer — builds the React element tree for the target
|
|
3
|
+
* path requested by `revalidatePath()` from inside a server action, with
|
|
4
|
+
* the same security guarantees as a normal route render.
|
|
5
|
+
*
|
|
6
|
+
* Before this module existed, `revalidatePath()` matched the route, coerced
|
|
7
|
+
* params, and called `buildRouteElement()` directly. That bypassed the
|
|
8
|
+
* target route's `middleware.ts` chain entirely. An action that revalidated
|
|
9
|
+
* a higher-privilege or user-controlled path could leak an authenticated
|
|
10
|
+
* RSC tree to the action submitter even when middleware on that path
|
|
11
|
+
* would have denied them.
|
|
12
|
+
*
|
|
13
|
+
* The fix (TIM-996) is to run the target route's middleware chain inside
|
|
14
|
+
* a fresh `runWithRequestContext` scope BEFORE building the element tree,
|
|
15
|
+
* propagate `DenySignal` and `RedirectSignal` to `executeAction`, drop the
|
|
16
|
+
* revalidation when middleware returns a short-circuit `Response`, and
|
|
17
|
+
* lift the request-header overlay onto the action's ALS store so the
|
|
18
|
+
* revalidated component render sees middleware-injected headers via
|
|
19
|
+
* `getHeaders()`.
|
|
20
|
+
*
|
|
21
|
+
* The input `path` is also validated as a local root-relative pathname so
|
|
22
|
+
* `revalidatePath('//evil.com/admin')` and similar scheme/authority
|
|
23
|
+
* injections cannot smuggle a foreign host through `new URL(path, base)`.
|
|
24
|
+
*
|
|
25
|
+
* See design/08-forms-and-actions.md §"revalidatePath()" and
|
|
26
|
+
* design/13-security.md §"Server actions silently bypass middleware".
|
|
27
|
+
*/
|
|
28
|
+
import type { BuildManifest } from '../build-manifest.js';
|
|
29
|
+
import type { RouteMatcher } from '../pipeline.js';
|
|
30
|
+
import type { RevalidateRenderer } from '../actions.js';
|
|
31
|
+
import { type CoerceSegmentParamsFn } from './action-middleware-runner.js';
|
|
32
|
+
/**
|
|
33
|
+
* Sentinel thrown when revalidation cannot proceed because middleware
|
|
34
|
+
* returned a short-circuit `Response` (a non-redirect HTTP response that
|
|
35
|
+
* we cannot translate back to an element tree). `executeAction` catches
|
|
36
|
+
* this and drops the revalidation — the action result is still delivered,
|
|
37
|
+
* but no `_tree` is piggybacked onto the response. The matching name
|
|
38
|
+
* `RevalidationDropped` is exported so callers can identify it via
|
|
39
|
+
* `instanceof` without leaking the message text to clients.
|
|
40
|
+
*/
|
|
41
|
+
export declare class RevalidationDropped extends Error {
|
|
42
|
+
constructor(message: string);
|
|
43
|
+
}
|
|
44
|
+
/** Result of validating a `revalidatePath()` argument. */
|
|
45
|
+
type PathValidation = {
|
|
46
|
+
ok: true;
|
|
47
|
+
pathname: string;
|
|
48
|
+
search: string;
|
|
49
|
+
} | {
|
|
50
|
+
ok: false;
|
|
51
|
+
reason: string;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Validate a `revalidatePath()` argument.
|
|
55
|
+
*
|
|
56
|
+
* Accepts local root-relative pathnames only. Rejects anything that
|
|
57
|
+
* `new URL(path, base)` would resolve to a different host or scheme:
|
|
58
|
+
*
|
|
59
|
+
* - Empty / non-string input
|
|
60
|
+
* - Anything not starting with `/` (relative, scheme-bearing, etc.)
|
|
61
|
+
* - Protocol-relative `//evil.com/admin` — resolves to scheme://evil.com
|
|
62
|
+
* - Backslash-prefixed `/\evil.com` — some clients fold `\` into `/`
|
|
63
|
+
* - Control characters and null bytes
|
|
64
|
+
* - Paths that fail canonicalization (encoded separators, `..` escaping
|
|
65
|
+
* root, malformed percent-encoding)
|
|
66
|
+
*
|
|
67
|
+
* The pathname is canonicalized so the rest of the renderer matches the
|
|
68
|
+
* same shape the page pipeline matches.
|
|
69
|
+
*/
|
|
70
|
+
export declare function validateRevalidatePath(path: unknown): PathValidation;
|
|
71
|
+
/** Dependencies for the revalidate renderer factory. */
|
|
72
|
+
export interface RevalidateRendererDeps {
|
|
73
|
+
matchRoute: RouteMatcher;
|
|
74
|
+
coerceSegmentParams: CoerceSegmentParamsFn;
|
|
75
|
+
buildManifest: BuildManifest;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Build a per-request `RevalidateRenderer`.
|
|
79
|
+
*
|
|
80
|
+
* The returned renderer:
|
|
81
|
+
* 1. Validates the requested path.
|
|
82
|
+
* 2. Matches the canonicalized path against the route tree.
|
|
83
|
+
* 3. Coerces segment params via the matched chain's `params.ts` codecs.
|
|
84
|
+
* 4. Runs the matched route's `middleware.ts` chain inside a fresh
|
|
85
|
+
* `runWithRequestContext` scope (via `runMiddlewareForAction`).
|
|
86
|
+
* Deny/redirect signals are re-thrown so `executeAction` can apply
|
|
87
|
+
* its existing redirect handling and the new deny-drop behavior.
|
|
88
|
+
* A short-circuit `Response` becomes `RevalidationDropped`.
|
|
89
|
+
* 5. Lifts the request-header overlay onto the OUTER action's ALS store
|
|
90
|
+
* so the revalidated component render (which happens later inside
|
|
91
|
+
* `renderToReadableStream` in the action's scope) observes
|
|
92
|
+
* middleware-injected headers via `getHeaders()`. Acceptable because
|
|
93
|
+
* revalidation runs after the action body has returned — the only
|
|
94
|
+
* remaining ALS readers are render-phase code that should see the
|
|
95
|
+
* same overlay a normal page render would see.
|
|
96
|
+
* 6. Builds and returns the route element tree, ready for the action
|
|
97
|
+
* handler to serialize alongside the action result.
|
|
98
|
+
*
|
|
99
|
+
* Cookies set inside the revalidation middleware are intentionally NOT
|
|
100
|
+
* propagated to the action response. The middleware on a *different* path
|
|
101
|
+
* setting cookies via the action's response is surprising semantics; the
|
|
102
|
+
* scoped cookie jar on the inner ALS run is discarded with the scope.
|
|
103
|
+
* The primary security boundary closed here is auth — `deny()` from the
|
|
104
|
+
* target's middleware now prevents the revalidated tree from leaking.
|
|
105
|
+
*/
|
|
106
|
+
export declare function createRevalidateRendererFactory(deps: RevalidateRendererDeps): (req: Request) => RevalidateRenderer;
|
|
107
|
+
export {};
|
|
108
|
+
//# sourceMappingURL=revalidate-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revalidate-renderer.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/revalidate-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI1D,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAK/D,OAAO,KAAK,EAAE,kBAAkB,EAAsB,MAAM,eAAe,CAAC;AAE5E,OAAO,EAA0B,KAAK,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEnG;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAED,0DAA0D;AAC1D,KAAK,cAAc,GACf;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC9C;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAElC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAiCpE;AAoBD,wDAAwD;AACxD,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,YAAY,CAAC;IACzB,mBAAmB,EAAE,qBAAqB,CAAC;IAC3C,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,sBAAsB,GAC3B,CAAC,GAAG,EAAE,OAAO,KAAK,kBAAkB,CA6KtC"}
|
|
@@ -29,6 +29,21 @@ import type { RenderSignals } from './rsc-stream.js';
|
|
|
29
29
|
export declare const __test_only_signalPromotionDepth: {
|
|
30
30
|
value: number;
|
|
31
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Test-only observable: true when the promotion loop hit the cap without
|
|
34
|
+
* capturing a signal (the silent-miss path — state 3 in TIM-970). False
|
|
35
|
+
* when the loop captured a signal at any depth, when it was skipped via
|
|
36
|
+
* `_fizzAllReadyResolved`, or when no signal was ever expected at a depth
|
|
37
|
+
* shallower than the cap.
|
|
38
|
+
*
|
|
39
|
+
* Pairs with `__test_only_signalPromotionDepth`: depth alone cannot
|
|
40
|
+
* distinguish "cap hit with signal captured on yield 5" from "cap hit with
|
|
41
|
+
* signal arriving on yield 6+" — both read `.value === 5`. This flag closes
|
|
42
|
+
* that gap. See TIM-970, design/05-streaming.md §"Signal Promotion".
|
|
43
|
+
*/
|
|
44
|
+
export declare const __test_only_signalPromotionCapHit: {
|
|
45
|
+
value: boolean;
|
|
46
|
+
};
|
|
32
47
|
interface SsrRenderOptions {
|
|
33
48
|
req: Request;
|
|
34
49
|
rscStream: ReadableStream<Uint8Array>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-renderer.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/ssr-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAIlE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAY/D,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"ssr-renderer.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/ssr-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAIlE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAY/D,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,KAAK,EAAE,aAAa,E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file":"sitemap-handler.d.ts","sourceRoot":"","sources":["../../src/server/sitemap-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKvD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,WAAW,EACjB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,GAAG,SAAS,CAgH9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-wrappers.d.ts","sourceRoot":"","sources":["../../src/server/ssr-wrappers.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAwEhE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,SAAS,EAClB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,YAAY,EAAE,OAAO,GACpB,SAAS,
|
|
1
|
+
{"version":3,"file":"ssr-wrappers.d.ts","sourceRoot":"","sources":["../../src/server/ssr-wrappers.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAwEhE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,SAAS,EAClB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,YAAY,EAAE,OAAO,GACpB,SAAS,CAgBX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-builder.d.ts","sourceRoot":"","sources":["../../src/server/tree-builder.ts"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AQ,EAAE,MAAM,OAAO,CAAC;IACxB,wFAAwF;IACxF,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IACxC,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,aAAa,EAAE,aAAa,CAAC;IAC7B,eAAe,EAAE,SAAS,CAAC;IAC3B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,iBAAiB,CAAC,EAAE,eAAe,CAAC;IACpC,sEAAsE;IACtE,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAID;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,IAAI,EAAE,SAAS,CAAC;IAChB,gFAAgF;IAChF,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAoF1F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"href-validation.d.ts","sourceRoot":"","sources":["../../src/shared/href-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"href-validation.d.ts","sourceRoot":"","sources":["../../src/shared/href-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAuBH;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAqBzD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUpD;AAID;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAiCpF"}
|
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.135",
|
|
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",
|
|
@@ -114,6 +114,11 @@
|
|
|
114
114
|
"publishConfig": {
|
|
115
115
|
"access": "public"
|
|
116
116
|
},
|
|
117
|
+
"scripts": {
|
|
118
|
+
"build": "vite build --config vite.lib.config.ts && tsc --emitDeclarationOnly --project tsconfig.json --outDir dist",
|
|
119
|
+
"typecheck": "tsgo --noEmit",
|
|
120
|
+
"prepublishOnly": "pnpm run build"
|
|
121
|
+
},
|
|
117
122
|
"dependencies": {
|
|
118
123
|
"@opentelemetry/api": "^1.9.1",
|
|
119
124
|
"@opentelemetry/context-async-hooks": "^2.7.1",
|
|
@@ -157,9 +162,5 @@
|
|
|
157
162
|
},
|
|
158
163
|
"engines": {
|
|
159
164
|
"node": ">=22.12.0"
|
|
160
|
-
},
|
|
161
|
-
"scripts": {
|
|
162
|
-
"build": "vite build --config vite.lib.config.ts && tsc --emitDeclarationOnly --project tsconfig.json --outDir dist",
|
|
163
|
-
"typecheck": "tsgo --noEmit"
|
|
164
165
|
}
|
|
165
|
-
}
|
|
166
|
+
}
|
package/src/cache/cache-api.ts
CHANGED
|
@@ -20,9 +20,10 @@ import { getCacheHandler } from './handler-store';
|
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
21
|
export function cache<Fn extends (...args: any[]) => Promise<any>>(
|
|
22
22
|
fn: Fn,
|
|
23
|
-
opts: CacheOptions<Fn
|
|
23
|
+
opts: CacheOptions<Fn>,
|
|
24
|
+
stableId?: string
|
|
24
25
|
): Fn {
|
|
25
|
-
return createCache(fn, opts, getCacheHandler());
|
|
26
|
+
return createCache(fn, opts, getCacheHandler(), stableId);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -34,8 +34,8 @@ function resolveTags<Fn extends (...args: any[]) => any>(
|
|
|
34
34
|
return opts.tags(...args);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
let
|
|
37
|
+
let unstableIdCounter = 0;
|
|
38
|
+
let hasWarnedUnstableId = false;
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Creates a cached wrapper around an async function.
|
|
@@ -53,9 +53,32 @@ let fnIdCounter = 0;
|
|
|
53
53
|
export function createCache<Fn extends (...args: any[]) => Promise<any>>(
|
|
54
54
|
fn: Fn,
|
|
55
55
|
opts: CacheOptions<Fn>,
|
|
56
|
-
handler: CacheHandler
|
|
56
|
+
handler: CacheHandler,
|
|
57
|
+
stableId?: string
|
|
57
58
|
): Fn {
|
|
58
|
-
|
|
59
|
+
let fnId: string;
|
|
60
|
+
if (stableId) {
|
|
61
|
+
fnId = stableId;
|
|
62
|
+
} else if (opts.key) {
|
|
63
|
+
// Explicit key function — fnId is only used for singleflight, not for
|
|
64
|
+
// cache keys, so a counter is acceptable here.
|
|
65
|
+
fnId = `timber-cache:${unstableIdCounter++}`;
|
|
66
|
+
} else {
|
|
67
|
+
fnId = `timber-cache:unstable:${unstableIdCounter++}`;
|
|
68
|
+
if (
|
|
69
|
+
!hasWarnedUnstableId &&
|
|
70
|
+
typeof process !== 'undefined' &&
|
|
71
|
+
process.env?.NODE_ENV !== 'test'
|
|
72
|
+
) {
|
|
73
|
+
hasWarnedUnstableId = true;
|
|
74
|
+
console.warn(
|
|
75
|
+
'[timber] cache() called without a stable ID or explicit key function. ' +
|
|
76
|
+
'Cache keys will use a process-local counter which is unstable across ' +
|
|
77
|
+
'cold starts. Run through the timber Vite plugin or provide an explicit ' +
|
|
78
|
+
'`key` option to fix this.'
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
59
82
|
const sf = opts.timeoutMs
|
|
60
83
|
? createSingleflight({ timeoutMs: opts.timeoutMs })
|
|
61
84
|
: defaultSingleflight;
|
package/src/cli.ts
CHANGED
|
File without changes
|
package/src/client/index.ts
CHANGED
|
@@ -56,6 +56,7 @@ export type { LinkSegmentParams, OnNavigateHandler, OnNavigateEvent } from './li
|
|
|
56
56
|
//
|
|
57
57
|
// See TIM-624 (original typed Link), TIM-830 (flat searchParams), and
|
|
58
58
|
// TIM-832 (this restructure for overload error UX).
|
|
59
|
+
// eslint-disable-next-line typescript/no-empty-interface -- augmented by codegen
|
|
59
60
|
export interface LinkFunction {
|
|
60
61
|
// intentionally empty — call signatures are provided via codegen
|
|
61
62
|
// augmentation in `.timber/timber-routes.d.ts`.
|
package/src/client/link.tsx
CHANGED
|
@@ -482,11 +482,14 @@ export const Link: LinkFunction = function LinkImpl(props: any) {
|
|
|
482
482
|
// We read current search params directly to avoid unconditional hook calls.
|
|
483
483
|
// On the client, window.location.search is always current; during SSR,
|
|
484
484
|
// getSsrData() provides the request's search params.
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
const
|
|
485
|
+
const internal = isInternalHref(baseHref);
|
|
486
|
+
|
|
487
|
+
// Only preserve search params for internal links — leaking current
|
|
488
|
+
// page params (tokens, UTM, etc.) to external domains is a data leak.
|
|
489
|
+
const resolvedHref =
|
|
490
|
+
preserveSearchParams && internal
|
|
491
|
+
? mergePreservedSearchParams(baseHref, getCurrentSearch(), preserveSearchParams)
|
|
492
|
+
: baseHref;
|
|
490
493
|
|
|
491
494
|
// ─── Click handler ───────────────────────────────────────────
|
|
492
495
|
// Each Link component owns its click handling. The router is
|
|
@@ -102,6 +102,7 @@ export function useNavigationContext(): NavigationState | null {
|
|
|
102
102
|
if (!ctx) return null;
|
|
103
103
|
// useContext may not exist in the RSC environment — caller wraps in try/catch
|
|
104
104
|
if (typeof React.useContext !== 'function') return null;
|
|
105
|
+
// eslint-disable-next-line rules-of-hooks -- conditional on environment, not render path
|
|
105
106
|
return React.useContext(ctx);
|
|
106
107
|
}
|
|
107
108
|
|
|
@@ -203,6 +204,7 @@ export function usePendingNavigationUrl(): string | null {
|
|
|
203
204
|
const ctx = getOrCreatePendingContext();
|
|
204
205
|
if (!ctx) return null;
|
|
205
206
|
if (typeof React.useContext !== 'function') return null;
|
|
207
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- conditional on environment, not render path
|
|
206
208
|
return React.useContext(ctx);
|
|
207
209
|
}
|
|
208
210
|
|
|
@@ -31,6 +31,7 @@ export function usePathname(): string {
|
|
|
31
31
|
// Try reading from NavigationContext (client-side, inside React tree).
|
|
32
32
|
// During SSR, no NavigationProvider is mounted, so this returns null.
|
|
33
33
|
try {
|
|
34
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- conditional on environment, not render path
|
|
34
35
|
const navContext = useNavigationContext();
|
|
35
36
|
if (navContext !== null) {
|
|
36
37
|
return navContext.pathname;
|
|
@@ -41,6 +41,7 @@ function getSearchParams(search: string): URLSearchParams {
|
|
|
41
41
|
*/
|
|
42
42
|
export function useSearchParams(): URLSearchParams {
|
|
43
43
|
try {
|
|
44
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- conditional on environment, not render path
|
|
44
45
|
const navContext = useNavigationContext();
|
|
45
46
|
if (navContext !== null) {
|
|
46
47
|
return getSearchParams(navContext.search);
|
|
@@ -128,6 +128,7 @@ export function useSegmentParams(_segmentPath?: string): Record<string, string |
|
|
|
128
128
|
// During SSR, no NavigationProvider is mounted, so this returns null.
|
|
129
129
|
// When called outside a React component, useContext throws — caught below.
|
|
130
130
|
try {
|
|
131
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- conditional on environment, not render path
|
|
131
132
|
const navContext = useNavigationContext();
|
|
132
133
|
if (navContext !== null) {
|
|
133
134
|
return navContext.params;
|
package/src/config-validation.ts
CHANGED
|
@@ -92,7 +92,7 @@ export function validateConfig(config: TimberUserConfig): ConfigError[] {
|
|
|
92
92
|
field: 'renderTimeoutMs',
|
|
93
93
|
message: `renderTimeoutMs must be a non-negative number (got ${JSON.stringify(config.renderTimeoutMs)}).`,
|
|
94
94
|
value: config.renderTimeoutMs,
|
|
95
|
-
suggestion: 'Use renderTimeoutMs: 30000 (default)
|
|
95
|
+
suggestion: 'Use renderTimeoutMs: 30000 (default). Setting 0 uses a 120s safety ceiling.',
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -104,6 +104,64 @@ function isCookieOctet(code: number): boolean {
|
|
|
104
104
|
* This validator is for the `{ raw: true }` opt-out and for
|
|
105
105
|
* `setFromHeaders` forwarding.
|
|
106
106
|
*/
|
|
107
|
+
// ─── Cookie attribute validation ──────────────────────────────────────────
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Characters that must not appear in path or domain cookie attributes.
|
|
111
|
+
* Semicolons delimit cookie attributes on the wire, so allowing `;` in
|
|
112
|
+
* path or domain would inject extra attributes. CR/LF enable HTTP header
|
|
113
|
+
* injection.
|
|
114
|
+
*/
|
|
115
|
+
const ATTR_INJECTION_RE = /[;\r\n]/;
|
|
116
|
+
|
|
117
|
+
const VALID_SAME_SITE = new Set(['strict', 'lax', 'none']);
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Validate cookie option attributes at runtime to prevent Set-Cookie
|
|
121
|
+
* header injection through unsanitized option values.
|
|
122
|
+
*
|
|
123
|
+
* TypeScript types enforce correct shapes at compile time, but at runtime
|
|
124
|
+
* (e.g. from untyped libraries or user-controlled config) invalid values
|
|
125
|
+
* could inject additional Set-Cookie attributes.
|
|
126
|
+
*/
|
|
127
|
+
export function assertValidCookieOptions(options: {
|
|
128
|
+
sameSite?: string;
|
|
129
|
+
path?: string;
|
|
130
|
+
domain?: string;
|
|
131
|
+
maxAge?: number;
|
|
132
|
+
}): void {
|
|
133
|
+
if (options.sameSite !== undefined) {
|
|
134
|
+
const lower = options.sameSite.toLowerCase();
|
|
135
|
+
if (!VALID_SAME_SITE.has(lower)) {
|
|
136
|
+
throw new Error(
|
|
137
|
+
`[timber] invalid cookie sameSite value ${JSON.stringify(options.sameSite)} — ` +
|
|
138
|
+
`must be 'strict', 'lax', or 'none'.`
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (options.path !== undefined && ATTR_INJECTION_RE.test(options.path)) {
|
|
143
|
+
throw new Error(
|
|
144
|
+
`[timber] invalid cookie path ${JSON.stringify(options.path)} — ` +
|
|
145
|
+
`path must not contain ';', CR, or LF (Set-Cookie header injection).`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
if (options.domain !== undefined && ATTR_INJECTION_RE.test(options.domain)) {
|
|
149
|
+
throw new Error(
|
|
150
|
+
`[timber] invalid cookie domain ${JSON.stringify(options.domain)} — ` +
|
|
151
|
+
`domain must not contain ';', CR, or LF (Set-Cookie header injection).`
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
if (
|
|
155
|
+
options.maxAge !== undefined &&
|
|
156
|
+
(typeof options.maxAge !== 'number' || !Number.isFinite(options.maxAge))
|
|
157
|
+
) {
|
|
158
|
+
throw new Error(
|
|
159
|
+
`[timber] invalid cookie maxAge ${JSON.stringify(options.maxAge)} — ` +
|
|
160
|
+
`maxAge must be a finite number.`
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
107
165
|
export function assertValidCookieValue(name: string, value: string): void {
|
|
108
166
|
if (typeof value !== 'string') {
|
|
109
167
|
throw new Error(`[timber] cookie ${JSON.stringify(name)}: cookie value must be a string.`);
|
|
@@ -53,6 +53,7 @@ function readSourceContext(
|
|
|
53
53
|
contextLines = 3
|
|
54
54
|
): { lines: Array<{ num: number; text: string; highlight: boolean }>; startLine: number } | null {
|
|
55
55
|
try {
|
|
56
|
+
// eslint-disable-next-line no-var-requires -- sync require needed at render time
|
|
56
57
|
const { readFileSync } = require('node:fs');
|
|
57
58
|
const content = readFileSync(filePath, 'utf-8');
|
|
58
59
|
const allLines = content.split('\n');
|
|
@@ -131,6 +131,7 @@ export function generateGoogleVirtualModule(fonts: Iterable<ExtractedFont>): str
|
|
|
131
131
|
'',
|
|
132
132
|
'function createFontResult(family, config) {',
|
|
133
133
|
' return {',
|
|
134
|
+
// eslint-disable-next-line no-template-curly-in-string -- codegen output
|
|
134
135
|
' className: `timber-font-${family.toLowerCase().replace(/\\s+/g, "-")}`,',
|
|
135
136
|
' style: { fontFamily: family },',
|
|
136
137
|
' variable: config?.variable,',
|
|
@@ -171,6 +172,7 @@ export function generateLocalVirtualModule(): string {
|
|
|
171
172
|
'export default function localFont(config) {',
|
|
172
173
|
' const family = config?.family || "Local Font";',
|
|
173
174
|
' return {',
|
|
175
|
+
// eslint-disable-next-line no-template-curly-in-string -- codegen output
|
|
174
176
|
' className: `timber-font-${family.toLowerCase().replace(/\\s+/g, "-")}`,',
|
|
175
177
|
' style: { fontFamily: family },',
|
|
176
178
|
' variable: config?.variable,',
|
package/src/index.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { timberReactProd } from './plugins/react-prod';
|
|
|
29
29
|
import { timberChunks } from './plugins/chunks';
|
|
30
30
|
import { clientChunkGroup } from './plugins/client-chunks';
|
|
31
31
|
import { timberServerBundle } from './plugins/server-bundle';
|
|
32
|
+
import { timberCacheTransform } from './plugins/cache';
|
|
32
33
|
import { timberCloudflareWasm } from './plugins/cloudflare-wasm';
|
|
33
34
|
import { timberAdapterBuild } from './plugins/adapter-build';
|
|
34
35
|
import { timberBuildReport } from './plugins/build-report';
|
|
@@ -70,7 +71,7 @@ export type { Metadata, MetadataRoute, MetadataHandler, MetadataResult } from '.
|
|
|
70
71
|
* This interface is empty by default and populated via codegen.
|
|
71
72
|
* See design/09-typescript.md §"Typed Routes".
|
|
72
73
|
*/
|
|
73
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type, typescript/no-empty-interface
|
|
74
75
|
export interface Routes {}
|
|
75
76
|
|
|
76
77
|
/**
|
|
@@ -464,8 +465,10 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
|
464
465
|
// Validate config and check peer dependencies at startup.
|
|
465
466
|
// Errors are logged to stderr but don't block startup — Vite may
|
|
466
467
|
// still work partially, and the errors guide the user to fix things.
|
|
468
|
+
/* eslint-disable no-var-requires -- sync require for startup validation */
|
|
467
469
|
const { validateConfig, formatConfigErrors, checkPeerDependencies, formatMissingPeers } =
|
|
468
470
|
require('./config-validation.js') as typeof import('./config-validation.js');
|
|
471
|
+
/* eslint-enable no-var-requires */
|
|
469
472
|
|
|
470
473
|
const configErrors = validateConfig(ctx.config);
|
|
471
474
|
if (configErrors.length > 0) {
|
|
@@ -530,6 +533,7 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
|
|
|
530
533
|
timberStaticBuild(ctx),
|
|
531
534
|
timberFonts(ctx),
|
|
532
535
|
timberMdx(ctx),
|
|
536
|
+
timberCacheTransform(ctx),
|
|
533
537
|
timberContent(ctx),
|
|
534
538
|
timberServerBundle(), // Bundle all deps in server environments for prod
|
|
535
539
|
timberCloudflareWasm(ctx), // Externalize WASM for Cloudflare Workers
|
|
@@ -57,6 +57,7 @@ export type CodecForKey<K extends string> = K extends `[[...${string}]]`
|
|
|
57
57
|
* Registry interface augmented by codegen with known filesystem bracket keys.
|
|
58
58
|
* When empty (no codegen yet), ValidDynamicSegmentKeys falls back to string.
|
|
59
59
|
*/
|
|
60
|
+
// eslint-disable-next-line typescript/no-empty-interface -- augmented by codegen
|
|
60
61
|
export interface ValidDynamicSegmentKeysRegistry {}
|
|
61
62
|
|
|
62
63
|
/**
|