@timber-js/app 0.2.0-alpha.249 → 0.2.0-alpha.250
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-C7_xl9iA.js → actions-DH_TCxJb.js} +2 -2
- package/dist/_chunks/{actions-C7_xl9iA.js.map → actions-DH_TCxJb.js.map} +1 -1
- package/dist/_chunks/dev-span-0aG7Q_Ph.js.map +1 -1
- package/dist/_chunks/{dist-GyaJm4GA.js → dist-ob734WH3.js} +20 -19
- package/dist/_chunks/dist-ob734WH3.js.map +1 -0
- package/dist/_chunks/{error-boundary-wuNvAJ4n.js → error-boundary-BR21tTQc.js} +3 -3
- package/dist/_chunks/{error-boundary-wuNvAJ4n.js.map → error-boundary-BR21tTQc.js.map} +1 -1
- package/dist/_chunks/global-context-DbxNWeBP.js +47 -0
- package/dist/_chunks/global-context-DbxNWeBP.js.map +1 -0
- package/dist/_chunks/{navigation-root-Cvb7P1ud.js → navigation-root-AuCD35Sv.js} +42 -47
- package/dist/_chunks/navigation-root-AuCD35Sv.js.map +1 -0
- package/dist/_chunks/ssr-data-BfsCqCLl.js +47 -0
- package/dist/_chunks/ssr-data-BfsCqCLl.js.map +1 -0
- package/dist/client/browser-entry/post-hydration.d.ts +2 -2
- package/dist/client/browser-entry/post-hydration.d.ts.map +1 -1
- package/dist/client/browser-entry/scroll.d.ts +11 -8
- package/dist/client/browser-entry/scroll.d.ts.map +1 -1
- package/dist/client/error-boundary.js +1 -1
- package/dist/client/index.js +12 -9
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.d.ts +0 -2
- package/dist/client/internal.d.ts.map +1 -1
- package/dist/client/internal.js +6 -6
- package/dist/client/internal.js.map +1 -1
- package/dist/client/link.d.ts.map +1 -1
- package/dist/client/ssr-data.d.ts +35 -38
- package/dist/client/ssr-data.d.ts.map +1 -1
- package/dist/client/state.d.ts +1 -8
- package/dist/client/state.d.ts.map +1 -1
- package/dist/client/use-cookie.d.ts.map +1 -1
- package/dist/client/use-search-params.d.ts.map +1 -1
- package/dist/cookies/index.js +3 -3
- package/dist/cookies/index.js.map +1 -1
- package/dist/native/rsc/client/global-context.js +20 -0
- package/dist/native/rsc/client/global-context.js.map +1 -0
- package/dist/native/rsc/client/ssr-data.js +9 -4
- package/dist/native/rsc/client/ssr-data.js.map +1 -1
- package/dist/native/rsc/client/use-cookie.js +4 -4
- package/dist/native/rsc/client/use-cookie.js.map +1 -1
- package/dist/native/rsc/manifest.json +1 -1
- package/dist/native/rsc/server/build-manifest.js +1 -4
- package/dist/native/rsc/server/build-manifest.js.map +1 -1
- package/dist/native/rsc/server/html-injectors.js +6 -7
- package/dist/native/rsc/server/html-injectors.js.map +1 -1
- package/dist/native/rsc/server/react-cache-bridge.js +2 -2
- package/dist/native/rsc/server/react-cache-bridge.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/render-route.js +3 -5
- package/dist/native/rsc/server/rsc-entry/render-route.js.map +1 -1
- package/dist/native/rsc/server/rsc-entry/ssr-renderer.js +3 -2
- package/dist/native/rsc/server/rsc-entry/ssr-renderer.js.map +1 -1
- package/dist/native/ssr/client/link.js +10 -8
- package/dist/native/ssr/client/link.js.map +1 -1
- package/dist/native/ssr/client/ssr-data.js +10 -6
- package/dist/native/ssr/client/ssr-data.js.map +1 -1
- package/dist/native/ssr/client/state.js +1 -5
- package/dist/native/ssr/client/state.js.map +1 -1
- package/dist/native/ssr/client/use-cookie.js +2 -2
- package/dist/native/ssr/client/use-cookie.js.map +1 -1
- package/dist/native/ssr/client/use-search-params.js +3 -2
- package/dist/native/ssr/client/use-search-params.js.map +1 -1
- package/dist/native/ssr/server/ssr-wrappers.js +11 -4
- package/dist/native/ssr/server/ssr-wrappers.js.map +1 -1
- package/dist/server/build-manifest.d.ts +0 -7
- package/dist/server/build-manifest.d.ts.map +1 -1
- package/dist/server/html-injectors.d.ts +5 -4
- package/dist/server/html-injectors.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/internal.js +1 -1
- package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-renderer.d.ts +2 -0
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/ssr-bridge-types.d.ts +6 -0
- package/dist/server/ssr-bridge-types.d.ts.map +1 -1
- package/dist/server/ssr-entry.d.ts.map +1 -1
- package/dist/server/ssr-wrappers.d.ts +14 -9
- package/dist/server/ssr-wrappers.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/client/browser-entry/post-hydration.ts +27 -22
- package/src/client/browser-entry/scroll.ts +12 -9
- package/src/client/internal.ts +0 -4
- package/src/client/link.tsx +14 -13
- package/src/client/ssr-data.ts +50 -57
- package/src/client/state.ts +1 -14
- package/src/client/use-cookie.ts +4 -3
- package/src/client/use-search-params.ts +5 -4
- package/src/server/build-manifest.ts +0 -10
- package/src/server/html-injectors.ts +11 -13
- package/src/server/rsc-entry/render-route.ts +9 -8
- package/src/server/rsc-entry/ssr-renderer.ts +4 -1
- package/src/server/ssr-bridge-types.ts +6 -0
- package/src/server/ssr-entry.ts +180 -207
- package/src/server/ssr-wrappers.tsx +52 -14
- package/dist/_chunks/dist-GyaJm4GA.js.map +0 -1
- package/dist/_chunks/navigation-root-Cvb7P1ud.js.map +0 -1
- package/dist/_chunks/ssr-data-9hPtcNOr.js +0 -48
- package/dist/_chunks/ssr-data-9hPtcNOr.js.map +0 -1
- package/dist/_chunks/state-B-EBjeER.js +0 -49
- package/dist/_chunks/state-B-EBjeER.js.map +0 -1
- package/dist/native/rsc/client/state.js +0 -14
- package/dist/native/rsc/client/state.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useSsrData } from "./ssr-data.js";
|
|
2
2
|
import { useNavigationContext } from "./navigation-context.js";
|
|
3
3
|
import { _setCachedSearch, cachedSearch, cachedSearchParams } from "./state.js";
|
|
4
4
|
// src/client/use-search-params.ts
|
|
@@ -12,8 +12,9 @@ function getSearchParams(search) {
|
|
|
12
12
|
}
|
|
13
13
|
function useSearchParams() {
|
|
14
14
|
const nav = useNavigationContext();
|
|
15
|
+
const ssrData = useSsrData();
|
|
15
16
|
if (nav === null) throw new Error("[timber] useSearchParams() was called outside the timber app tree (no NavigationProvider found). In tests, render the component inside the timber providers.");
|
|
16
|
-
if (typeof window === "undefined" ||
|
|
17
|
+
if (typeof window === "undefined" || ssrData) return new URLSearchParams(nav.search);
|
|
17
18
|
return getSearchParams(nav.search);
|
|
18
19
|
}
|
|
19
20
|
export { useSearchParams };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-search-params.js","names":[],"sources":["../../../../src/client/use-search-params.ts"],"mappings":";;;;AA8BA,SAAS,gBAAgB,QAAiC;CACxD,IAAI,WAAW,cAAc;EAC3B,MAAM,SAAS,IAAI,gBAAgB,MAAM;EACzC,iBAAiB,QAAQ,MAAM;EAC/B,OAAO;CACT;CACA,OAAO;AACT;AASA,SAAgB,kBAAmC;CACjD,MAAM,MAAM,qBAAqB;CACjC,IAAI,QAAQ,MACV,MAAM,IAAI,MACR,8JAGF;CASF,IAAI,OAAO,WAAW,eAAe,
|
|
1
|
+
{"version":3,"file":"use-search-params.js","names":[],"sources":["../../../../src/client/use-search-params.ts"],"mappings":";;;;AA8BA,SAAS,gBAAgB,QAAiC;CACxD,IAAI,WAAW,cAAc;EAC3B,MAAM,SAAS,IAAI,gBAAgB,MAAM;EACzC,iBAAiB,QAAQ,MAAM;EAC/B,OAAO;CACT;CACA,OAAO;AACT;AASA,SAAgB,kBAAmC;CACjD,MAAM,MAAM,qBAAqB;CACjC,MAAM,UAAU,WAAW;CAC3B,IAAI,QAAQ,MACV,MAAM,IAAI,MACR,8JAGF;CASF,IAAI,OAAO,WAAW,eAAe,SACnC,OAAO,IAAI,gBAAgB,IAAI,MAAM;CAEvC,OAAO,gBAAgB,IAAI,MAAM;AACnC"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { TimberNuqsAdapter } from "../client/nuqs-adapter.js";
|
|
2
2
|
import { NavigationProvider } from "../client/navigation-context.js";
|
|
3
3
|
import { PayloadRoot } from "../client/params-context.js";
|
|
4
|
+
import { SsrDataProvider } from "../client/ssr-data.js";
|
|
4
5
|
import { Fragment, createElement } from "react";
|
|
6
|
+
import { preloadModule } from "react-dom";
|
|
5
7
|
// src/server/ssr-wrappers.tsx
|
|
6
|
-
function SsrNavigationRoot({ children }) {
|
|
7
|
-
return createElement(Fragment, null, createElement(DocumentDefaults,
|
|
8
|
+
function SsrNavigationRoot({ children, modulePreloads }) {
|
|
9
|
+
return createElement(Fragment, null, createElement(DocumentDefaults, { modulePreloads }), children);
|
|
8
10
|
}
|
|
9
|
-
function DocumentDefaults() {
|
|
11
|
+
function DocumentDefaults({ modulePreloads }) {
|
|
12
|
+
for (const href of modulePreloads ?? []) preloadModule(href);
|
|
10
13
|
return createElement(Fragment, null, createElement("meta", { charSet: "utf-8" }), createElement("meta", {
|
|
11
14
|
name: "viewport",
|
|
12
15
|
content: "width=device-width, initial-scale=1"
|
|
@@ -19,7 +22,11 @@ function wrapSsrElement(element, opts) {
|
|
|
19
22
|
search: opts.search
|
|
20
23
|
} }, withParams);
|
|
21
24
|
const withNuqs = createElement(TimberNuqsAdapter, null, withNav);
|
|
22
|
-
|
|
25
|
+
const withRoot = createElement(SsrNavigationRoot, { modulePreloads: opts.modulePreloads }, withNuqs);
|
|
26
|
+
return createElement(SsrDataProvider, { value: {
|
|
27
|
+
search: opts.search,
|
|
28
|
+
cookies: opts.cookies
|
|
29
|
+
} }, withRoot);
|
|
23
30
|
}
|
|
24
31
|
export { wrapSsrElement };
|
|
25
32
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-wrappers.js","names":[],"sources":["../../../../src/server/ssr-wrappers.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ssr-wrappers.js","names":[],"sources":["../../../../src/server/ssr-wrappers.tsx"],"mappings":";;;;;;;AA+DA,SAAS,kBAAkB,EACzB,UACA,kBAIY;CACZ,OAAO,cACL,UACA,MACA,cAAc,kBAAkB,EAAE,eAAe,CAAC,GAClD,QACF;AACF;AAsBA,SAAS,iBAAiB,EAAE,kBAAqE;CAC/F,KAAK,MAAM,QAAQ,kBAAkB,CAAC,GAAG,cAAc,IAAI;CAC3D,OAAO,cACL,UACA,MACA,cAAc,QAAQ,EAAE,SAAS,QAAQ,CAAC,GAC1C,cAAc,QAAQ;EAAE,MAAM;EAAY,SAAS;CAAsC,CAAC,CAC5F;AACF;AAiDA,SAAgB,eAAe,SAAoB,MAAiC;CAKlF,MAAM,aAAa,cAAc,aAAa,EAAE,QAAQ,KAAK,aAAa,GAAG,OAAO;CAGpF,MAAM,UAAU,cACd,oBACA,EAAE,OAAO;EAAE,UAAU,KAAK;EAAU,QAAQ,KAAK;CAAO,EAAE,GAC1D,UACF;CAGA,MAAM,WAAW,cAAc,mBAAmB,MAAM,OAAO;CAG/D,MAAM,WAAW,cACf,mBACA,EAAE,gBAAgB,KAAK,eAAe,GACtC,QACF;CAKA,OAAO,cACL,iBACA,EAAE,OAAO;EAAE,QAAQ,KAAK;EAAQ,SAAS,KAAK;CAAQ,EAAE,GACxD,QACF;AACF"}
|
|
@@ -89,12 +89,5 @@ export declare function buildFontPreloadTags(fonts: ManifestFontEntry[]): string
|
|
|
89
89
|
* for each layout and page. Deduplicates across segments.
|
|
90
90
|
*/
|
|
91
91
|
export declare function collectRouteModulepreloads(segments: SegmentWithFiles[], manifest: BuildManifest): string[];
|
|
92
|
-
/**
|
|
93
|
-
* Generate <link rel="modulepreload"> tags for JS dependency URLs.
|
|
94
|
-
*
|
|
95
|
-
* Modulepreload hints tell the browser to fetch and parse JS modules
|
|
96
|
-
* before they're needed, reducing waterfall latency for dynamic imports.
|
|
97
|
-
*/
|
|
98
|
-
export declare function buildModulepreloadTags(urls: string[]): string;
|
|
99
92
|
export {};
|
|
100
93
|
//# sourceMappingURL=build-manifest.d.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C7B;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,gBAAgB,EAAE,EAAE,QAAQ,EAAE,aAAa,GAAG,MAAM,EAAE,CAmB/F;AAID;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,QAAQ,EAAE,aAAa,GACtB,iBAAiB,EAAE,CAmBrB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAOvE;AAID;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,QAAQ,EAAE,aAAa,GACtB,MAAM,EAAE,CAmBV"}
|
|
@@ -93,13 +93,14 @@ export declare function injectRscPayload(htmlStream: ReadableStream<Uint8Array>,
|
|
|
93
93
|
* Suspense boundaries are still streaming. Uses dynamic `import()` to kick off
|
|
94
94
|
* module loading, enabling hydration to start before the stream closes.
|
|
95
95
|
*
|
|
96
|
-
* - `
|
|
97
|
-
*
|
|
98
|
-
*
|
|
96
|
+
* - `modulePreloads`: hashed URLs of the browser entry's production dependencies.
|
|
97
|
+
* SSR hands them to React as `preloadModule()` calls (ssr-wrappers.tsx), so
|
|
98
|
+
* Fizz writes one `<link rel="modulepreload">` per chunk — deduplicated
|
|
99
|
+
* against the client-reference preloads plugin-rsc issues for the same chunks.
|
|
99
100
|
*/
|
|
100
101
|
export interface ClientBootstrapConfig {
|
|
101
102
|
bootstrapScriptContent: string;
|
|
102
|
-
|
|
103
|
+
modulePreloads: string[];
|
|
103
104
|
}
|
|
104
105
|
/**
|
|
105
106
|
* Build client bootstrap configuration based on runtime config.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-injectors.d.ts","sourceRoot":"","sources":["../../src/server/html-injectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAWH,OAAO,EAAsB,KAAK,qBAAq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
import { _ as getHeaders, a as parseFormData, c as deny, d as waitUntil, i as coerce, l as redirect, n as revalidatePath, p as getCookieJar, r as revalidateTag, u as redirectExternal, y as getSegmentParams } from "../_chunks/actions-
|
|
1
|
+
import { _ as getHeaders, a as parseFormData, c as deny, d as waitUntil, i as coerce, l as redirect, n as revalidatePath, p as getCookieJar, r as revalidateTag, u as redirectExternal, y as getSegmentParams } from "../_chunks/actions-DH_TCxJb.js";
|
|
2
2
|
import { t as formatSize } from "../_chunks/format-DuPOoXUP.js";
|
|
3
3
|
import { C as isDevMode, L as isDenySignal, N as withSpan, O as getSpanId, R as isRedirectSignal, S as isDebug, k as getTraceId, w as addSpanEvent } from "../_chunks/logger-D1sWX2I0.js";
|
|
4
4
|
// src/shared/redirect-type.ts
|
package/dist/server/internal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as setMatchedSegmentPath, E as runOutsideReactCacheScope, S as runWithSegmentParams, T as setSegmentParams, b as markResponseFlushed, f as getCookie, g as getHeader, h as applyRequestHeaderOverlay, i as coerce, m as getSetCookieHeaders, o as DenySignal, s as RedirectSignal, t as executeAction, v as getSearchParams, w as setMutableCookieContext, x as runWithRequestContext, y as getSegmentParams } from "../_chunks/actions-
|
|
1
|
+
import { C as setMatchedSegmentPath, E as runOutsideReactCacheScope, S as runWithSegmentParams, T as setSegmentParams, b as markResponseFlushed, f as getCookie, g as getHeader, h as applyRequestHeaderOverlay, i as coerce, m as getSetCookieHeaders, o as DenySignal, s as RedirectSignal, t as executeAction, v as getSearchParams, w as setMutableCookieContext, x as runWithRequestContext, y as getSegmentParams } from "../_chunks/actions-DH_TCxJb.js";
|
|
2
2
|
import { a as requestContextAls, n as earlyHintsSenderAls, r as prebuiltCaptureAls, s as timingAls } from "../_chunks/als-registry-C-iwbtvI.js";
|
|
3
3
|
import { c as collectRouteModulepreloads, i as traceTimingEntry, o as collectRouteCss, s as collectRouteFonts } from "../_chunks/dev-span-0aG7Q_Ph.js";
|
|
4
4
|
import { c as drainWithDeadline, d as isAbortError, f as releaseReason, i as withResponseInit, m as onAbortUntil, n as discardResponseBody, o as concatBytes, p as endScope, r as nodeBodyOps, u as wrapResponseWithStreamTiming } from "../_chunks/node-response-Cp62CtH1.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-route.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/render-route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"render-route.d.ts","sourceRoot":"","sources":["../../../src/server/rsc-entry/render-route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAM1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAG9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAQ/D;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,qBAAqB,CAAC;IACvC,gBAAgB,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IACxC,mEAAmE;IACnE,cAAc,EAAE,sBAAsB,CAAC;IACvC,kBAAkB,EAAE,oBAAoB,CAAC;IACzC,aAAa,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAClE;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,UAAU,EACjB,eAAe,EAAE,OAAO,EACxB,IAAI,EAAE,eAAe,EACrB,YAAY,CAAC,EAAE,mBAAmB,GACjC,OAAO,CAAC,QAAQ,CAAC,CA6JnB"}
|
|
@@ -56,6 +56,8 @@ interface SsrRenderOptions {
|
|
|
56
56
|
clientBootstrap: ClientBootstrapConfig;
|
|
57
57
|
clientJsDisabled: boolean;
|
|
58
58
|
headHtml: string;
|
|
59
|
+
/** The matched segments' JS chunks, preloaded after the browser entry's. */
|
|
60
|
+
routeModulePreloads: string[];
|
|
59
61
|
deferSuspenseFor: number;
|
|
60
62
|
/** Tier 2 global-error.tsx file, if present in app/. */
|
|
61
63
|
globalError?: GlobalErrorFile;
|
|
@@ -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;AAMlE,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;AAO/D,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAuC,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AA2B7F;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAiB,CAAC;AAE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,MAAM,qBAAqB,CAAC;AA2B7F;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAiB,CAAC;AAEhF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iCAAiC,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAqB,CAAC;AAEtF,UAAU,gBAAgB;IACxB,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,YAAY,CAAC;IACxB,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,gBAAgB,EAAE,oBAAoB,EAAE,CAAC;IACzC,KAAK,EAAE,UAAU,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,qBAAqB,CAAC;IACvC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,wDAAwD;IACxD,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;;OAIG;IACH,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA8QjF"}
|
|
@@ -80,6 +80,12 @@ export interface NavContext {
|
|
|
80
80
|
headHtml: string;
|
|
81
81
|
/** Inline JS for React's bootstrapScriptContent — kicks off module loading */
|
|
82
82
|
bootstrapScriptContent: string;
|
|
83
|
+
/**
|
|
84
|
+
* Hashed URLs of the browser entry's chunks to modulepreload. SSR issues
|
|
85
|
+
* them as React `preloadModule()` calls so Fizz deduplicates them against
|
|
86
|
+
* client-reference preloads (ssr-wrappers.tsx). Absent on fallback pages.
|
|
87
|
+
*/
|
|
88
|
+
modulePreloads?: readonly string[];
|
|
83
89
|
/**
|
|
84
90
|
* Request CSP nonce, generated when middleware read `ctx.nonce` for its
|
|
85
91
|
* `Content-Security-Policy` header (`getCspNonce()`). SSR passes it to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-bridge-types.d.ts","sourceRoot":"","sources":["../../src/server/ssr-bridge-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,6BAA6B;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;OAUG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,eAAe,EAAE,OAAO,CAAC;IACzB,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,sBAAsB,EAAE,MAAM,CAAC;IAC/B;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB;;;0DAGsD;IACtD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;iFAE6E;IAC7E,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;4DACwD;IACxD,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB;;;;;;;;;;;;;;;;;OAiBG;IACH,oBAAoB,CAAC,EAAE,MAAM,MAAM,CAAC;IAEpC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,oFA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,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;4DACwD;IACxD,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB;;;;;;;;;;;;;;;;;OAiBG;IACH,oBAAoB,CAAC,EAAE,MAAM,MAAM,CAAC;IAEpC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,UAAU,CAAC;IACpB;;;;;;;;;;;;;;;;OAgBG;IACH,oBAAoB,EAAE,OAAO,CAAC;CAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-entry.d.ts","sourceRoot":"","sources":["../../src/server/ssr-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"ssr-entry.d.ts","sourceRoot":"","sources":["../../src/server/ssr-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA0BH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA+BvD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,eAAe,CAAC,CAoM1B;eAEc,SAAS"}
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
*
|
|
31
31
|
* Per-request isolation is by construction: the provider values are part
|
|
32
32
|
* of this request's element tree, so concurrent requests cannot observe
|
|
33
|
-
* each other's values
|
|
34
|
-
* `useCookie()
|
|
33
|
+
* each other's values. The SSR-only SsrDataProvider (client/ssr-data.ts),
|
|
34
|
+
* outermost, carries the request cookies for `useCookie()` the same way.
|
|
35
35
|
*
|
|
36
36
|
* **What actually shifts a useId is a fork, not depth.** `useId` derives from
|
|
37
37
|
* React's tree context, which only changes where a fiber has more than one
|
|
@@ -61,6 +61,10 @@ export interface SsrWrapOptions {
|
|
|
61
61
|
* hands to the same component during hydration.
|
|
62
62
|
*/
|
|
63
63
|
paramsSource: unknown;
|
|
64
|
+
/** Hashed URLs of the browser entry's chunks to modulepreload (NavContext.modulePreloads). */
|
|
65
|
+
modulePreloads?: readonly string[];
|
|
66
|
+
/** The request's cookies, for `useCookie()` through the SSR data context. */
|
|
67
|
+
cookies: ReadonlyMap<string, string>;
|
|
64
68
|
}
|
|
65
69
|
/**
|
|
66
70
|
* Wrap the SSR element tree with the same component boundaries as the
|
|
@@ -78,13 +82,14 @@ export interface SsrWrapOptions {
|
|
|
78
82
|
* → [RSC element]
|
|
79
83
|
*
|
|
80
84
|
* SSR tree (this function):
|
|
81
|
-
*
|
|
82
|
-
* →
|
|
83
|
-
* →
|
|
84
|
-
* →
|
|
85
|
-
* →
|
|
86
|
-
* →
|
|
87
|
-
* →
|
|
85
|
+
* SsrDataProvider (SSR only — client/ssr-data.ts)
|
|
86
|
+
* → SsrNavigationRoot
|
|
87
|
+
* → Fragment(DocumentDefaults, element)
|
|
88
|
+
* → TimberNuqsAdapter (real — same component)
|
|
89
|
+
* → NuqsAdapterProvider
|
|
90
|
+
* → NavigationProvider (real — same component)
|
|
91
|
+
* → PayloadRoot → ParamsProvider (real — same components)
|
|
92
|
+
* → [RSC element]
|
|
88
93
|
*/
|
|
89
94
|
export declare function wrapSsrElement(element: ReactNode, opts: SsrWrapOptions): ReactNode;
|
|
90
95
|
//# sourceMappingURL=ssr-wrappers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-wrappers.d.ts","sourceRoot":"","sources":["../../src/server/ssr-wrappers.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ssr-wrappers.d.ts","sourceRoot":"","sources":["../../src/server/ssr-wrappers.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AA6DhE,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB,8FAA8F;IAC9F,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,6EAA6E;IAC7E,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,GAAG,SAAS,CAgClF"}
|
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.250",
|
|
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",
|
|
@@ -157,14 +157,14 @@
|
|
|
157
157
|
},
|
|
158
158
|
"dependencies": {
|
|
159
159
|
"@opentelemetry/api": "~1.10.0",
|
|
160
|
-
"@opentelemetry/context-async-hooks": "^3.
|
|
161
|
-
"@opentelemetry/sdk-trace-base": "^2.12.
|
|
160
|
+
"@opentelemetry/context-async-hooks": "^3.1.1",
|
|
161
|
+
"@opentelemetry/sdk-trace-base": "^2.12.1",
|
|
162
162
|
"@vitejs/plugin-rsc": "0.5.39",
|
|
163
|
-
"cookie": "^2.0.
|
|
163
|
+
"cookie": "^2.0.2",
|
|
164
164
|
"jsonc-parser": "^3.3.1",
|
|
165
165
|
"magic-string": "^1.4.5",
|
|
166
166
|
"nitro": "3.0.261103-rc",
|
|
167
|
-
"oxc-transform-react": "^0.
|
|
167
|
+
"oxc-transform-react": "^0.158.0",
|
|
168
168
|
"srvx": "^1.0.8"
|
|
169
169
|
},
|
|
170
170
|
"peerDependencies": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* they are the router's, and hydration makes the page current through
|
|
11
11
|
* `RouterInstance.hydrate` like any other commit (TIM-1541).
|
|
12
12
|
*
|
|
13
|
-
* See design/19-client-navigation.md §
|
|
13
|
+
* See design/19-client-navigation.md §'History Stack'
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import type { RouterInstance } from '#client-internal';
|
|
@@ -19,7 +19,7 @@ import { getScrollY } from './scroll.ts';
|
|
|
19
19
|
import { locationSearch } from '../location-search.ts';
|
|
20
20
|
|
|
21
21
|
interface PostHydrationOptions {
|
|
22
|
-
router: RouterInstance
|
|
22
|
+
router: Pick<RouterInstance, 'handlePopState'>;
|
|
23
23
|
navApiController: NavigationApiController | null;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -37,22 +37,25 @@ export function setupPostHydration({ router, navApiController }: PostHydrationOp
|
|
|
37
37
|
// that set 'manual'.
|
|
38
38
|
window.history.scrollRestoration = 'auto';
|
|
39
39
|
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
window.history.
|
|
40
|
+
// Mark the initial entry without measuring. Hydration has just dirtied
|
|
41
|
+
// styles, so reading scroll position here would force a synchronous
|
|
42
|
+
// layout (Lighthouse 'Forced reflow'). The entry keeps the scrollY it
|
|
43
|
+
// already carries — on reload and back/forward that is the position the
|
|
44
|
+
// scroll listener saved before the page unloaded — and the real position
|
|
45
|
+
// is measured after the next frame, once layout is clean.
|
|
46
|
+
if (!navApiController) {
|
|
47
|
+
const prev = window.history.state as { scrollY?: unknown } | null;
|
|
48
|
+
const scrollY = prev && typeof prev.scrollY === 'number' ? prev.scrollY : 0;
|
|
49
|
+
window.history.replaceState({ timber: true, scrollY }, '');
|
|
48
50
|
}
|
|
51
|
+
requestAnimationFrame(() => setTimeout(writeScrollPosition, 0));
|
|
49
52
|
|
|
50
53
|
// Register popstate handler for back/forward navigation.
|
|
51
54
|
// When Navigation API is active, the navigate event covers traversals —
|
|
52
55
|
// popstate is a no-op. When unavailable, popstate handles back/forward.
|
|
53
56
|
//
|
|
54
57
|
// Use pathname+search (not full href) to match the URL format used by
|
|
55
|
-
// navigate() — Link hrefs are relative paths like
|
|
58
|
+
// navigate() — Link hrefs are relative paths like '/scroll-test/page-a'.
|
|
56
59
|
// Read scrollY from history.state — the browser maintains per-entry state
|
|
57
60
|
// so duplicate URLs in history each have their own scroll position.
|
|
58
61
|
window.addEventListener('popstate', () => {
|
|
@@ -83,17 +86,19 @@ export function setupPostHydration({ router, navApiController }: PostHydrationOp
|
|
|
83
86
|
let scrollTimer: ReturnType<typeof setTimeout>;
|
|
84
87
|
function saveScrollPosition(): void {
|
|
85
88
|
clearTimeout(scrollTimer);
|
|
86
|
-
scrollTimer = setTimeout(
|
|
87
|
-
const y = getScrollY();
|
|
88
|
-
if (navApiController) {
|
|
89
|
-
navApiController.saveScrollPosition(y);
|
|
90
|
-
} else {
|
|
91
|
-
const state = window.history.state;
|
|
92
|
-
if (state && typeof state === 'object') {
|
|
93
|
-
window.history.replaceState({ ...state, scrollY: y }, '');
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}, 100);
|
|
89
|
+
scrollTimer = setTimeout(writeScrollPosition, 100);
|
|
97
90
|
}
|
|
98
91
|
window.addEventListener('scroll', saveScrollPosition, { passive: true });
|
|
92
|
+
|
|
93
|
+
function writeScrollPosition(): void {
|
|
94
|
+
const y = getScrollY();
|
|
95
|
+
if (navApiController) {
|
|
96
|
+
navApiController.saveScrollPosition(y);
|
|
97
|
+
} else {
|
|
98
|
+
const state = window.history.state;
|
|
99
|
+
if (state && typeof state === 'object') {
|
|
100
|
+
window.history.replaceState({ ...state, scrollY: y }, '');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
99
104
|
}
|
|
@@ -7,15 +7,6 @@
|
|
|
7
7
|
* See design/19-client-navigation.md §"Overflow Scroll Containers".
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* Read the current scroll position.
|
|
12
|
-
*
|
|
13
|
-
* Checks window scroll first, then explicit `data-timber-scroll-restoration`
|
|
14
|
-
* containers. With segment tree merging, shared layouts are reconciled in
|
|
15
|
-
* place via `cloneElement` — React preserves their DOM and scroll state
|
|
16
|
-
* naturally. We don't need to auto-detect overflow containers; only
|
|
17
|
-
* explicitly marked containers are tracked.
|
|
18
|
-
*/
|
|
19
10
|
/**
|
|
20
11
|
* Scroll the element matching a URL #fragment into view.
|
|
21
12
|
*
|
|
@@ -39,6 +30,18 @@ export function scrollToHashTarget(hash: string): boolean {
|
|
|
39
30
|
return true;
|
|
40
31
|
}
|
|
41
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Read the current scroll position.
|
|
35
|
+
*
|
|
36
|
+
* Checks window scroll first, then explicit `data-timber-scroll-restoration`
|
|
37
|
+
* containers. With segment tree merging, shared layouts are reconciled in
|
|
38
|
+
* place via `cloneElement` — React preserves their DOM and scroll state
|
|
39
|
+
* naturally. We don't need to auto-detect overflow containers; only
|
|
40
|
+
* explicitly marked containers are tracked.
|
|
41
|
+
*
|
|
42
|
+
* Every read here forces a layout when styles are dirty, so callers must not
|
|
43
|
+
* run it synchronously during boot (see post-hydration.ts).
|
|
44
|
+
*/
|
|
42
45
|
export function getScrollY(): number {
|
|
43
46
|
if (window.scrollY || document.documentElement.scrollTop || document.body.scrollTop) {
|
|
44
47
|
return window.scrollY || document.documentElement.scrollTop || document.body.scrollTop;
|
package/src/client/internal.ts
CHANGED
|
@@ -22,10 +22,6 @@ export type {
|
|
|
22
22
|
export { getRouter, getRouterOrNull, setGlobalRouter } from './router-ref.ts';
|
|
23
23
|
export type { NavigationEpoch } from './router-lifecycle.ts';
|
|
24
24
|
|
|
25
|
-
// ── SSR bridge ───────────────────────────────────────────────────────────
|
|
26
|
-
export { registerSsrDataProvider, getSsrData } from './ssr-data.ts';
|
|
27
|
-
export type { SsrData } from './ssr-data.ts';
|
|
28
|
-
|
|
29
25
|
// ── Segment context ──────────────────────────────────────────────────────
|
|
30
26
|
export { SegmentProvider, useSegmentContext } from './segment-context.ts';
|
|
31
27
|
export type { SegmentContextValue } from './segment-context.ts';
|
package/src/client/link.tsx
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
} from '../shared/href-validation.ts';
|
|
36
36
|
import { LinkStatusContext } from './use-link-status.ts';
|
|
37
37
|
import { getRouterOrNull } from './router-ref.ts';
|
|
38
|
-
import {
|
|
38
|
+
import { useSsrData } from './ssr-data.ts';
|
|
39
39
|
import { mergePreservedSearchParams } from '../shared/merge-search-params.ts';
|
|
40
40
|
import { locationSearch } from './location-search.ts';
|
|
41
41
|
import { stripRscCacheKey } from '../shared/rsc-cache-key.ts';
|
|
@@ -47,16 +47,17 @@ const LINK_IDLE: LinkStatus = { isPending: false };
|
|
|
47
47
|
// ─── Current Search Params ────────────────────────────────────────
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
* Read the current URL's search string
|
|
51
|
-
*
|
|
52
|
-
*
|
|
50
|
+
* Read the current URL's search string. During SSR, the request's raw query
|
|
51
|
+
* string from the SSR data context (passed in as `ssrSearch`); on the
|
|
52
|
+
* client, window.location.search. Both have the same `''` or
|
|
53
53
|
* `?…` shape, preserving repeated keys (`?tag=a&tag=b`) so the
|
|
54
54
|
* server-rendered href matches what the hydrated client rebuilds from the
|
|
55
55
|
* address bar (TIM-1428). Returns empty string if unavailable.
|
|
56
56
|
*/
|
|
57
|
-
function getCurrentSearch(): string {
|
|
57
|
+
function getCurrentSearch(ssrSearch: string | undefined): string {
|
|
58
|
+
if (ssrSearch !== undefined) return ssrSearch;
|
|
58
59
|
if (typeof window !== 'undefined') return locationSearch();
|
|
59
|
-
return
|
|
60
|
+
return '';
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
/** Native in-page scrolling needs neither an RSC navigation nor a prefetch. */
|
|
@@ -329,25 +330,25 @@ export const Link: LinkFunction = function LinkImpl(props: any) {
|
|
|
329
330
|
const clickSeq = useRef(0);
|
|
330
331
|
const linkStatus = isPending ? LINK_PENDING : LINK_IDLE;
|
|
331
332
|
|
|
332
|
-
// Preserve search params from the current URL when requested.
|
|
333
|
-
//
|
|
334
|
-
//
|
|
335
|
-
//
|
|
336
|
-
|
|
333
|
+
// Preserve search params from the current URL when requested. On the
|
|
334
|
+
// client, window.location.search is always current; during SSR, the SSR
|
|
335
|
+
// data context provides the request's raw query string. That context never
|
|
336
|
+
// changes in the browser, so reading it costs no re-renders.
|
|
337
|
+
const ssrSearch = useSsrData()?.search;
|
|
337
338
|
const internal = isInternalHref(baseHref);
|
|
338
339
|
|
|
339
340
|
// Only preserve search params for internal links — leaking current
|
|
340
341
|
// page params (tokens, UTM, etc.) to external domains is a data leak.
|
|
341
342
|
const resolvedHref =
|
|
342
343
|
preserveSearchParams && internal
|
|
343
|
-
? mergePreservedSearchParams(baseHref, getCurrentSearch(), preserveSearchParams)
|
|
344
|
+
? mergePreservedSearchParams(baseHref, getCurrentSearch(ssrSearch), preserveSearchParams)
|
|
344
345
|
: baseHref;
|
|
345
346
|
|
|
346
347
|
// Event callbacks may update the URL, so resolve preserved params at use time.
|
|
347
348
|
const resolveEventUrl = () =>
|
|
348
349
|
new URL(
|
|
349
350
|
preserveSearchParams
|
|
350
|
-
? mergePreservedSearchParams(baseHref, getCurrentSearch(), preserveSearchParams)
|
|
351
|
+
? mergePreservedSearchParams(baseHref, getCurrentSearch(ssrSearch), preserveSearchParams)
|
|
351
352
|
: resolvedHref,
|
|
352
353
|
window.location.href
|
|
353
354
|
);
|
package/src/client/ssr-data.ts
CHANGED
|
@@ -1,78 +1,71 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SSR Data —
|
|
2
|
+
* SSR Data — the request values client code reads while rendering on the server.
|
|
3
3
|
*
|
|
4
|
-
* `useCookie()` and `<Link preserveSearchParams>` have no
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `ParamsContext`, decoded from the payload root.
|
|
4
|
+
* `useCookie()` and `<Link preserveSearchParams>` have no other way to see the
|
|
5
|
+
* request's cookies and search string during SSR, so the SSR wrapper chain
|
|
6
|
+
* (server/ssr-wrappers.tsx) provides them here. `useSearchParams()` reads
|
|
7
|
+
* NavigationContext and checks this context only to tell that it is
|
|
8
|
+
* rendering on the server. Route params travel in `ParamsContext`, decoded
|
|
9
|
+
* from the payload root.
|
|
11
10
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* render (in the browser, or before the provider is registered) there is no
|
|
17
|
-
* request, and getSsrData() returns undefined.
|
|
11
|
+
* Link reads the search string here rather than from NavigationContext
|
|
12
|
+
* because this context never changes in the browser: subscribing every Link
|
|
13
|
+
* to NavigationContext would re-render all of them on each navigation.
|
|
14
|
+
* wrapSsrElement fills both from the same `search` option.
|
|
18
15
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
16
|
+
* Why a React context, not AsyncLocalStorage: Fizz resumes a suspended
|
|
17
|
+
* subtree (an async layout, a lazy Flight row) from whatever callback
|
|
18
|
+
* resolved it. On Node that is a `data` event of the Flight stream, which
|
|
19
|
+
* runs in the async context of the RSC render that produced the chunk, not
|
|
20
|
+
* the SSR request's. An ALS store set around `handleSsr` was gone there, so
|
|
21
|
+
* every cookie read below the first streamed chunk came back empty. A
|
|
22
|
+
* context value is part of the request's element tree: React restores it
|
|
23
|
+
* wherever it resumes the tree, and concurrent requests cannot see each
|
|
24
|
+
* other's.
|
|
23
25
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
+
* In the browser no provider is mounted and `useSsrData()` returns null.
|
|
27
|
+
*
|
|
28
|
+
* IMPORTANT: This module is imported by 'use client' hooks bundled for the
|
|
29
|
+
* browser. It must not import node:async_hooks or other Node-only APIs.
|
|
26
30
|
*/
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
//
|
|
32
|
+
// A namespace import, as use-cookie.ts does: `defineCookie` pulls this module
|
|
33
|
+
// into the RSC environment, whose React build exports no `useContext`, and a
|
|
34
|
+
// named import of it fails to link there. Nothing here runs in RSC.
|
|
35
|
+
import * as React from 'react';
|
|
36
|
+
import { createGlobalContext } from './global-context.ts';
|
|
31
37
|
|
|
32
38
|
export interface SsrData {
|
|
33
39
|
/**
|
|
34
40
|
* The request's raw app-visible query string (`''` or `?…`), matching what
|
|
35
|
-
* `window.location.search` will hold after hydration.
|
|
36
|
-
*
|
|
37
|
-
* (`?tag=a&tag=b`), which a collapsed `Record<string, string>` cannot
|
|
38
|
-
* (TIM-1428). Parse with `new URLSearchParams(search)` where needed.
|
|
41
|
+
* `window.location.search` will hold after hydration. Raw, so repeated keys
|
|
42
|
+
* (`?tag=a&tag=b`) survive (TIM-1428).
|
|
39
43
|
*/
|
|
40
44
|
search: string;
|
|
41
45
|
/** The request's cookies as name→value pairs */
|
|
42
|
-
cookies:
|
|
46
|
+
cookies: ReadonlyMap<string, string>;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
|
-
// ─── ALS-Backed Provider ─────────────────────────────────────────
|
|
46
|
-
//
|
|
47
|
-
// Server-side code (ssr-entry.ts) registers a provider that reads
|
|
48
|
-
// from AsyncLocalStorage. This avoids importing node:async_hooks
|
|
49
|
-
// in this browser-bundled module.
|
|
50
|
-
//
|
|
51
|
-
// Module singleton guarantee: In Vite's SSR environment, both
|
|
52
|
-
// ssr-entry.ts (via #/client/ssr-data.js) and client component hooks
|
|
53
|
-
// (via @timber-js/app/client) must resolve to the SAME module instance
|
|
54
|
-
// of this file. The timber-shims plugin ensures this by remapping
|
|
55
|
-
// @timber-js/app/client → src/client/index.ts in the SSR environment.
|
|
56
|
-
// Without this remap, @timber-js/app/client resolves to dist/ (via
|
|
57
|
-
// package.json exports), creating a split where registerSsrDataProvider
|
|
58
|
-
// writes to one instance but getSsrData reads from another.
|
|
59
|
-
// See timber-shims plugin resolveId for details.
|
|
60
|
-
|
|
61
49
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* register their own provider (and `undefined` to reset).
|
|
50
|
+
* On globalThis (by Symbol.for key) so a module duplicated across chunks
|
|
51
|
+
* still yields one context per React instance — see global-context.ts.
|
|
65
52
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
function getSsrDataContext(): React.Context<SsrData | null> {
|
|
54
|
+
return createGlobalContext<SsrData | null>(Symbol.for('__timber_ssr_data_ctx'), null);
|
|
68
55
|
}
|
|
69
56
|
|
|
70
|
-
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*/
|
|
76
|
-
export function
|
|
77
|
-
|
|
57
|
+
/** The current request's SSR data, or null outside a server render. */
|
|
58
|
+
export function useSsrData(): SsrData | null {
|
|
59
|
+
return React.useContext(getSsrDataContext());
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Provides the request's SSR data to the tree. Mounted by wrapSsrElement only. */
|
|
63
|
+
export function SsrDataProvider({
|
|
64
|
+
value,
|
|
65
|
+
children,
|
|
66
|
+
}: {
|
|
67
|
+
value: SsrData;
|
|
68
|
+
children?: React.ReactNode;
|
|
69
|
+
}): React.ReactElement {
|
|
70
|
+
return React.createElement(getSsrDataContext().Provider, { value }, children);
|
|
78
71
|
}
|