@timber-js/app 0.2.0-alpha.144 → 0.2.0-alpha.146
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-DzFMnUAR.js → actions-OIZ8siQu.js} +28 -43
- package/dist/_chunks/actions-OIZ8siQu.js.map +1 -0
- package/dist/_chunks/{handler-store-DjISKYEB.js → handler-store-BVDgyTh7.js} +26 -2
- package/dist/_chunks/handler-store-BVDgyTh7.js.map +1 -0
- package/dist/_chunks/{href-validation-EZktELp8.js → href-validation-DyZIzfMJ.js} +18 -2
- package/dist/_chunks/{href-validation-EZktELp8.js.map → href-validation-DyZIzfMJ.js.map} +1 -1
- package/dist/_chunks/{navigation-root-DLc4s4ZC.js → navigation-root-bUDZLw74.js} +23 -2
- package/dist/_chunks/navigation-root-bUDZLw74.js.map +1 -0
- package/dist/_chunks/tracing-M_zKubhk.js.map +1 -1
- package/dist/adapters/cloudflare.d.ts +1 -15
- package/dist/adapters/cloudflare.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js +10 -28
- package/dist/adapters/cloudflare.js.map +1 -1
- package/dist/adapters/compress-module.d.ts.map +1 -1
- package/dist/adapters/nitro.d.ts.map +1 -1
- package/dist/adapters/nitro.js +18 -5
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/cache/index.js +39 -12
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/redis-handler.d.ts +72 -8
- package/dist/cache/redis-handler.d.ts.map +1 -1
- package/dist/cache/stable-stringify.d.ts +9 -0
- package/dist/cache/stable-stringify.d.ts.map +1 -1
- package/dist/cache/timber-cache.d.ts +3 -1
- package/dist/cache/timber-cache.d.ts.map +1 -1
- package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -1
- package/dist/client/browser-entry/router-init.d.ts.map +1 -1
- package/dist/client/browser-entry/scroll.d.ts +9 -0
- package/dist/client/browser-entry/scroll.d.ts.map +1 -1
- package/dist/client/error-boundary.d.ts.map +1 -1
- package/dist/client/error-boundary.js +11 -6
- package/dist/client/error-boundary.js.map +1 -1
- package/dist/client/index.js +3 -3
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.js +99 -24
- package/dist/client/internal.js.map +1 -1
- package/dist/client/link.d.ts.map +1 -1
- package/dist/client/navigation-api.d.ts.map +1 -1
- package/dist/client/navigation-root.d.ts +13 -0
- package/dist/client/navigation-root.d.ts.map +1 -1
- package/dist/client/router.d.ts +7 -0
- package/dist/client/router.d.ts.map +1 -1
- package/dist/client/rsc-fetch.d.ts.map +1 -1
- package/dist/dev-tools/404-page.d.ts +6 -2
- package/dist/dev-tools/404-page.d.ts.map +1 -1
- package/dist/dev-tools/dev-page-shell.d.ts +77 -0
- package/dist/dev-tools/dev-page-shell.d.ts.map +1 -0
- package/dist/dev-tools/error-page.d.ts +4 -30
- package/dist/dev-tools/error-page.d.ts.map +1 -1
- package/dist/dev-tools/index.d.ts +2 -1
- package/dist/dev-tools/index.d.ts.map +1 -1
- package/dist/dev-tools/instrumentation.d.ts +11 -1
- package/dist/dev-tools/instrumentation.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +430 -253
- package/dist/index.js.map +1 -1
- package/dist/plugins/cache.d.ts +43 -9
- package/dist/plugins/cache.d.ts.map +1 -1
- package/dist/plugins/cloudflare-wasm.d.ts +4 -1
- package/dist/plugins/cloudflare-wasm.d.ts.map +1 -1
- package/dist/plugins/dev-server.d.ts +16 -0
- package/dist/plugins/dev-server.d.ts.map +1 -1
- package/dist/plugins/server-bundle.d.ts.map +1 -1
- package/dist/plugins/shims.d.ts +23 -0
- package/dist/plugins/shims.d.ts.map +1 -1
- package/dist/server/action-handler.d.ts.map +1 -1
- package/dist/server/actions.d.ts +3 -2
- package/dist/server/actions.d.ts.map +1 -1
- package/dist/server/cookie-context.d.ts.map +1 -1
- package/dist/server/cookie-parsing.d.ts.map +1 -1
- package/dist/server/fallback-error.d.ts +2 -2
- package/dist/server/fallback-error.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/node-stream-transforms.d.ts +24 -6
- package/dist/server/node-stream-transforms.d.ts.map +1 -1
- package/dist/server/pipeline.d.ts +11 -0
- package/dist/server/pipeline.d.ts.map +1 -1
- package/dist/server/primitives.d.ts +1 -11
- package/dist/server/primitives.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
- package/dist/server/slot-resolver.d.ts +6 -4
- package/dist/server/slot-resolver.d.ts.map +1 -1
- package/dist/server/ssr-entry.d.ts.map +1 -1
- package/dist/server/tracing.d.ts +2 -1
- package/dist/server/tracing.d.ts.map +1 -1
- package/dist/shared/head-header.d.ts +54 -0
- package/dist/shared/head-header.d.ts.map +1 -0
- package/dist/shared/href-validation.d.ts +11 -0
- package/dist/shared/href-validation.d.ts.map +1 -1
- package/dist/shared/redirect-type.d.ts +17 -0
- package/dist/shared/redirect-type.d.ts.map +1 -0
- package/dist/shims/headers.d.ts +52 -1
- package/dist/shims/headers.d.ts.map +1 -1
- package/dist/shims/navigation-client.d.ts +33 -11
- package/dist/shims/navigation-client.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/adapters/cloudflare.ts +13 -47
- package/src/adapters/compress-module.ts +9 -3
- package/src/adapters/nitro.ts +9 -2
- package/src/cache/redis-handler.ts +77 -13
- package/src/cache/stable-stringify.ts +65 -2
- package/src/cache/timber-cache.ts +25 -13
- package/src/cli.ts +0 -0
- package/src/client/browser-entry/action-dispatch.ts +7 -2
- package/src/client/browser-entry/router-init.ts +2 -1
- package/src/client/browser-entry/scroll.ts +23 -0
- package/src/client/error-boundary.tsx +19 -5
- package/src/client/link.tsx +4 -1
- package/src/client/navigation-api.ts +5 -1
- package/src/client/navigation-root.tsx +16 -0
- package/src/client/router.ts +107 -29
- package/src/client/rsc-fetch.ts +6 -6
- package/src/dev-tools/404-page.ts +22 -123
- package/src/dev-tools/dev-page-shell.ts +256 -0
- package/src/dev-tools/error-page.ts +27 -203
- package/src/dev-tools/index.ts +7 -1
- package/src/dev-tools/instrumentation.ts +39 -2
- package/src/index.ts +1 -0
- package/src/plugins/cache.ts +79 -21
- package/src/plugins/cloudflare-wasm.ts +48 -10
- package/src/plugins/dev-server.ts +32 -8
- package/src/plugins/server-bundle.ts +25 -9
- package/src/plugins/shims.ts +94 -52
- package/src/server/action-handler.ts +10 -2
- package/src/server/actions.ts +3 -2
- package/src/server/compress.ts +11 -2
- package/src/server/cookie-context.ts +11 -0
- package/src/server/cookie-parsing.ts +16 -4
- package/src/server/fallback-error.ts +9 -4
- package/src/server/node-stream-transforms.ts +61 -24
- package/src/server/pipeline.ts +12 -0
- package/src/server/primitives.ts +10 -31
- package/src/server/rsc-entry/index.ts +7 -2
- package/src/server/rsc-entry/rsc-payload.ts +4 -3
- package/src/server/slot-resolver.ts +27 -14
- package/src/server/ssr-entry.ts +17 -28
- package/src/server/tracing.ts +17 -1
- package/src/shared/head-header.ts +69 -0
- package/src/shared/href-validation.ts +24 -0
- package/src/shared/redirect-type.ts +17 -0
- package/src/shims/headers.ts +119 -2
- package/src/shims/navigation-client.ts +48 -27
- package/LICENSE +0 -8
- package/dist/_chunks/actions-DzFMnUAR.js.map +0 -1
- package/dist/_chunks/handler-store-DjISKYEB.js.map +0 -1
- package/dist/_chunks/navigation-root-DLc4s4ZC.js.map +0 -1
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* All chunks stay in C++ Node.js stream buffers until the final
|
|
18
18
|
* Readable.toWeb() conversion for the Response body.
|
|
19
19
|
*/
|
|
20
|
-
import { Transform } from 'node:stream';
|
|
20
|
+
import { PassThrough, Transform, type Readable } from 'node:stream';
|
|
21
21
|
import { SUFFIX_BYTES } from './html-injector-core.js';
|
|
22
22
|
export interface NodeBufferedTransformOptions {
|
|
23
23
|
/**
|
|
@@ -91,13 +91,31 @@ export interface NodeFlightInjectorOptions {
|
|
|
91
91
|
*/
|
|
92
92
|
export declare function createNodeFlightInjector(rscStream: ReadableStream<Uint8Array> | undefined, options?: NodeFlightInjectorOptions): Transform;
|
|
93
93
|
/**
|
|
94
|
-
* Node
|
|
94
|
+
* Run the Node SSR post-processing pipeline with post-shell error handling.
|
|
95
95
|
*
|
|
96
|
-
* Equivalent to wrapStreamWithErrorHandling() in ssr-render.ts
|
|
97
|
-
*
|
|
98
|
-
*
|
|
96
|
+
* Equivalent to wrapStreamWithErrorHandling() in ssr-render.ts: when the
|
|
97
|
+
* stream errors after the shell has flushed (deny/throw inside Suspense,
|
|
98
|
+
* an RSC read timeout in the flight injector, or an upstream Fizz error),
|
|
99
|
+
* the response closes cleanly with a trailing noindex script instead of
|
|
100
|
+
* aborting the connection mid-body. Abort errors (client disconnect,
|
|
101
|
+
* render-timeout abort) close the output silently — no noindex, no log.
|
|
102
|
+
*
|
|
103
|
+
* Why this is a pump function and not a Transform stage (TIM-1019):
|
|
104
|
+
* stream.promises.pipeline() destroys every stage in the chain when any
|
|
105
|
+
* stage errors, so a Transform *inside* the pipeline can never append
|
|
106
|
+
* bytes after a failure — by the time its 'error' listener fires, the
|
|
107
|
+
* transform and everything downstream are already destroyed and push()/
|
|
108
|
+
* end() are no-ops. The output PassThrough therefore lives OUTSIDE the
|
|
109
|
+
* pipeline() call: the last stage pipes into it (pipe() ends the output
|
|
110
|
+
* on upstream success but leaves it open on upstream error), and the
|
|
111
|
+
* pipeline's rejection handler appends the noindex script.
|
|
112
|
+
*
|
|
113
|
+
* Consumer cancellation (e.g. Readable.toWeb() cancel on client
|
|
114
|
+
* disconnect) is wired back into the pipeline via an AbortSignal so the
|
|
115
|
+
* source and all stages are torn down — the teardown that membership in
|
|
116
|
+
* pipeline() used to provide.
|
|
99
117
|
*/
|
|
100
|
-
export declare function
|
|
118
|
+
export declare function runNodePipelineWithErrorHandling(source: Readable, transforms: readonly [Transform, ...Transform[]], signal?: AbortSignal): PassThrough;
|
|
101
119
|
/**
|
|
102
120
|
* Create a Node.js gzip Transform using native node:zlib.
|
|
103
121
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-stream-transforms.d.ts","sourceRoot":"","sources":["../../src/server/node-stream-transforms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"node-stream-transforms.d.ts","sourceRoot":"","sources":["../../src/server/node-stream-transforms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIpE,OAAO,EAGL,YAAY,EAOb,MAAM,yBAAyB,CAAC;AAMjC,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,GAAE,4BAAiC,GAAG,SAAS,CA2BjG;AAID;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,IAAI,SAAS,CAoBzD;AAGD,OAAO,EAAE,YAAY,EAAE,CAAC;AAIxB;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CA2BlE;AAID;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iEAAiE;IACjE,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,SAAS,EACjD,OAAO,CAAC,EAAE,yBAAyB,GAClC,SAAS,CA6DX;AAaD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,QAAQ,EAChB,UAAU,EAAE,SAAS,CAAC,SAAS,EAAE,GAAG,SAAS,EAAE,CAAC,EAChD,MAAM,CAAC,EAAE,WAAW,GACnB,WAAW,CAgCb;AAmBD;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,cAAc,EAAE,OAAO,EACvB,eAAe,EAAE,OAAO,GACvB,SAAS,GAAG,IAAI,CA8BlB"}
|
|
@@ -150,6 +150,17 @@ export interface PipelineConfig {
|
|
|
150
150
|
env: string | null;
|
|
151
151
|
stack: unknown[] | null;
|
|
152
152
|
}>) => void;
|
|
153
|
+
/**
|
|
154
|
+
* HMR connection options for dev-only HTML pages (dev 404 page, fallback
|
|
155
|
+
* error page) — set by the dev server after the RSC entry module is
|
|
156
|
+
* imported, like `devPipelineErrorHandler`. The RSC environment can't
|
|
157
|
+
* read the Vite server config (separate module graph), so the dev server
|
|
158
|
+
* plumbs the resolved HMR endpoint (protocol/host/port/path/token) here
|
|
159
|
+
* for the pages' auto-reload WebSocket. See TIM-1067.
|
|
160
|
+
*
|
|
161
|
+
* Undefined in production — zero overhead.
|
|
162
|
+
*/
|
|
163
|
+
devHmrOptions?: import('../dev-tools/dev-page-shell.js').DevErrorHmrOptions;
|
|
153
164
|
/**
|
|
154
165
|
* Fallback error renderer — called when a catastrophic error escapes the
|
|
155
166
|
* render phase. Produces an HTML Response instead of a bare empty 500.
|
|
@@ -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,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AQ,CAAC,CAAC;IAClC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,CACnB,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,OAAO,EACZ,eAAe,EAAE,OAAO;IACxB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,UAAU,KACf,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACnC;AAID;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAmK1F"}
|
|
@@ -60,17 +60,7 @@ export declare function deny(statusOrOptions?: number | DenyOptions, data?: Json
|
|
|
60
60
|
* @internal
|
|
61
61
|
*/
|
|
62
62
|
export declare function notFound(): never;
|
|
63
|
-
|
|
64
|
-
* Next.js redirect type discriminator.
|
|
65
|
-
*
|
|
66
|
-
* Provided for API compatibility with libraries that import `RedirectType`
|
|
67
|
-
* from `next/navigation`. In timber, `redirect()` always uses `replace`
|
|
68
|
-
* semantics (no history entry for the redirect itself).
|
|
69
|
-
*/
|
|
70
|
-
export declare const RedirectType: {
|
|
71
|
-
readonly push: "push";
|
|
72
|
-
readonly replace: "replace";
|
|
73
|
-
};
|
|
63
|
+
export { RedirectType } from '../shared/redirect-type.js';
|
|
74
64
|
/**
|
|
75
65
|
* Render-phase signal thrown by `redirect()` and `redirectExternal()`.
|
|
76
66
|
* Caught by the framework to produce a 3xx response or client-side navigation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../src/server/primitives.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../src/server/primitives.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAYnD;;;;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E,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":"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;
|
|
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;AAsWD,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsc-payload.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/rsc-payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"rsc-payload.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/rsc-payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAQ/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,cAAc,CAAC,UAAU,CAAC,EACrC,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,gBAAgB,EAAE,oBAAoB,EAAE,EACxC,YAAY,EAAE,WAAW,EAAE,EAC3B,KAAK,EAAE,UAAU,EACjB,eAAe,EAAE,OAAO,EACxB,eAAe,CAAC,EAAE,MAAM,EAAE,GACzB,OAAO,CAAC,QAAQ,CAAC,CAqKnB"}
|
|
@@ -24,10 +24,12 @@ type CreateElementFn = (...args: unknown[]) => React.ReactElement;
|
|
|
24
24
|
* Finds a matching page in the slot's sub-tree for the current route.
|
|
25
25
|
* Falls back to default.tsx if no match, or null if no default.
|
|
26
26
|
*
|
|
27
|
-
* When a match is found, the element is wrapped
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* When a match is found, the element is wrapped per segment in the slot's
|
|
28
|
+
* matched chain with (innermost → outermost):
|
|
29
|
+
* 1. Error boundaries
|
|
30
|
+
* 2. Layout
|
|
31
|
+
* 3. SlotAccessGate if the segment has access.ts (gate OUTSIDE the layout,
|
|
32
|
+
* so a denied layout never executes — see TIM-1074)
|
|
31
33
|
*/
|
|
32
34
|
export declare function resolveSlotElement(slotNode: ManifestSegmentNode, match: RouteMatch, h: CreateElementFn, interception?: InterceptionContext, parentTreePath?: string): Promise<React.ReactElement | null>;
|
|
33
35
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot-resolver.d.ts","sourceRoot":"","sources":["../../src/server/slot-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAQH,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAK9D,KAAK,eAAe,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,KAAK,CAAC,YAAY,CAAC;AAgClE
|
|
1
|
+
{"version":3,"file":"slot-resolver.d.ts","sourceRoot":"","sources":["../../src/server/slot-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAQH,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAK9D,KAAK,eAAe,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,KAAK,CAAC,YAAY,CAAC;AAgClE;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,UAAU,EACjB,CAAC,EAAE,eAAe,EAClB,YAAY,CAAC,EAAE,mBAAmB,EAClC,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAqHpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-entry.d.ts","sourceRoot":"","sources":["../../src/server/ssr-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,uCAAuC,CAAC;AA4B/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ssr-entry.d.ts","sourceRoot":"","sources":["../../src/server/ssr-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,uCAAuC,CAAC;AA4B/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAiDxD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,cAAc,CAAC,UAAU,CAAC,EACrC,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,QAAQ,CAAC,CAiMnB;AAED,eAAe,SAAS,CAAC"}
|
package/dist/server/tracing.d.ts
CHANGED
|
@@ -56,7 +56,8 @@ export declare function getTraceStore(): TraceStore | undefined;
|
|
|
56
56
|
* our DevSpanProcessor alongside theirs. If no SDK is configured,
|
|
57
57
|
* we create a BasicTracerProvider with our processor.
|
|
58
58
|
*
|
|
59
|
-
*
|
|
59
|
+
* Idempotent across module re-evaluations (HMR) — only the first call
|
|
60
|
+
* registers. Only called in dev mode — zero overhead in production.
|
|
60
61
|
*/
|
|
61
62
|
export declare function initDevTracing(config: import('../dev-tools/logger.js').DevLoggerConfig): Promise<void>;
|
|
62
63
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../src/server/tracing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG9D,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAIpD;;;;;;;GAOG;AACH,wBAAgB,UAAU,IAAI,MAAM,CASnC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAE9C;AAID;;;GAGG;AACH,wBAAg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wB,EAAE,eAAe,GACvD,OAAO,CAAC,IAAI,CAAC,CA4Cf;AA4BD;;GAEG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,OAAO,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC,CAUrF;AAED;;;;;;;;;GASG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAC9B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EACrD,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACvB,OAAO,CAAC,CAAC,CAAC,CAyBZ;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAC/B,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACrD,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACrD,IAAI,CASN;AAED;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAC,CAc/F"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared encode/decode for the X-Timber-Head response header.
|
|
3
|
+
*
|
|
4
|
+
* Head elements (title, meta, link) are forwarded to the client as a JSON
|
|
5
|
+
* payload in a response header on both the navigation path (RSC payload
|
|
6
|
+
* responses) and the action-revalidation path. HTTP header values must be
|
|
7
|
+
* ByteStrings — any character above U+00FF (em dash, curly quotes, emoji,
|
|
8
|
+
* CJK) makes `new Response(...)` throw. Percent-encoding via
|
|
9
|
+
* encodeURIComponent keeps the value ASCII-safe.
|
|
10
|
+
*
|
|
11
|
+
* This module is the single source of truth for the wire format. Both
|
|
12
|
+
* server emit sites (rsc-entry/rsc-payload.ts, action-handler.ts) and both
|
|
13
|
+
* client parse sites (rsc-fetch.ts, browser-entry/action-dispatch.ts) MUST
|
|
14
|
+
* use it — changing one side alone breaks the other. See TIM-1058.
|
|
15
|
+
*
|
|
16
|
+
* Isomorphic: no server or client imports allowed here.
|
|
17
|
+
*
|
|
18
|
+
* See design/16-metadata.md and design/08-forms-and-actions.md.
|
|
19
|
+
*/
|
|
20
|
+
/** Header name for resolved head elements. */
|
|
21
|
+
export declare const HEAD_HEADER = "X-Timber-Head";
|
|
22
|
+
/**
|
|
23
|
+
* Maximum encoded payload size in characters (ASCII after encoding, so
|
|
24
|
+
* characters === bytes). Headers aren't meant for unbounded payloads;
|
|
25
|
+
* oversized head metadata is skipped rather than truncated — the client
|
|
26
|
+
* keeps its current head, which degrades gracefully.
|
|
27
|
+
*/
|
|
28
|
+
export declare const HEAD_HEADER_MAX_LENGTH = 4096;
|
|
29
|
+
/**
|
|
30
|
+
* A rendered head element descriptor — the structural shape on the wire.
|
|
31
|
+
* Matches the server's `HeadElement` (route-element-builder.ts); the client
|
|
32
|
+
* narrows `tag` to 'title' | 'meta' | 'link' when applying to the DOM.
|
|
33
|
+
*/
|
|
34
|
+
export interface HeadElementPayload {
|
|
35
|
+
tag: string;
|
|
36
|
+
content?: string;
|
|
37
|
+
attrs?: Record<string, string | null>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Encode head elements for the X-Timber-Head header.
|
|
41
|
+
*
|
|
42
|
+
* Returns the percent-encoded JSON string, or null when the encoded
|
|
43
|
+
* payload exceeds HEAD_HEADER_MAX_LENGTH (caller skips the header).
|
|
44
|
+
*/
|
|
45
|
+
export declare function encodeHeadHeader(headElements: HeadElementPayload[]): string | null;
|
|
46
|
+
/**
|
|
47
|
+
* Decode an X-Timber-Head header value back into head elements.
|
|
48
|
+
*
|
|
49
|
+
* Returns null when the value is missing or malformed (corrupted
|
|
50
|
+
* percent-encoding or invalid JSON) — callers treat null as "no head
|
|
51
|
+
* update" rather than failing the navigation or action.
|
|
52
|
+
*/
|
|
53
|
+
export declare function decodeHeadHeader(header: string | null): HeadElementPayload[] | null;
|
|
54
|
+
//# sourceMappingURL=head-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"head-header.d.ts","sourceRoot":"","sources":["../../src/shared/head-header.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,8CAA8C;AAC9C,eAAO,MAAM,WAAW,kBAAkB,CAAC;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,kBAAkB,EAAE,GAAG,MAAM,GAAG,IAAI,CAGlF;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,kBAAkB,EAAE,GAAG,IAAI,CAQnF"}
|
|
@@ -25,6 +25,17 @@ export declare function validateNavigationHref(href: string): void;
|
|
|
25
25
|
* correctly identified as having a scheme (and thus not internal).
|
|
26
26
|
*/
|
|
27
27
|
export declare function isInternalHref(href: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Assert that a redirect target is a relative path — rejects absolute and
|
|
30
|
+
* protocol-relative URLs. Used by both the server `redirect()` primitive and
|
|
31
|
+
* the client next/navigation shim so they enforce identical semantics.
|
|
32
|
+
*
|
|
33
|
+
* Normalizes for validation only: strips C0 controls, trims, then replaces
|
|
34
|
+
* backslashes with forward slashes. Browsers normalize \ → / during URL
|
|
35
|
+
* resolution, so "/\evil.com" becomes "//evil.com" (protocol-relative open
|
|
36
|
+
* redirect). See design/13-security.md tests #8, #8a–#8c.
|
|
37
|
+
*/
|
|
38
|
+
export declare function assertRelativeRedirectPath(path: string): void;
|
|
28
39
|
/**
|
|
29
40
|
* Validate and canonicalize an external redirect URL.
|
|
30
41
|
*
|
|
@@ -1 +1 @@
|
|
|
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"}
|
|
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;AAKD;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAS7D;AAID;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAiCpF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next.js redirect type discriminator.
|
|
3
|
+
*
|
|
4
|
+
* Provided for API compatibility with libraries that import `RedirectType`
|
|
5
|
+
* from `next/navigation`. In timber, `redirect()` always uses `replace`
|
|
6
|
+
* semantics (no history entry for the redirect itself).
|
|
7
|
+
*
|
|
8
|
+
* Lives in shared/ (isomorphic) so both the server primitives and the
|
|
9
|
+
* client-only next/navigation shim export the same definition without the
|
|
10
|
+
* client shim pulling in server code.
|
|
11
|
+
*/
|
|
12
|
+
export declare const RedirectType: {
|
|
13
|
+
readonly push: "push";
|
|
14
|
+
readonly replace: "replace";
|
|
15
|
+
};
|
|
16
|
+
export type RedirectTypeValue = (typeof RedirectType)[keyof typeof RedirectType];
|
|
17
|
+
//# sourceMappingURL=redirect-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirect-type.d.ts","sourceRoot":"","sources":["../../src/shared/redirect-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
|
package/dist/shims/headers.d.ts
CHANGED
|
@@ -4,7 +4,58 @@
|
|
|
4
4
|
* Imports from @timber-js/app/server which Vite resolves to dist/server/index.js
|
|
5
5
|
* via native package.json exports. This ensures the same ALS singleton as the
|
|
6
6
|
* pipeline (both import from the same shared request-context chunk in dist/).
|
|
7
|
+
*
|
|
8
|
+
* `cookies()` is NOT a bare alias of `getCookieJar()`: Next.js's
|
|
9
|
+
* RequestCookies returns `{ name, value }` RequestCookie objects from
|
|
10
|
+
* `.get()`/`.getAll()`, while timber's native jar returns bare strings from
|
|
11
|
+
* `.get()`. Ecosystem libraries written against the real API use
|
|
12
|
+
* `(await cookies()).get('session')?.value` — with the bare-string shape
|
|
13
|
+
* that silently reads `undefined` off a string. The adapter below presents
|
|
14
|
+
* the Next shape while delegating every operation to the timber jar, so the
|
|
15
|
+
* encoding contract, cookie-octet validation, and mutable-context checks
|
|
16
|
+
* (design/29-cookies.md, ONGOING_SECURITY.md H-3) apply unchanged.
|
|
17
|
+
* See TIM-1042 and design/14-ecosystem.md §next/headers.
|
|
7
18
|
*/
|
|
19
|
+
import type { CookieOptions, SetCookieOptions } from '@timber-js/app/server';
|
|
8
20
|
export { getHeaders, getCookieJar } from '@timber-js/app/server';
|
|
9
|
-
export { getHeaders as headers
|
|
21
|
+
export { getHeaders as headers } from '@timber-js/app/server';
|
|
22
|
+
/** Next.js's request cookie shape: `cookies().get(name)` → `{ name, value }`. */
|
|
23
|
+
export interface RequestCookie {
|
|
24
|
+
name: string;
|
|
25
|
+
value: string;
|
|
26
|
+
}
|
|
27
|
+
/** Next.js's `cookies().set()` options — `expires` may be a ms timestamp. */
|
|
28
|
+
export interface NextCookieOptions extends Omit<SetCookieOptions, 'expires'> {
|
|
29
|
+
expires?: Date | number;
|
|
30
|
+
}
|
|
31
|
+
/** Next.js's object overload for `cookies().set({ name, value, ...options })`. */
|
|
32
|
+
export interface NextCookieListItem extends NextCookieOptions {
|
|
33
|
+
name: string;
|
|
34
|
+
value: string;
|
|
35
|
+
}
|
|
36
|
+
/** Next.js's RequestCookies surface, backed by timber's cookie jar. */
|
|
37
|
+
export interface NextRequestCookies {
|
|
38
|
+
get(name: string): RequestCookie | undefined;
|
|
39
|
+
get(cookie: RequestCookie): RequestCookie | undefined;
|
|
40
|
+
getAll(name?: string): RequestCookie[];
|
|
41
|
+
getAll(cookie: RequestCookie): RequestCookie[];
|
|
42
|
+
has(name: string): boolean;
|
|
43
|
+
readonly size: number;
|
|
44
|
+
set(name: string, value: string, options?: NextCookieOptions): void;
|
|
45
|
+
set(cookie: NextCookieListItem): void;
|
|
46
|
+
delete(name: string): void;
|
|
47
|
+
delete(cookie: {
|
|
48
|
+
name: string;
|
|
49
|
+
} & Pick<CookieOptions, 'path' | 'domain'>): void;
|
|
50
|
+
[Symbol.iterator](): IterableIterator<[string, RequestCookie]>;
|
|
51
|
+
toString(): string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Next.js compat: `cookies()` returning the RequestCookies shape.
|
|
55
|
+
*
|
|
56
|
+
* Next.js 15 makes `cookies()` async; awaiting this sync return value works
|
|
57
|
+
* for both the `(await cookies()).get()` and legacy `cookies().get()` call
|
|
58
|
+
* styles, so libraries targeting either Next version resolve correctly.
|
|
59
|
+
*/
|
|
60
|
+
export declare function cookies(): NextRequestCookies;
|
|
10
61
|
//# sourceMappingURL=headers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../src/shims/headers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../src/shims/headers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG7E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGjE,OAAO,EAAE,UAAU,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE9D,iFAAiF;AACjF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,6EAA6E;AAC7E,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC;IAC1E,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;CACzB;AAED,kFAAkF;AAClF,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;IAC7C,GAAG,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC;IACtD,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,EAAE,CAAC;IACvC,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,EAAE,CAAC;IAC/C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpE,GAAG,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACtC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG,IAAI,CAAC;IAChF,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;IAC/D,QAAQ,IAAI,MAAM,CAAC;CACpB;AAUD;;;;;;GAMG;AACH,wBAAgB,OAAO,IAAI,kBAAkB,CAqD5C"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shim: next/navigation (client environment only)
|
|
3
3
|
*
|
|
4
|
-
* Re-exports
|
|
5
|
-
*
|
|
6
|
-
* server/primitives.ts
|
|
4
|
+
* Re-exports the client-side hooks from timber's client API, and implements
|
|
5
|
+
* client-render `redirect()` / `permanentRedirect()` / `notFound()` without
|
|
6
|
+
* pulling server/primitives.ts into the browser bundle.
|
|
7
|
+
*
|
|
8
|
+
* Next.js supports calling redirect()/notFound() during client component
|
|
9
|
+
* render. timber matches that by throwing a plain Error carrying the same
|
|
10
|
+
* JSON digest the server pipeline attaches to RedirectSignal/DenySignal.
|
|
11
|
+
* TimberErrorBoundary recognizes the digest and converts it to an SPA
|
|
12
|
+
* navigation (redirect) or a status-code fallback (notFound), and
|
|
13
|
+
* browser-dev's isFrameworkSignalError() keeps it out of the dev overlay.
|
|
7
14
|
*
|
|
8
15
|
* The full shim (navigation.ts) is still used in the RSC and SSR environments
|
|
9
|
-
* where
|
|
16
|
+
* where the real server primitives produce proper HTTP responses.
|
|
10
17
|
*
|
|
11
18
|
* Imports use @timber-js/app/client (not #/ subpath imports) so they resolve
|
|
12
19
|
* to the same module instances as user code in Vite dev — preventing module
|
|
@@ -15,14 +22,29 @@
|
|
|
15
22
|
*
|
|
16
23
|
* See design/14-ecosystem.md §"next/navigation" for the full shim audit.
|
|
17
24
|
*/
|
|
18
|
-
|
|
25
|
+
import type { RedirectTypeValue } from '../shared/redirect-type.js';
|
|
26
|
+
export { useSegmentParams, useSegmentParams as useParams } from '../client/use-segment-params.js';
|
|
19
27
|
export { useSearchParams } from '../client/use-search-params.js';
|
|
20
28
|
export { usePathname, useRouter, useSelectedLayoutSegment, useSelectedLayoutSegments, } from '@timber-js/app/client';
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
export { RedirectType } from '../shared/redirect-type.js';
|
|
30
|
+
/**
|
|
31
|
+
* Client-render redirect. Throws a redirect-digest error that the nearest
|
|
32
|
+
* TimberErrorBoundary converts into an SPA navigation (replace semantics).
|
|
33
|
+
*
|
|
34
|
+
* The optional RedirectType argument is accepted for Next.js API
|
|
35
|
+
* compatibility but ignored — timber always uses replace semantics,
|
|
36
|
+
* matching the server-side redirect().
|
|
37
|
+
*/
|
|
38
|
+
export declare function redirect(path: string, _type?: RedirectTypeValue): never;
|
|
39
|
+
/**
|
|
40
|
+
* Client-render permanent redirect. On the client there is no HTTP status —
|
|
41
|
+
* this behaves identically to redirect() apart from the digest's status.
|
|
42
|
+
*/
|
|
43
|
+
export declare function permanentRedirect(path: string, _type?: RedirectTypeValue): never;
|
|
44
|
+
/**
|
|
45
|
+
* Client-render notFound. Throws a deny-digest error (status 404) that the
|
|
46
|
+
* nearest matching TimberErrorBoundary renders as the 404 fallback. The
|
|
47
|
+
* message matches DenySignal's so digest-less fallback parsing still works.
|
|
48
|
+
*/
|
|
27
49
|
export declare function notFound(): never;
|
|
28
50
|
//# sourceMappingURL=navigation-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-client.d.ts","sourceRoot":"","sources":["../../src/shims/navigation-client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"navigation-client.d.ts","sourceRoot":"","sources":["../../src/shims/navigation-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAIpE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,IAAI,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EACL,WAAW,EACX,SAAS,EACT,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAS1D;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAGvE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAGhF;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,IAAI,KAAK,CAEhC"}
|
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.146",
|
|
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,12 +114,17 @@
|
|
|
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",
|
|
120
125
|
"@opentelemetry/sdk-trace-base": "^2.7.1",
|
|
121
126
|
"magic-string": "^0.30.21",
|
|
122
|
-
"nitro": "3.0.
|
|
127
|
+
"nitro": "3.0.260603-beta"
|
|
123
128
|
},
|
|
124
129
|
"peerDependencies": {
|
|
125
130
|
"@content-collections/core": "^0.14.0",
|
|
@@ -129,10 +134,9 @@
|
|
|
129
134
|
"@vitejs/plugin-react": "^6.0.0",
|
|
130
135
|
"@vitejs/plugin-rsc": ">=0.5.27",
|
|
131
136
|
"nuqs": "^2.0.0",
|
|
132
|
-
"react": "
|
|
133
|
-
"react-dom": "
|
|
134
|
-
"
|
|
135
|
-
"vite": "^8.0.13",
|
|
137
|
+
"react": "19.2.7",
|
|
138
|
+
"react-dom": "19.2.7",
|
|
139
|
+
"vite": "^8.0.16",
|
|
136
140
|
"wrangler": "^4.0.0",
|
|
137
141
|
"zod": "^3.22.0 || ^4.0.0"
|
|
138
142
|
},
|
|
@@ -158,9 +162,5 @@
|
|
|
158
162
|
},
|
|
159
163
|
"engines": {
|
|
160
164
|
"node": ">=22.12.0"
|
|
161
|
-
},
|
|
162
|
-
"scripts": {
|
|
163
|
-
"build": "vite build --config vite.lib.config.ts && tsc --emitDeclarationOnly --project tsconfig.json --outDir dist",
|
|
164
|
-
"typecheck": "tsgo --noEmit"
|
|
165
165
|
}
|
|
166
166
|
}
|
|
@@ -72,7 +72,7 @@ export function getCloudflareBindings<T = Record<string, unknown>>(): T {
|
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* Run a function with Cloudflare bindings available via getCloudflareBindings().
|
|
75
|
-
* @internal Used by
|
|
75
|
+
* @internal Used by cloudflareDevBindings() to wrap dev-server requests.
|
|
76
76
|
*/
|
|
77
77
|
export function runWithBindings<T>(env: Record<string, unknown>, fn: () => T): T {
|
|
78
78
|
return getBindingsAls().run(env, fn);
|
|
@@ -278,45 +278,11 @@ export function cloudflare(options: CloudflareAdapterOptions = {}): TimberPlatfo
|
|
|
278
278
|
await spawnPreviewProcess(cmd.command, cmd.args, cmd.cwd);
|
|
279
279
|
},
|
|
280
280
|
|
|
281
|
-
//
|
|
282
|
-
//
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Wrap a timber request handler to bind the Cloudflare execution context
|
|
289
|
-
* for `waitUntil()` support and env bindings passthrough.
|
|
290
|
-
* Called from the generated worker entry.
|
|
291
|
-
*
|
|
292
|
-
* This function:
|
|
293
|
-
* 1. Binds `adapter.waitUntil()` to `ctx.waitUntil()` per-request
|
|
294
|
-
* 2. Makes `env` accessible via `getCloudflareBindings()` per-request via ALS
|
|
295
|
-
*/
|
|
296
|
-
export function wrapWithExecutionContext(
|
|
297
|
-
adapter: TimberPlatformAdapter,
|
|
298
|
-
handler: (req: Request) => Promise<Response>
|
|
299
|
-
): CfExportedHandler<Record<string, unknown>> {
|
|
300
|
-
return {
|
|
301
|
-
async fetch(
|
|
302
|
-
request: Request,
|
|
303
|
-
env: Record<string, unknown>,
|
|
304
|
-
ctx: CfExecutionContext
|
|
305
|
-
): Promise<Response> {
|
|
306
|
-
// Bind the adapter's waitUntil to the Workers execution context
|
|
307
|
-
const originalWaitUntil = adapter.waitUntil;
|
|
308
|
-
adapter.waitUntil = (promise: Promise<unknown>) => {
|
|
309
|
-
ctx.waitUntil(promise);
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
try {
|
|
313
|
-
// Run the handler within ALS so getCloudflareBindings() works
|
|
314
|
-
return await runWithBindings(env, () => handler(request));
|
|
315
|
-
} finally {
|
|
316
|
-
// Restore (in case adapter is reused across isolate resets)
|
|
317
|
-
adapter.waitUntil = originalWaitUntil;
|
|
318
|
-
}
|
|
319
|
-
},
|
|
281
|
+
// No adapter-level waitUntil: on Workers there is no ambient
|
|
282
|
+
// ExecutionContext outside a request, so support is provided
|
|
283
|
+
// per-request by the generated _worker.js, which bridges
|
|
284
|
+
// ctx.waitUntil() into the ALS via runWithWaitUntil().
|
|
285
|
+
// See design/11-platform.md §"waitUntil()".
|
|
320
286
|
};
|
|
321
287
|
}
|
|
322
288
|
|
|
@@ -354,7 +320,7 @@ export function generateWorkerEntry(
|
|
|
354
320
|
// Do not edit — this file is regenerated on each build.
|
|
355
321
|
|
|
356
322
|
import { AsyncLocalStorage } from 'node:async_hooks'
|
|
357
|
-
${manifestImport}import handler from '${rscEntryRelative}'
|
|
323
|
+
${manifestImport}import handler, { runWithWaitUntil } from '${rscEntryRelative}'
|
|
358
324
|
${handlersImport}
|
|
359
325
|
// Set TIMBER_RUNTIME for instrumentation.ts conditional SDK initialization.
|
|
360
326
|
// See design/25-production-deployments.md §"TIMBER_RUNTIME".
|
|
@@ -372,7 +338,12 @@ if (!bindingsAls) {
|
|
|
372
338
|
|
|
373
339
|
export default {
|
|
374
340
|
${handlersSpread} async fetch(request, env, ctx) {
|
|
375
|
-
|
|
341
|
+
// Bridge ctx.waitUntil into the per-request ALS so waitUntil() calls in
|
|
342
|
+
// user code keep the isolate alive after the response is sent.
|
|
343
|
+
// See design/11-platform.md §"waitUntil()".
|
|
344
|
+
return bindingsAls.run(env, () =>
|
|
345
|
+
runWithWaitUntil((promise) => ctx.waitUntil(promise), () => handler(request))
|
|
346
|
+
)
|
|
376
347
|
}
|
|
377
348
|
}
|
|
378
349
|
`;
|
|
@@ -592,8 +563,3 @@ export interface CfExecutionContext {
|
|
|
592
563
|
waitUntil(promise: Promise<unknown>): void;
|
|
593
564
|
passThroughOnException(): void;
|
|
594
565
|
}
|
|
595
|
-
|
|
596
|
-
/** @internal Minimal stub — use @cloudflare/workers-types for full types. */
|
|
597
|
-
export interface CfExportedHandler<Env = Record<string, unknown>> {
|
|
598
|
-
fetch?(request: Request, env: Env, ctx: CfExecutionContext): Promise<Response> | Response;
|
|
599
|
-
}
|
|
@@ -25,7 +25,7 @@ export function generateCompressModule(): string {
|
|
|
25
25
|
// Uses node:zlib createGzip() (C++ native) on Node.js, falls back to
|
|
26
26
|
// CompressionStream (Web API) on other runtimes. Brotli is left to CDNs/reverse
|
|
27
27
|
// proxies — at streaming quality levels its ratio advantage is marginal.
|
|
28
|
-
import { Readable } from 'node:stream';
|
|
28
|
+
import { Readable, pipeline } from 'node:stream';
|
|
29
29
|
import { createGzip, constants } from 'node:zlib';
|
|
30
30
|
|
|
31
31
|
const COMPRESSIBLE_TYPES = new Set([
|
|
@@ -86,8 +86,14 @@ function compressWithGzip(body) {
|
|
|
86
86
|
// receives the HTML shell before Suspense boundaries resolve. Without it,
|
|
87
87
|
// gzip buffers internally and breaks streaming.
|
|
88
88
|
const gzip = createGzip({ flush: constants.Z_SYNC_FLUSH });
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
// pipeline() instead of bare pipe(): pipe() does not forward source
|
|
90
|
+
// errors, so an erroring body would emit an unhandled 'error' event and
|
|
91
|
+
// crash the process. pipeline() destroys gzip on source error — the web
|
|
92
|
+
// stream rejects — and propagates consumer cancel back to the source
|
|
93
|
+
// body. Errors reach the consumer via the web stream; the callback only
|
|
94
|
+
// marks them handled at the Node layer.
|
|
95
|
+
pipeline(nodeReadable, gzip, () => {});
|
|
96
|
+
return Readable.toWeb(gzip);
|
|
91
97
|
} catch {
|
|
92
98
|
// Fallback: CompressionStream (CF Workers, or if node:stream unavailable)
|
|
93
99
|
return body.pipeThrough(new CompressionStream('gzip'));
|