@timber-js/app 0.2.0-alpha.52 → 0.2.0-alpha.53
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/{segment-context-DBn-nrMN.js → segment-context-Bmugn-ao.js} +8 -5
- package/dist/_chunks/segment-context-Bmugn-ao.js.map +1 -0
- package/dist/client/index.js +23 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/router.d.ts.map +1 -1
- package/dist/client/rsc-fetch.d.ts +13 -0
- package/dist/client/rsc-fetch.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/server/default-logger.d.ts.map +1 -1
- package/dist/server/flight-scripts.d.ts +5 -2
- package/dist/server/flight-scripts.d.ts.map +1 -1
- package/dist/server/index.js +1 -3
- package/dist/server/index.js.map +1 -1
- package/dist/server/logger.d.ts +1 -0
- package/dist/server/logger.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/rsc-entry/error-renderer.d.ts +12 -8
- package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/helpers.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/rsc-entry/rsc-stream.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-error-bridge.d.ts +12 -0
- package/dist/server/rsc-entry/ssr-error-bridge.d.ts.map +1 -0
- package/dist/server/rsc-entry/ssr-renderer.d.ts +12 -0
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/slot-resolver.d.ts.map +1 -1
- package/dist/server/ssr-error-entry.d.ts +65 -0
- package/dist/server/ssr-error-entry.d.ts.map +1 -0
- package/dist/shared/merge-search-params.d.ts.map +1 -1
- package/dist/shims/navigation.d.ts +1 -1
- package/dist/shims/navigation.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/cli.ts +0 -0
- package/src/client/browser-entry.ts +7 -6
- package/src/client/router.ts +13 -1
- package/src/client/rsc-fetch.ts +25 -0
- package/src/plugins/routing.ts +7 -1
- package/src/server/default-logger.ts +4 -3
- package/src/server/flight-scripts.ts +6 -3
- package/src/server/logger.ts +6 -1
- package/src/server/pipeline.ts +1 -1
- package/src/server/rsc-entry/error-renderer.ts +201 -45
- package/src/server/rsc-entry/helpers.ts +12 -2
- package/src/server/rsc-entry/index.ts +4 -1
- package/src/server/rsc-entry/rsc-payload.ts +37 -4
- package/src/server/rsc-entry/rsc-stream.ts +21 -2
- package/src/server/rsc-entry/ssr-error-bridge.ts +20 -0
- package/src/server/rsc-entry/ssr-renderer.ts +79 -14
- package/src/server/slot-resolver.ts +7 -1
- package/src/server/ssr-error-entry.ts +237 -0
- package/src/shared/merge-search-params.ts +11 -4
- package/src/shims/navigation.ts +1 -0
- package/LICENSE +0 -8
- package/dist/_chunks/segment-context-DBn-nrMN.js.map +0 -1
package/dist/server/logger.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/server/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,6FAA6F;AAC7F,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC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AuB,IAAI,IAAI,CAE9C;AAED,sDAAsD;AACtD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAEnE;AAED,6DAA6D;AAC7D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAEpF;AAED,oCAAoC;AACpC,wBAAgB,YAAY,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAE7D"}
|
|
@@ -93,6 +93,17 @@ export interface PipelineConfig {
|
|
|
93
93
|
*/
|
|
94
94
|
renderFallbackError?: (error: unknown, req: Request, responseHeaders: Headers) => Response | Promise<Response>;
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Run segment param coercion on the matched route's segments.
|
|
98
|
+
*
|
|
99
|
+
* Loads params.ts modules from segments that have them, extracts the
|
|
100
|
+
* segmentParams definition, and coerces raw string params through codecs.
|
|
101
|
+
* Throws ParamCoercionError if any codec fails (→ 404).
|
|
102
|
+
*
|
|
103
|
+
* This runs BEFORE middleware, so ctx.segmentParams is already typed.
|
|
104
|
+
* See design/07-routing.md §"Where Coercion Runs"
|
|
105
|
+
*/
|
|
106
|
+
export declare function coerceSegmentParams(match: RouteMatch): Promise<void>;
|
|
96
107
|
/**
|
|
97
108
|
* Create the request handler from a pipeline configuration.
|
|
98
109
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/server/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAmC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,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,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzF,kFAAkF;IAClF,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,gFAAgF;IAChF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,yGAAyG;IACzG,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,2BAA2B,EAAE,mBAAmB,EAAE,CAAC;IACjF;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,KAAK,CAAC;IAC5C;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD;;;;;;;;;;OAUG;IACH,mBAAmB,CAAC,EAAE,CACpB,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,OAAO,EACZ,eAAe,EAAE,OAAO,KACrB,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACnC;AAID;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAsB1E;AAID;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CA8Y1F"}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* RSC Error & No-Match Renderers — handles error pages and 404s.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Error pages use two rendering paths depending on file format:
|
|
5
|
+
* - TSX/JSX ('use client'): SSR-only render via Fizz (bypasses RSC Flight)
|
|
6
|
+
* - MDX (server component): RSC → SSR (plain props, no Error serialization issue)
|
|
7
|
+
*
|
|
8
|
+
* The SSR-only path exists because Error objects are not RSC-serializable.
|
|
9
|
+
* React Flight throws "Only plain objects can be passed to Client Components"
|
|
10
|
+
* when Error instances are passed as props to 'use client' components.
|
|
11
|
+
*
|
|
12
|
+
* Design docs: 10-error-handling.md §"Three-Tier Error Page Rendering"
|
|
5
13
|
*/
|
|
6
14
|
import type { RouteMatch } from '#/server/pipeline.js';
|
|
7
15
|
import type { ManifestSegmentNode } from '#/server/route-matcher.js';
|
|
@@ -10,13 +18,9 @@ import type { LayoutEntry } from '#/server/deny-renderer.js';
|
|
|
10
18
|
/**
|
|
11
19
|
* Render an error page for unhandled throws or RenderError outside Suspense.
|
|
12
20
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* 3. error.tsx
|
|
17
|
-
*
|
|
18
|
-
* Renders the found component with { error, digest, reset } props
|
|
19
|
-
* wrapped in layouts, with the correct HTTP status code.
|
|
21
|
+
* Uses two rendering paths:
|
|
22
|
+
* - TSX/JSX: SSR-only (bypass RSC, render directly through Fizz)
|
|
23
|
+
* - MDX: RSC → SSR (server components need Flight, but props are plain)
|
|
20
24
|
*/
|
|
21
25
|
export declare function renderErrorPage(error: unknown, status: number, segments: ManifestSegmentNode[], layoutComponents: LayoutEntry[], req: Request, match: RouteMatch, responseHeaders: Headers, clientBootstrap: ClientBootstrapConfig): Promise<Response>;
|
|
22
26
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-renderer.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/error-renderer.ts"],"names":[],"mappings":"AAAA
|
|
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,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGxE,OAAO,KAAK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AED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,gBAAgB,EAAE,KAAK,CAAC;IACtB,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;IAC3C,OAAO,EAAE,mBAAmB,CAAC;CAC9B,CAAC,GACD,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CA0B3C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGzD;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,cAAc,EACtB,eAAe,EAAE,OAAO,GACvB,QAAQ,CAOV;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAIpD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM9C;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAW1E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/index.ts"],"names":[],"mappings":"AA4DA,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAiCtB;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,mBAAmB,EAAE,KAAK,IAAI,GACtF,IAAI,CAEN;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/index.ts"],"names":[],"mappings":"AA4DA,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAiCtB;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,mBAAmB,EAAE,KAAK,IAAI,GACtF,IAAI,CAEN;AAycD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;8BA1S3C,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC;AA4ShD,wBAAiE"}
|
|
@@ -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,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAQrE,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,
|
|
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,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAQrE,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,CAmKnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsc-stream.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/rsc-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"rsc-stream.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/rsc-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAe,MAAM,wBAAwB,CAAC;AAGjF,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAItB;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,WAAW,EAAE;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACvD,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;IAClD,OAAO,EAAE,aAAa,CAAC;IACvB,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,MAAM,mBAAmB,EAAE,CAAC;CAClD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO,GAAG,eAAe,CAsJ1F"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSR Error Bridge — loads the SSR error entry and renders error pages directly.
|
|
3
|
+
*
|
|
4
|
+
* Bypasses the RSC Flight pipeline entirely. Component module paths are
|
|
5
|
+
* passed to the SSR environment which imports them (resolving 'use client'
|
|
6
|
+
* references to actual modules) and builds the element tree for Fizz.
|
|
7
|
+
*
|
|
8
|
+
* Design docs: 10-error-handling.md §"Three-Tier Error Page Rendering"
|
|
9
|
+
*/
|
|
10
|
+
import type { ErrorPageContext } from '#/server/ssr-error-entry.js';
|
|
11
|
+
export declare function callSsrErrorPage(ctx: ErrorPageContext): Promise<Response>;
|
|
12
|
+
//# sourceMappingURL=ssr-error-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-error-bridge.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/ssr-error-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAK/E"}
|
|
@@ -16,6 +16,18 @@ import type { RouteMatch } from '#/server/pipeline.js';
|
|
|
16
16
|
import type { LayoutComponentEntry } from '#/server/route-element-builder.js';
|
|
17
17
|
import type { ManifestSegmentNode } from '#/server/route-matcher.js';
|
|
18
18
|
import type { RenderSignals } from './rsc-stream.js';
|
|
19
|
+
/**
|
|
20
|
+
* Test-only observable: records how many microtask yields were consumed
|
|
21
|
+
* during the last signal promotion check. Import this in tests to assert
|
|
22
|
+
* the actual rejection chain depth and detect regressions if wrappers
|
|
23
|
+
* add more async hops.
|
|
24
|
+
*
|
|
25
|
+
* Only populated when the object is imported and exists — production
|
|
26
|
+
* bundles that don't import it pay zero cost (the typeof check is free).
|
|
27
|
+
*/
|
|
28
|
+
export declare const __test_only_signalPromotionDepth: {
|
|
29
|
+
value: number;
|
|
30
|
+
};
|
|
19
31
|
interface SsrRenderOptions {
|
|
20
32
|
req: Request;
|
|
21
33
|
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,4BAA4B,CAAC;AAIxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAYrE,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,4BAA4B,CAAC;AAIxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,oBAA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,EACjB,CAAC,EAAE,eAAe,EAClB,YAAY,CAAC,EAAE,mBAAmB,GACjC,OAAO,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"slot-resolver.d.ts","sourceRoot":"","sources":["../../src/server/slot-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,KAAK,eAAe,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,KAAK,CAAC,YAAY,CAAC;AAkHlE;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,UAAU,EACjB,CAAC,EAAE,eAAe,EAClB,YAAY,CAAC,EAAE,mBAAmB,GACjC,OAAO,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CA+FpC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSR Error Entry — Renders error pages directly through Fizz (no RSC).
|
|
3
|
+
*
|
|
4
|
+
* Error pages bypass the RSC Flight pipeline because Error objects are not
|
|
5
|
+
* RSC-serializable (React Flight throws "Only plain objects can be passed
|
|
6
|
+
* to Client Components"). Instead, this entry receives component module
|
|
7
|
+
* paths, imports them in the SSR environment, builds the element tree,
|
|
8
|
+
* and renders through Fizz.
|
|
9
|
+
*
|
|
10
|
+
* Layout components may be server components that import 'use client'
|
|
11
|
+
* children — in the SSR environment, client references resolve to actual
|
|
12
|
+
* component modules (unlike the RSC environment where they're opaque
|
|
13
|
+
* reference objects). This is why we import in SSR, not pass from RSC.
|
|
14
|
+
*
|
|
15
|
+
* Design docs: 10-error-handling.md §"Three-Tier Error Page Rendering"
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Context for SSR-only error page rendering.
|
|
19
|
+
* Subset of NavContext — no RSC stream, no Flight injection.
|
|
20
|
+
*/
|
|
21
|
+
export interface ErrorPageContext {
|
|
22
|
+
/** The requested pathname */
|
|
23
|
+
pathname: string;
|
|
24
|
+
/** Extracted route params */
|
|
25
|
+
params: Record<string, string | string[]>;
|
|
26
|
+
/** Search params from the URL */
|
|
27
|
+
searchParams: Record<string, string>;
|
|
28
|
+
/** The committed HTTP status code */
|
|
29
|
+
statusCode: number;
|
|
30
|
+
/** Response headers from middleware/proxy */
|
|
31
|
+
responseHeaders: Headers;
|
|
32
|
+
/** Pre-rendered metadata HTML to inject before </head> */
|
|
33
|
+
headHtml: string;
|
|
34
|
+
/** Inline JS for React's bootstrapScriptContent */
|
|
35
|
+
bootstrapScriptContent: string;
|
|
36
|
+
/** Request abort signal */
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
/** Request cookies for useCookie() during SSR */
|
|
39
|
+
cookies?: Map<string, string>;
|
|
40
|
+
/** Error component props: { error, digest, reset } */
|
|
41
|
+
errorProps: {
|
|
42
|
+
error: Error;
|
|
43
|
+
digest: {
|
|
44
|
+
code: string;
|
|
45
|
+
data: unknown;
|
|
46
|
+
} | null;
|
|
47
|
+
reset: undefined;
|
|
48
|
+
};
|
|
49
|
+
/** File path of the error component module (imported in SSR env) */
|
|
50
|
+
errorComponentPath: string;
|
|
51
|
+
/** File paths of layout component modules, ordered root → leaf */
|
|
52
|
+
layoutPaths: string[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Render an error page directly through Fizz (no RSC Flight stream).
|
|
56
|
+
*
|
|
57
|
+
* Imports the error component and layout components in the SSR environment,
|
|
58
|
+
* builds the element tree, wraps with SSR-specific components (for useId
|
|
59
|
+
* matching), and renders to HTML.
|
|
60
|
+
*
|
|
61
|
+
* Key difference from handleSsr: NO RSC stream decode, NO Flight injection.
|
|
62
|
+
*/
|
|
63
|
+
export declare function handleSsrErrorPage(ctx: ErrorPageContext): Promise<Response>;
|
|
64
|
+
export default handleSsrErrorPage;
|
|
65
|
+
//# sourceMappingURL=ssr-error-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-error-entry.d.ts","sourceRoot":"","sources":["../../src/server/ssr-error-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAwDH;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6BAA6B;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC1C,iCAAiC;IACjC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,eAAe,EAAE,OAAO,CAAC;IACzB,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,sBAAsB,EAAE,MAAM,CAAC;IAC/B,2BAA2B;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,iDAAiD;IACjD,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,sDAAsD;IACtD,UAAU,EAAE;QACV,KAAK,EAAE,KAAK,CAAC;QACb,MAAM,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,OAAO,CAAA;SAAE,GAAG,IAAI,CAAC;QAC/C,KAAK,EAAE,SAAS,CAAC;KAClB,CAAC;IACF,oEAAoE;IACpE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kEAAkE;IAClE,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiDjF;AAwED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-search-params.d.ts","sourceRoot":"","sources":["../../src/shared/merge-search-params.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,IAAI,GAAG,MAAM,EAAE,GACxB,MAAM,
|
|
1
|
+
{"version":3,"file":"merge-search-params.d.ts","sourceRoot":"","sources":["../../src/shared/merge-search-params.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,IAAI,GAAG,MAAM,EAAE,GACxB,MAAM,CA6BR"}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* resolve to the same module instances as user code in Vite dev. Server
|
|
6
6
|
* functions import from @timber-js/app/server for ALS singleton consistency.
|
|
7
7
|
*/
|
|
8
|
-
export { useSegmentParams, usePathname, useSearchParams, useRouter, useSelectedLayoutSegment, useSelectedLayoutSegments, } from '@timber-js/app/client';
|
|
8
|
+
export { useSegmentParams, useSegmentParams as useParams, usePathname, useSearchParams, useRouter, useSelectedLayoutSegment, useSelectedLayoutSegments, } from '@timber-js/app/client';
|
|
9
9
|
export { redirect, permanentRedirect, notFound, RedirectType } from '@timber-js/app/server';
|
|
10
10
|
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/shims/navigation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,SAAS,EACT,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/shims/navigation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,gBAAgB,EAChB,gBAAgB,IAAI,SAAS,EAC7B,WAAW,EACX,eAAe,EACf,SAAS,EACT,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
|
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.53",
|
|
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",
|
|
@@ -83,6 +83,11 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
+
"scripts": {
|
|
87
|
+
"build": "vite build --config vite.lib.config.ts && tsc --emitDeclarationOnly --project tsconfig.json --outDir dist",
|
|
88
|
+
"typecheck": "tsgo --noEmit",
|
|
89
|
+
"prepublishOnly": "pnpm run build"
|
|
90
|
+
},
|
|
86
91
|
"dependencies": {
|
|
87
92
|
"@opentelemetry/api": "^1.9.1",
|
|
88
93
|
"@opentelemetry/context-async-hooks": "^2.6.1",
|
|
@@ -121,9 +126,5 @@
|
|
|
121
126
|
},
|
|
122
127
|
"engines": {
|
|
123
128
|
"node": ">=22.12.0"
|
|
124
|
-
},
|
|
125
|
-
"scripts": {
|
|
126
|
-
"build": "vite build --config vite.lib.config.ts && tsc --emitDeclarationOnly --project tsconfig.json --outDir dist",
|
|
127
|
-
"typecheck": "tsgo --noEmit"
|
|
128
129
|
}
|
|
129
|
-
}
|
|
130
|
+
}
|
package/src/cli.ts
CHANGED
|
File without changes
|
|
@@ -233,12 +233,13 @@ function bootstrap(runtimeConfig: typeof config): void {
|
|
|
233
233
|
type FlightSegment = [isBootstrap: 0] | [isData: 1, data: string];
|
|
234
234
|
|
|
235
235
|
// __timber_f is initialized in <head> via flightInitScript() (see
|
|
236
|
-
// flight-scripts.ts).
|
|
237
|
-
//
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
236
|
+
// flight-scripts.ts). If it doesn't exist, this is an SSR-only page
|
|
237
|
+
// (e.g. TSX error pages rendered without Flight) — skip Flight
|
|
238
|
+
// decoding entirely and fall through to the createRoot branch.
|
|
239
|
+
// Do NOT defensively create it here: that would cause
|
|
240
|
+
// createFromReadableStream to be called on an empty stream, producing
|
|
241
|
+
// a "Connection closed" error on hydration. See TIM-552.
|
|
242
|
+
const timberChunks = (self as unknown as Record<string, FlightSegment[] | undefined>).__timber_f;
|
|
242
243
|
|
|
243
244
|
let _reactRoot: Root | null = null;
|
|
244
245
|
let initialElement: unknown = null;
|
package/src/client/router.ts
CHANGED
|
@@ -12,7 +12,12 @@ import {
|
|
|
12
12
|
type NavigationState,
|
|
13
13
|
} from './navigation-context.js';
|
|
14
14
|
import { SegmentElementCache, cacheSegmentElements, mergeSegmentTree } from './segment-merger.js';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
fetchRscPayload,
|
|
17
|
+
RedirectError,
|
|
18
|
+
ServerErrorResponse,
|
|
19
|
+
VersionSkewError,
|
|
20
|
+
} from './rsc-fetch.js';
|
|
16
21
|
import type { FetchResult } from './rsc-fetch.js';
|
|
17
22
|
|
|
18
23
|
// ─── Types ───────────────────────────────────────────────────────
|
|
@@ -414,6 +419,13 @@ export function createRouter(deps: RouterDeps): RouterInstance {
|
|
|
414
419
|
await navigate(error.redirectUrl, { replace: true });
|
|
415
420
|
return;
|
|
416
421
|
}
|
|
422
|
+
// Server 5xx error — hard-navigate so the server renders the
|
|
423
|
+
// error page as HTML. See design/10-error-handling.md
|
|
424
|
+
// §"Error Page Rendering for Client Navigation".
|
|
425
|
+
if (error instanceof ServerErrorResponse) {
|
|
426
|
+
window.location.href = error.url;
|
|
427
|
+
return new Promise(() => {}) as never;
|
|
428
|
+
}
|
|
417
429
|
// Abort errors are not application errors — swallow silently.
|
|
418
430
|
if (isAbortError(error)) return;
|
|
419
431
|
throw error;
|
package/src/client/rsc-fetch.ts
CHANGED
|
@@ -216,6 +216,24 @@ export class VersionSkewError extends Error {
|
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
/**
|
|
220
|
+
* Thrown when the server returns a 5xx error for an RSC payload request.
|
|
221
|
+
* The server sends X-Timber-Error header and a JSON body instead of a
|
|
222
|
+
* broken RSC stream. Caught in navigate() to trigger a hard navigation
|
|
223
|
+
* so the server can render the error page as HTML.
|
|
224
|
+
*
|
|
225
|
+
* See design/10-error-handling.md §"Error Page Rendering for Client Navigation"
|
|
226
|
+
*/
|
|
227
|
+
export class ServerErrorResponse extends Error {
|
|
228
|
+
readonly status: number;
|
|
229
|
+
readonly url: string;
|
|
230
|
+
constructor(status: number, url: string) {
|
|
231
|
+
super(`Server error ${status} during navigation to ${url}`);
|
|
232
|
+
this.status = status;
|
|
233
|
+
this.url = url;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
219
237
|
// ─── Fetch ───────────────────────────────────────────────────────
|
|
220
238
|
|
|
221
239
|
/**
|
|
@@ -263,6 +281,13 @@ export async function fetchRscPayload(
|
|
|
263
281
|
if (redirectLocation) {
|
|
264
282
|
throw new RedirectError(redirectLocation);
|
|
265
283
|
}
|
|
284
|
+
// Detect server 5xx errors. The server returns X-Timber-Error header
|
|
285
|
+
// with a JSON body instead of a broken RSC stream. Hard-navigate so
|
|
286
|
+
// the server renders the error page as HTML via the SSR-only path.
|
|
287
|
+
// See design/10-error-handling.md §"Error Page Rendering for Client Navigation"
|
|
288
|
+
if (response.headers.get('X-Timber-Error') === '1') {
|
|
289
|
+
throw new ServerErrorResponse(response.status, url);
|
|
290
|
+
}
|
|
266
291
|
headElements = extractHeadElements(response);
|
|
267
292
|
segmentInfo = extractSegmentInfo(response);
|
|
268
293
|
params = extractParams(response);
|
package/src/plugins/routing.ts
CHANGED
|
@@ -28,7 +28,7 @@ const RESOLVED_VIRTUAL_ID = `\0${VIRTUAL_MODULE_ID}`;
|
|
|
28
28
|
* File convention names we track for changes that require manifest regeneration.
|
|
29
29
|
*/
|
|
30
30
|
const ROUTE_FILE_PATTERNS =
|
|
31
|
-
/\/(page|layout|middleware|access|route|error|default|denied|\d{3}|[45]xx|not-found|forbidden|unauthorized|sitemap|robots|manifest|favicon|icon|opengraph-image|twitter-image|apple-icon)\./;
|
|
31
|
+
/\/(page|layout|middleware|access|route|error|default|denied|params|\d{3}|[45]xx|not-found|forbidden|unauthorized|sitemap|robots|manifest|favicon|icon|opengraph-image|twitter-image|apple-icon)\./;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Create the timber-routing Vite plugin.
|
|
@@ -330,6 +330,12 @@ function generateManifestModule(tree: RouteTree): string {
|
|
|
330
330
|
`${nextIndent}denied: { load: ${v}, filePath: ${JSON.stringify(node.denied.filePath)} },`
|
|
331
331
|
);
|
|
332
332
|
}
|
|
333
|
+
if (node.params) {
|
|
334
|
+
const v = addImport(node.params);
|
|
335
|
+
parts.push(
|
|
336
|
+
`${nextIndent}params: { load: ${v}, filePath: ${JSON.stringify(node.params.filePath)} },`
|
|
337
|
+
);
|
|
338
|
+
}
|
|
333
339
|
// searchParams is now a named export from page.tsx, not a separate file.
|
|
334
340
|
// The page module's searchParams export is loaded via the page's lazy import.
|
|
335
341
|
// Runtime registration happens in the route loader using the page module.
|
|
@@ -65,14 +65,15 @@ function padLevel(level: string): string {
|
|
|
65
65
|
export function createDefaultLogger(): TimberLogger {
|
|
66
66
|
return {
|
|
67
67
|
error(msg: string, data?: Record<string, unknown>): void {
|
|
68
|
-
|
|
68
|
+
// Errors are ALWAYS logged, including dev mode. Suppressing errors
|
|
69
|
+
// in dev causes silent 500s with no stack trace, making route.ts
|
|
70
|
+
// and render errors impossible to debug. See TIM-555.
|
|
69
71
|
const fields = formatDataFields(data);
|
|
70
|
-
// Use process.stderr.write for consistent output (no extra newline handling)
|
|
71
72
|
process.stderr.write(`[timber] ${padLevel('ERROR')} ${msg}${fields}\n`);
|
|
72
73
|
},
|
|
73
74
|
|
|
74
75
|
warn(msg: string, data?: Record<string, unknown>): void {
|
|
75
|
-
|
|
76
|
+
// Warnings are always logged — same rationale as errors.
|
|
76
77
|
const fields = formatDataFields(data);
|
|
77
78
|
process.stderr.write(`[timber] ${padLevel('WARN')} ${msg}${fields}\n`);
|
|
78
79
|
},
|
|
@@ -50,10 +50,13 @@ export function flightInitScript(): string {
|
|
|
50
50
|
/**
|
|
51
51
|
* Generate a push script for a Flight data chunk.
|
|
52
52
|
*
|
|
53
|
-
*
|
|
54
|
-
* `self.__timber_f`
|
|
53
|
+
* Normally the init script runs first (it's in `<head>`), so
|
|
54
|
+
* `self.__timber_f` already exists. However, shell-less status pages
|
|
55
|
+
* (e.g. shell=false 401 pages) have no `<head>` tag, so the init script
|
|
56
|
+
* never runs. The `||[]` guard ensures the array is created on first
|
|
57
|
+
* push if needed, preventing a TypeError. See TIM-559.
|
|
55
58
|
*/
|
|
56
59
|
export function flightChunkScript(data: string): string {
|
|
57
60
|
const escaped = htmlEscapeJsonString(JSON.stringify([1, data]));
|
|
58
|
-
return `<script
|
|
61
|
+
return `<script>(${FLIGHT_VAR}=${FLIGHT_VAR}||[]).push(${escaped})</script>`;
|
|
59
62
|
}
|
package/src/server/logger.ts
CHANGED
|
@@ -108,7 +108,12 @@ export function logMiddlewareError(data: { method: string; path: string; error:
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
/** Log unhandled render-phase error. Level: error. */
|
|
111
|
-
export function logRenderError(data: {
|
|
111
|
+
export function logRenderError(data: {
|
|
112
|
+
method: string;
|
|
113
|
+
path: string;
|
|
114
|
+
error: unknown;
|
|
115
|
+
errorId?: string;
|
|
116
|
+
}): void {
|
|
112
117
|
_logger.error('unhandled render-phase error', withTraceContext(data));
|
|
113
118
|
}
|
|
114
119
|
|
package/src/server/pipeline.ts
CHANGED
|
@@ -167,7 +167,7 @@ export interface PipelineConfig {
|
|
|
167
167
|
* This runs BEFORE middleware, so ctx.segmentParams is already typed.
|
|
168
168
|
* See design/07-routing.md §"Where Coercion Runs"
|
|
169
169
|
*/
|
|
170
|
-
async function coerceSegmentParams(match: RouteMatch): Promise<void> {
|
|
170
|
+
export async function coerceSegmentParams(match: RouteMatch): Promise<void> {
|
|
171
171
|
const segments = match.segments as unknown as import('./route-matcher.js').ManifestSegmentNode[];
|
|
172
172
|
|
|
173
173
|
for (const segment of segments) {
|