veryfront 0.1.1135 → 0.1.1142

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.
Files changed (48) hide show
  1. package/esm/deno.js +1 -1
  2. package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts.map +1 -1
  3. package/esm/src/html/hydration-script-builder/hydration-data-generator.js +3 -0
  4. package/esm/src/html/hydration-script-builder/templates/renderer.d.ts.map +1 -1
  5. package/esm/src/html/hydration-script-builder/templates/renderer.js +24 -0
  6. package/esm/src/html/hydration-script-builder/templates/router.d.ts.map +1 -1
  7. package/esm/src/html/hydration-script-builder/templates/router.js +24 -0
  8. package/esm/src/html/hydration-script-builder/types.d.ts +2 -0
  9. package/esm/src/html/hydration-script-builder/types.d.ts.map +1 -1
  10. package/esm/src/html/schemas/html.schema.d.ts +4 -0
  11. package/esm/src/html/schemas/html.schema.d.ts.map +1 -1
  12. package/esm/src/html/schemas/html.schema.js +2 -0
  13. package/esm/src/react/runtime/core.d.ts +27 -2
  14. package/esm/src/react/runtime/core.d.ts.map +1 -1
  15. package/esm/src/react/runtime/core.js +11 -4
  16. package/esm/src/rendering/app-reserved.d.ts +10 -1
  17. package/esm/src/rendering/app-reserved.d.ts.map +1 -1
  18. package/esm/src/rendering/app-reserved.js +13 -3
  19. package/esm/src/rendering/layouts/layout-applicator.d.ts +3 -0
  20. package/esm/src/rendering/layouts/layout-applicator.d.ts.map +1 -1
  21. package/esm/src/rendering/layouts/layout-applicator.js +3 -0
  22. package/esm/src/rendering/orchestrator/html.d.ts +15 -0
  23. package/esm/src/rendering/orchestrator/html.d.ts.map +1 -1
  24. package/esm/src/rendering/orchestrator/html.js +66 -1
  25. package/esm/src/rendering/orchestrator/layout.d.ts +1 -1
  26. package/esm/src/rendering/orchestrator/layout.d.ts.map +1 -1
  27. package/esm/src/rendering/orchestrator/layout.js +2 -1
  28. package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
  29. package/esm/src/rendering/orchestrator/pipeline.js +17 -1
  30. package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts +9 -0
  31. package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts.map +1 -1
  32. package/esm/src/rendering/orchestrator/ssr-orchestrator.js +96 -8
  33. package/esm/src/rendering/orchestrator/ssr.d.ts.map +1 -1
  34. package/esm/src/rendering/orchestrator/ssr.js +1 -0
  35. package/esm/src/rendering/orchestrator/types.d.ts +4 -0
  36. package/esm/src/rendering/orchestrator/types.d.ts.map +1 -1
  37. package/esm/src/rendering/renderer.d.ts.map +1 -1
  38. package/esm/src/rendering/renderer.js +1 -0
  39. package/esm/src/rendering/rsc/client-module-strategy.d.ts +6 -0
  40. package/esm/src/rendering/rsc/client-module-strategy.d.ts.map +1 -1
  41. package/esm/src/server/services/rendering/ssr.service.d.ts +1 -1
  42. package/esm/src/server/services/rendering/ssr.service.d.ts.map +1 -1
  43. package/esm/src/server/services/rendering/ssr.service.js +13 -0
  44. package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
  45. package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
  46. package/esm/src/utils/version-constant.d.ts +1 -1
  47. package/esm/src/utils/version-constant.js +1 -1
  48. package/package.json +5 -5
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.1135",
3
+ "version": "0.1.1142",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -1 +1 @@
1
- {"version":3,"file":"hydration-data-generator.d.ts","sourceRoot":"","sources":["../../../../src/src/html/hydration-script-builder/hydration-data-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAK3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAyCzD,KAAK,gBAAgB,GAAG,qBAAqB,GAAG;IAC9C,oBAAoB,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACpD,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EACzC,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,gBAAgB,EACzB,gBAAgB,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GACtC,MAAM,CAuDR"}
1
+ {"version":3,"file":"hydration-data-generator.d.ts","sourceRoot":"","sources":["../../../../src/src/html/hydration-script-builder/hydration-data-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAK3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAyCzD,KAAK,gBAAgB,GAAG,qBAAqB,GAAG;IAC9C,oBAAoB,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACpD,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EACzC,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,gBAAgB,EACzB,gBAAgB,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GACtC,MAAM,CA0DR"}
@@ -49,6 +49,9 @@ export function generateHydrationData(slug, params, props, options, serializeOpt
49
49
  appPath: options.appPath
50
50
  ? toProjectRelativePath(options.appPath, options.projectDir) || undefined
51
51
  : undefined,
52
+ errorPath: options.errorPath
53
+ ? toProjectRelativePath(options.errorPath, options.projectDir) || undefined
54
+ : undefined,
52
55
  appRouterRoot: toProjectRelativePath(options.config?.directories?.app ?? "app", options.projectDir).replace(/^\/+|\/+$/g, ""),
53
56
  isolatedClientPage: options.isolatedClientPage,
54
57
  pagePath: options.pagePath
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/renderer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,cAoT7B,CAAC"}
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/renderer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,cA4U7B,CAAC"}
@@ -224,6 +224,29 @@ export const getRendererScript = () => `
224
224
  }
225
225
  }
226
226
 
227
+ // App-router error.tsx boundary. Wraps the page (inside the providers,
228
+ // matching the server wrap) so a throw during render/hydration is caught
229
+ // on the client and error.tsx renders — with a working reset().
230
+ if (data.errorPath) {
231
+ const ErrorComponent = await loadHydrationComponent(data.errorPath, shouldRenderRscClientPage);
232
+ if (ErrorComponent) {
233
+ class AppRouterErrorBoundary extends React.Component {
234
+ constructor(props) { super(props); this.state = { hasError: false, error: null }; }
235
+ static getDerivedStateFromError(error) { return { hasError: true, error: error }; }
236
+ render() {
237
+ if (this.state.hasError) {
238
+ return React.createElement(ErrorComponent, {
239
+ error: this.state.error,
240
+ reset: () => this.setState({ hasError: false, error: null }),
241
+ });
242
+ }
243
+ return this.props.children;
244
+ }
245
+ }
246
+ tree = React.createElement(AppRouterErrorBoundary, null, tree);
247
+ }
248
+ }
249
+
227
250
  const headings = data.headings || [];
228
251
  const pageContext = {
229
252
  slug: data.slug || '',
@@ -231,6 +254,7 @@ export const getRendererScript = () => `
231
254
  params: normalizedParams,
232
255
  query: Object.fromEntries(new URLSearchParams(window.location.search)),
233
256
  frontmatter: data.frontmatter || {},
257
+ data: data.props || {},
234
258
  headings,
235
259
  mdxHeadings: headings, // Alias for backwards compatibility
236
260
  };
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/router.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,cA8uC3B,CAAC"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/router.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,cAswC3B,CAAC"}
@@ -737,6 +737,8 @@ export const getRouterScript = () => `
737
737
  perfEnd('render:loadAll');
738
738
 
739
739
  const [PageComponent, ...rest] = components;
740
+ // errorPath is pushed last in getPageDataModulePaths, so pop it first.
741
+ const ErrorComponent = pageData.errorPath ? rest.pop() : null;
740
742
  const AppComponent = pageData.appPath ? rest.pop() : null;
741
743
  const LayoutComponents = rest;
742
744
 
@@ -801,6 +803,26 @@ export const getRouterScript = () => `
801
803
  log('Wrapped with App component for SPA navigation');
802
804
  }
803
805
 
806
+ // App-router error.tsx boundary — wraps the page so a throw during a
807
+ // client-side navigation render is caught and error.tsx renders (matching
808
+ // the server + initial-hydration boundary), with a working reset().
809
+ if (ErrorComponent) {
810
+ class AppRouterErrorBoundary extends React.Component {
811
+ constructor(props) { super(props); this.state = { hasError: false, error: null }; }
812
+ static getDerivedStateFromError(error) { return { hasError: true, error: error }; }
813
+ render() {
814
+ if (this.state.hasError) {
815
+ return React.createElement(ErrorComponent, {
816
+ error: this.state.error,
817
+ reset: () => this.setState({ hasError: false, error: null }),
818
+ });
819
+ }
820
+ return this.props.children;
821
+ }
822
+ }
823
+ tree = React.createElement(AppRouterErrorBoundary, null, tree);
824
+ }
825
+
804
826
  const headingsArray = pageData.headings || [];
805
827
  const pageContext = {
806
828
  slug: pageData.slug || '',
@@ -808,6 +830,7 @@ export const getRouterScript = () => `
808
830
  params: normalizedParams,
809
831
  query: Object.fromEntries(new URLSearchParams(window.location.search)),
810
832
  frontmatter: pageData.frontmatter || {},
833
+ data: pageData.props || {},
811
834
  headings: headingsArray,
812
835
  mdxHeadings: headingsArray
813
836
  };
@@ -875,6 +898,7 @@ export const getRouterScript = () => `
875
898
  const allPaths = [pageData.pagePath, ...layoutPaths].filter(Boolean);
876
899
 
877
900
  if (pageData.appPath) allPaths.push(pageData.appPath);
901
+ if (pageData.errorPath) allPaths.push(pageData.errorPath);
878
902
 
879
903
  return allPaths;
880
904
  }
@@ -9,6 +9,8 @@ export interface HydrationDataStructure {
9
9
  params: Record<string, string | string[]>;
10
10
  layouts: HydrationLayout[];
11
11
  appPath?: string;
12
+ /** Project-relative path to the app-router error.tsx that wraps the page (client boundary). */
13
+ errorPath?: string;
12
14
  /** Project-relative directory that contains App Router routes. */
13
15
  appRouterRoot?: string;
14
16
  /** The page and advertised client layouts mount inside a server-owned layout island. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/src/html/hydration-script-builder/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAE1F,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC1C,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wFAAwF;IACxF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC;IAC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wFAAwF;IACxF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC;IACtD,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9D,6EAA6E;IAC7E,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB"}
@@ -13,6 +13,7 @@ export declare const getHTMLGenerationOptionsSchema: () => import("../../interna
13
13
  componentPath: import("../../internal-agents/schema.js").Schema<string | undefined>;
14
14
  }>[] | undefined>;
15
15
  appPath: import("../../internal-agents/schema.js").Schema<string | undefined>;
16
+ errorPath: import("../../internal-agents/schema.js").Schema<string | undefined>;
16
17
  appRouterRoot: import("../../internal-agents/schema.js").Schema<string | undefined>;
17
18
  isolatedClientPage: import("../../internal-agents/schema.js").Schema<boolean | undefined>;
18
19
  pagePath: import("../../internal-agents/schema.js").Schema<string | undefined>;
@@ -51,6 +52,7 @@ export declare const getHydrationDataSchema: () => import("../../internal-agents
51
52
  path: import("../../internal-agents/schema.js").Schema<string | undefined>;
52
53
  }>[]>;
53
54
  appPath: import("../../internal-agents/schema.js").Schema<string | undefined>;
55
+ errorPath: import("../../internal-agents/schema.js").Schema<string | undefined>;
54
56
  appRouterRoot: import("../../internal-agents/schema.js").Schema<string | undefined>;
55
57
  isolatedClientPage: import("../../internal-agents/schema.js").Schema<boolean | undefined>;
56
58
  layoutProps: import("../../internal-agents/schema.js").Schema<Record<string, Record<string, unknown>> | undefined>;
@@ -73,6 +75,7 @@ export declare const HTMLGenerationOptionsSchema: import("../../internal-agents/
73
75
  componentPath: import("../../internal-agents/schema.js").Schema<string | undefined>;
74
76
  }>[] | undefined>;
75
77
  appPath: import("../../internal-agents/schema.js").Schema<string | undefined>;
78
+ errorPath: import("../../internal-agents/schema.js").Schema<string | undefined>;
76
79
  appRouterRoot: import("../../internal-agents/schema.js").Schema<string | undefined>;
77
80
  isolatedClientPage: import("../../internal-agents/schema.js").Schema<boolean | undefined>;
78
81
  pagePath: import("../../internal-agents/schema.js").Schema<string | undefined>;
@@ -111,6 +114,7 @@ export declare const HydrationDataSchema: import("../../internal-agents/schema.j
111
114
  path: import("../../internal-agents/schema.js").Schema<string | undefined>;
112
115
  }>[]>;
113
116
  appPath: import("../../internal-agents/schema.js").Schema<string | undefined>;
117
+ errorPath: import("../../internal-agents/schema.js").Schema<string | undefined>;
114
118
  appRouterRoot: import("../../internal-agents/schema.js").Schema<string | undefined>;
115
119
  isolatedClientPage: import("../../internal-agents/schema.js").Schema<boolean | undefined>;
116
120
  layoutProps: import("../../internal-agents/schema.js").Schema<Record<string, Record<string, unknown>> | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"html.schema.d.ts","sourceRoot":"","sources":["../../../../src/src/html/schemas/html.schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE,eAAO,MAAM,oBAAoB,gEAAiD,CAAC;AAEnF,eAAO,MAAM,oBAAoB,gEAAyD,CAAC;AAE3F,eAAO,MA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AACnG,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC;AAGnF,eAAO,MAAM,iBAAiB,0DAAmC,CAAC;AAClE,eAAO,MAAM,iBAAiB,0DAAmC,CAAC;AAClE,eAAO,MAAM,cAAc,0DAAgC,CAAC;AAC5D,eAAO,MAAM,0BAA0B,0DAA4C,CAAC;AACpF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6C,CAAC;AACtF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;GAAqC,CAAC"}
@@ -16,6 +16,7 @@ export const getHTMLGenerationOptionsSchema = defineSchema((v) => v.object({
16
16
  }))
17
17
  .optional(),
18
18
  appPath: v.string().optional(),
19
+ errorPath: v.string().optional(),
19
20
  appRouterRoot: v.string().optional(),
20
21
  isolatedClientPage: v.boolean().optional(),
21
22
  pagePath: v.string().optional(),
@@ -56,6 +57,7 @@ export const getHydrationDataSchema = defineSchema((v) => v.object({
56
57
  path: v.string().optional(),
57
58
  })),
58
59
  appPath: v.string().optional(),
60
+ errorPath: v.string().optional(),
59
61
  appRouterRoot: v.string().optional(),
60
62
  isolatedClientPage: v.boolean().optional(),
61
63
  layoutProps: v.record(v.string(), v.record(v.string(), v.unknown())).optional(),
@@ -65,17 +65,35 @@ export interface PageContextValue {
65
65
  query: Record<string, string>;
66
66
  /** Parsed page frontmatter. */
67
67
  frontmatter: Record<string, unknown>;
68
+ /**
69
+ * Props returned by the page's `getServerData` (the object under its
70
+ * `props` key). Exposed here so layouts and nested components can read
71
+ * server data without prop-drilling from the page. Empty object when the
72
+ * page has no `getServerData`. Populated identically on the server render,
73
+ * the hydration seed, and client navigation.
74
+ */
75
+ data: Record<string, unknown>;
68
76
  /** Headings discovered in the page content. */
69
77
  headings: MdxHeading[];
70
78
  /** MDX headings discovered in the page content. */
71
79
  mdxHeadings: MdxHeading[];
72
80
  }
81
+ /**
82
+ * Input accepted by {@link PageContextProvider}. `data` (the page's
83
+ * `getServerData` props) is optional here so seeds built before the field
84
+ * existed keep compiling; the provider merges the seed over
85
+ * {@link defaultPageContext}, so an omitted field surfaces as its documented
86
+ * empty default rather than `undefined`.
87
+ */
88
+ export type PageContextSeed = Omit<PageContextValue, "data"> & {
89
+ data?: Record<string, unknown>;
90
+ };
73
91
  /** Props accepted by `<PageContextProvider>`. */
74
92
  export interface PageContextProviderProps {
75
93
  /** React children rendered within the page context. */
76
94
  children: React.ReactNode;
77
- /** Page context value to expose to descendants. */
78
- pageContext?: PageContextValue;
95
+ /** Page context seed to expose to descendants. */
96
+ pageContext?: PageContextSeed;
79
97
  }
80
98
  /** How a navigation should affect the history stack. */
81
99
  type HistoryMode = "push" | "replace" | "none";
@@ -120,6 +138,13 @@ export interface HydrationWrapOptions {
120
138
  params?: Record<string, string>;
121
139
  /** Page frontmatter, exposed reactively through `usePageContext()`. */
122
140
  frontmatter?: Record<string, unknown>;
141
+ /**
142
+ * Props returned by the page's `getServerData`, exposed as
143
+ * `usePageContext().data`. Seeded here so a hydrated client tree under an
144
+ * App/RSC page reads the same server data the server render saw, instead of
145
+ * an empty object.
146
+ */
147
+ data?: Record<string, unknown>;
123
148
  }
124
149
  /**
125
150
  * Wraps a hydrated client component in `RouterProvider` (router state) nested
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/src/react/runtime/core.ts"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,4CAA4C;IAC5C,KAAK,EAAE,MAA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M,EAAE,QAAQ,EAAE,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CA0C5F;AAED,4CAA4C;AAC5C,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,CAAC,SAAS,EACtB,OAAO,GAAE,oBAAyB,GACjC,KAAK,CAAC,YAAY,CA8BpB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,WAAW,CAEvC;AAED,2EAA2E;AAC3E,wBAAgB,IAAI,CAAC,EACnB,QAAe,EACf,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,SAAS,GAAG,KAAK,CAAC,YAAY,CAMhC;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,WAAW,GACZ,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAkB/C;AAED,sCAAsC;AACtC,wBAAgB,cAAc,IAAI,gBAAgB,CAEjD;AAwBD,sEAAsE;AACtE,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,GAAG,KAAK,CAAC,YAAY,CAoIpF;AAED,OAAO,EAAE,cAAc,IAAI,MAAM,EAAE,CAAC"}
@@ -18,6 +18,7 @@ const defaultPageContext = {
18
18
  params: {},
19
19
  query: {},
20
20
  frontmatter: {},
21
+ data: {},
21
22
  headings: [],
22
23
  mdxHeadings: [],
23
24
  };
@@ -192,6 +193,7 @@ export function wrapForHydration(child, options = {}) {
192
193
  params,
193
194
  query,
194
195
  frontmatter: options.frontmatter ?? {},
196
+ data: options.data ?? {},
195
197
  };
196
198
  return React.createElement(RouterProvider, {
197
199
  router,
@@ -219,12 +221,17 @@ export function Link({ prefetch = true, children, ...rest }) {
219
221
  * `RouterProvider` (no live router) it falls back to the seed's own location.
220
222
  */
221
223
  export function PageContextProvider({ children, pageContext, }) {
222
- const seed = pageContext ?? defaultPageContext;
223
224
  const router = React.useContext(RouterContext);
224
225
  const hasRouter = router !== defaultRouter;
225
- const value = React.useMemo(() => hasRouter
226
- ? { ...seed, path: router.pathname, query: router.query, params: router.params }
227
- : seed, [seed, hasRouter, router.pathname, router.query, router.params]);
226
+ const value = React.useMemo(() => {
227
+ // Merge the seed over defaults so a seed that omits a newer field (e.g.
228
+ // `data`) still exposes it as its documented empty default, and unchecked
229
+ // JS callers never read `undefined` off the context.
230
+ const seed = { ...defaultPageContext, ...pageContext };
231
+ return hasRouter
232
+ ? { ...seed, path: router.pathname, query: router.query, params: router.params }
233
+ : seed;
234
+ }, [pageContext, hasRouter, router.pathname, router.query, router.params]);
228
235
  return React.createElement(PageContextContext.Provider, { value }, children);
229
236
  }
230
237
  /** Reads the current page context. */
@@ -21,6 +21,15 @@ type ReactLike = {
21
21
  createElement: typeof BundledReact.createElement;
22
22
  };
23
23
  export declare function createErrorBoundary(ErrorComponent: ReservedComponent, ReactLib?: ReactLike): typeof BundledReact.Component<ErrorBoundaryProps, ErrorBoundaryState>;
24
- export declare function tryLoadReservedInDirs(dirs: string[], which: keyof typeof RESERVED_COMPONENTS, projectDir: string, _mode: "development" | "production", adapter: RuntimeAdapter, projectId?: string, contentSourceId?: string, reactVersion?: string): Promise<ReservedComponent | null>;
24
+ /**
25
+ * Like {@link tryLoadReservedInDirs}, but also returns the absolute source path
26
+ * of the file that was loaded — the client hydration bundle needs the path (in
27
+ * the same absolute form as `appPath`) to load the same component in the browser.
28
+ */
29
+ export declare function loadReservedWithPath(dirs: string[], which: keyof typeof RESERVED_COMPONENTS, projectDir: string, _mode: "development" | "production", adapter: RuntimeAdapter, projectId?: string, contentSourceId?: string, reactVersion?: string): Promise<{
30
+ component: ReservedComponent;
31
+ filePath: string;
32
+ } | null>;
33
+ export declare function tryLoadReservedInDirs(dirs: string[], which: keyof typeof RESERVED_COMPONENTS, projectDir: string, mode: "development" | "production", adapter: RuntimeAdapter, projectId?: string, contentSourceId?: string, reactVersion?: string): Promise<ReservedComponent | null>;
25
34
  export {};
26
35
  //# sourceMappingURL=app-reserved.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-reserved.d.ts","sourceRoot":"","sources":["../../../src/src/rendering/app-reserved.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,OAAO,CAAC;AAGtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,KAAK,iBAAiB,GAAG,YAAY,CAAC,aAAa,CAAC;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC,CAAC;AAE3F,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBpF;AAED,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC;CACnC;AAED,KAAK,SAAS,GAAG;IACf,aAAa,EAAE,OAAO,YAAY,CAAC,aAAa,CAAC;CAClD,CAAC;AAEF,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,iBAAiB,EACjC,QAAQ,GAAE,SAAwB,GACjC,OAAO,YAAY,CAAC,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAyBvE;AAED,wBAAsB,qBAAqB,CACzC,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ACd,KAAK,EAAE,MAAM,OAAO,mBAAmB,EACvC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,aAAa,GAAG,YAAY,EACnC,OAAO,EAAE,cAAc,EACvB,SAAS,CAAC,EAAE,MAAM,EAClB,eAAe,CAAC,EAAE,MAAM,EACxB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC;IAAE,SAAS,EAAE,iBAAiB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CA4BpE;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,OAAO,mBAAmB,EACvC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,aAAa,GAAG,YAAY,EAClC,OAAO,EAAE,cAAc,EACvB,SAAS,CAAC,EAAE,MAAM,EAClB,eAAe,CAAC,EAAE,MAAM,EACxB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAYnC"}
@@ -42,7 +42,12 @@ export function createErrorBoundary(ErrorComponent, ReactLib = BundledReact) {
42
42
  }
43
43
  };
44
44
  }
45
- export async function tryLoadReservedInDirs(dirs, which, projectDir, _mode, adapter, projectId, contentSourceId, reactVersion) {
45
+ /**
46
+ * Like {@link tryLoadReservedInDirs}, but also returns the absolute source path
47
+ * of the file that was loaded — the client hydration bundle needs the path (in
48
+ * the same absolute form as `appPath`) to load the same component in the browser.
49
+ */
50
+ export async function loadReservedWithPath(dirs, which, projectDir, _mode, adapter, projectId, contentSourceId, reactVersion) {
46
51
  const join = (a, b) => `${a.replace(/\/$/, "")}/${b.replace(/^\//, "")}`;
47
52
  const candidateName = RESERVED_COMPONENTS[which];
48
53
  const { loadComponentFromSource } = await import("../modules/react-loader/component-loader.js");
@@ -57,8 +62,9 @@ export async function tryLoadReservedInDirs(dirs, which, projectDir, _mode, adap
57
62
  contentSourceId,
58
63
  reactVersion,
59
64
  });
60
- if (typeof Cmp === "function")
61
- return Cmp;
65
+ if (typeof Cmp === "function") {
66
+ return { component: Cmp, filePath: file };
67
+ }
62
68
  }
63
69
  catch (_) {
64
70
  /* expected: component not found in this path, continue to next */
@@ -67,3 +73,7 @@ export async function tryLoadReservedInDirs(dirs, which, projectDir, _mode, adap
67
73
  }
68
74
  return null;
69
75
  }
76
+ export async function tryLoadReservedInDirs(dirs, which, projectDir, mode, adapter, projectId, contentSourceId, reactVersion) {
77
+ const loaded = await loadReservedWithPath(dirs, which, projectDir, mode, adapter, projectId, contentSourceId, reactVersion);
78
+ return loaded?.component ?? null;
79
+ }
@@ -20,6 +20,8 @@ export interface LayoutApplicationOptions {
20
20
  requestUrl?: URL;
21
21
  params?: Record<string, string | string[]>;
22
22
  frontmatter?: Record<string, unknown>;
23
+ /** Props from the page's `getServerData`, exposed on the page context as `data`. */
24
+ pageProps?: Record<string, unknown>;
23
25
  headings?: Array<{
24
26
  id: string;
25
27
  text: string;
@@ -37,6 +39,7 @@ export declare class LayoutApplicator {
37
39
  private requestUrl?;
38
40
  private params?;
39
41
  private frontmatter?;
42
+ private pageProps?;
40
43
  private headings?;
41
44
  private projectId;
42
45
  private projectSlug;
@@ -1 +1 @@
1
- {"version":3,"file":"layout-applicator.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/layouts/layout-applicator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,YAAY,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAKzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,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AAC,CAAqD;IACtE,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,kBAAkB,CAAC,CAAyB;IACpD,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAS;IACjD,OAAO,CAAC,mBAAmB,CAAgC;IAC3D,OAAO,CAAC,+BAA+B,CAAC,CAGrC;gBAES,OAAO,EAAE,wBAAwB;IAmB7C,OAAO,CAAC,eAAe;IAOjB,YAAY,CAChB,WAAW,EAAE,YAAY,CAAC,YAAY,EACtC,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,SAAS,GAAG,SAAS,EACnC,aAAa,EAAE,UAAU,EAAE,EAC3B,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACpD,gBAAgB,CAAC,EAAE;QAAE,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,GAC1D,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC;YA2HvB,gBAAgB;YA0DhB,sBAAsB;YAWtB,8BAA8B;YA6D9B,oBAAoB;YAsDpB,mBAAmB;YAwCnB,0BAA0B;CAsEzC"}
@@ -26,6 +26,7 @@ export class LayoutApplicator {
26
26
  requestUrl;
27
27
  params;
28
28
  frontmatter;
29
+ pageProps;
29
30
  headings;
30
31
  projectId;
31
32
  projectSlug;
@@ -48,6 +49,7 @@ export class LayoutApplicator {
48
49
  this.requestUrl = options.requestUrl;
49
50
  this.params = options.params;
50
51
  this.frontmatter = options.frontmatter;
52
+ this.pageProps = options.pageProps;
51
53
  this.headings = options.headings;
52
54
  this.configuredReactVersion = options.reactVersion;
53
55
  }
@@ -99,6 +101,7 @@ export class LayoutApplicator {
99
101
  params: flatParams,
100
102
  query,
101
103
  frontmatter: this.frontmatter ?? pageInfo.entity.frontmatter ?? {},
104
+ data: this.pageProps ?? {},
102
105
  headings: headingsArray,
103
106
  mdxHeadings: headingsArray,
104
107
  };
@@ -11,6 +11,21 @@ export declare class HTMLGenerator {
11
11
  private wrapHTMLFragment;
12
12
  private generateShellParts;
13
13
  private resolveAppPath;
14
+ /**
15
+ * Resolve + load the nearest app-router `error.tsx` for the route's segment and
16
+ * build a ready-to-render element with the caught error. Returns the element
17
+ * (for the SSR error render) and the boundary's absolute source path (embedded
18
+ * as `errorPath` so the client hydration bundle wraps the same boundary and it
19
+ * hydrates). Null when the project has no matching `error.tsx`.
20
+ */
21
+ resolveErrorComponent(context: HTMLGenerationContext, error: Error): Promise<{
22
+ element: unknown;
23
+ path: string;
24
+ } | null>;
25
+ resolveErrorComponentPath(context: HTMLGenerationContext): Promise<{
26
+ component: unknown;
27
+ path: string;
28
+ } | null>;
14
29
  private loadProjectFile;
15
30
  private buildHTMLOptions;
16
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/orchestrator/html.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAClF,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAmIlF,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAsB;gBAExB,MAAM,EAAE,mBAAmB;IAIjC,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBjE,kBAAkB,CACtB,WAAW,EAAE,cAAc,EAC3B,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAC3C,OAAO,CAAC,cAAc,CAAC;YAkEZ,sBAAsB;YA6DtB,4BAA4B;YAiB5B,wBAAwB;YAmBxB,gBAAgB;YAyBhB,kBAAkB;IAwDhC,OAAO,CAAC,cAAc;YAQR,eAAe;YAkBf,gBAAgB;IA6G9B;;;;OAIG;YACW,gBAAgB;CAc/B"}
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/orchestrator/html.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAClF,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAmIlF,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAsB;gBAExB,MAAM,EAAE,mBAAmB;IAIjC,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBjE,kBAAkB,CACtB,WAAW,EAAE,cAAc,EAC3B,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAC3C,OAAO,CAAC,cAAc,CAAC;YAkEZ,sBAAsB;YA6DtB,4BAA4B;YAiB5B,wBAAwB;YAmBxB,gBAAgB;YAyBhB,kBAAkB;IAwDhC,OAAO,CAAC,cAAc;IAQtB;;;;;;OAMG;IACG,qBAAqB,CACzB,OAAO,EAAE,qBAAqB,EAC9B,KAAK,EAAE,KAAK,GACX,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAwB/C,yBAAyB,CAC7B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;YAqDzC,eAAe;YAkBf,gBAAgB;IA+G9B;;;;OAIG;YACW,gBAAgB;CAc/B"}
@@ -1,4 +1,4 @@
1
- import { join } from "../../platform/compat/path/index.js";
1
+ import { dirname, join } from "../../platform/compat/path/index.js";
2
2
  import { getExtensionName } from "../../utils/path-utils.js";
3
3
  import { buildImportMapJson, extractHTMLMetadata, generateHTMLShellParts, injectHTMLContent, isFullHTMLDocument, } from "../../html/index.js";
4
4
  import { buildNonceAttribute } from "../../html/html-escape.js";
@@ -10,6 +10,7 @@ import { extractRelativePath } from "../../utils/route-path-utils.js";
10
10
  import { hasUseClientDirective } from "../rsc/page-island.js";
11
11
  import { getReadyManifestForRenderAsync } from "../../release-assets/manifest-cache.js";
12
12
  import { resolveAppComponentPath } from "../layouts/utils/app-resolver.js";
13
+ import { resolveProjectReactVersion } from "../../transforms/esm/package-registry.js";
13
14
  import { StreamTimeoutError, streamToString } from "../utils/stream-utils.js";
14
15
  import { profilePhase, profileSyncPhase } from "../../observability/index.js";
15
16
  import { extractProjectClassesForRoute, startPreparedCSSWarmup, startProjectCSSPreparation, } from "./html-project-css.js";
@@ -285,6 +286,67 @@ export class HTMLGenerator {
285
286
  resolveAppPath() {
286
287
  return resolveAppComponentPath(this.config.projectDir, this.config.adapter, this.config.config);
287
288
  }
289
+ /**
290
+ * Resolve + load the nearest app-router `error.tsx` for the route's segment and
291
+ * build a ready-to-render element with the caught error. Returns the element
292
+ * (for the SSR error render) and the boundary's absolute source path (embedded
293
+ * as `errorPath` so the client hydration bundle wraps the same boundary and it
294
+ * hydrates). Null when the project has no matching `error.tsx`.
295
+ */
296
+ async resolveErrorComponent(context, error) {
297
+ const loaded = await this.resolveErrorComponentPath(context);
298
+ if (!loaded)
299
+ return null;
300
+ try {
301
+ const reactVersion = await resolveProjectReactVersion({
302
+ projectDir: this.config.projectDir,
303
+ config: this.config.config,
304
+ });
305
+ const { getProjectReact } = await import("../../react/compat/ssr-adapter/index.js");
306
+ const React = await getProjectReact(reactVersion);
307
+ const createElement = React.createElement;
308
+ const element = createElement(loaded.component, { error, reset: () => { } });
309
+ return { element, path: loaded.path };
310
+ }
311
+ catch (_) {
312
+ return null;
313
+ }
314
+ }
315
+ async resolveErrorComponentPath(context) {
316
+ try {
317
+ const appRoot = join(this.config.projectDir, this.config.config?.directories?.app ?? "app");
318
+ try {
319
+ const st = await this.config.adapter.fs.stat(appRoot);
320
+ if (!st.isDirectory)
321
+ return null;
322
+ }
323
+ catch (_) {
324
+ return null; // no app directory
325
+ }
326
+ const { collectAncestorDirs, loadReservedWithPath } = await import("../app-reserved.js");
327
+ const matchedPath = context.pageInfo?.entity?.path;
328
+ const absolutePagePath = matchedPath
329
+ ? matchedPath.startsWith(this.config.projectDir)
330
+ ? matchedPath
331
+ : join(this.config.projectDir, matchedPath)
332
+ : appRoot;
333
+ const segmentDir = matchedPath ? dirname(absolutePagePath) : appRoot;
334
+ const dirs = await collectAncestorDirs(segmentDir, appRoot);
335
+ const reactVersion = await resolveProjectReactVersion({
336
+ projectDir: this.config.projectDir,
337
+ config: this.config.config,
338
+ });
339
+ const { computeContentSourceId } = await import("../../cache/keys.js");
340
+ const contentSourceId = computeContentSourceId(this.config.isLocalProject === true, context.options?.environment ?? "preview", null, context.options?.releaseId);
341
+ const loaded = await loadReservedWithPath(dirs, "error", this.config.projectDir, this.config.mode, this.config.adapter, context.options?.projectId, contentSourceId, reactVersion);
342
+ if (!loaded)
343
+ return null;
344
+ return { component: loaded.component, path: loaded.filePath };
345
+ }
346
+ catch (_) {
347
+ return null; // error.tsx resolution is best-effort
348
+ }
349
+ }
288
350
  async loadProjectFile(filename) {
289
351
  try {
290
352
  const filePath = join(this.config.projectDir, filename);
@@ -342,6 +404,9 @@ export class HTMLGenerator {
342
404
  componentPath: l.componentPath,
343
405
  })),
344
406
  appPath: context.options?.clientPageIsland ? undefined : appComponentPath,
407
+ // Set on the SSR error path so the client hydration bundle wraps the page
408
+ // in the same app-router error boundary that rendered error.tsx on the server.
409
+ errorPath: context.options?.errorPath,
345
410
  isolatedClientPage: context.options?.clientPageIsland ? true : undefined,
346
411
  layoutProps: hydrationLayoutProps,
347
412
  pagePath,
@@ -57,7 +57,7 @@ export declare class LayoutOrchestrator {
57
57
  level: number;
58
58
  }>, projectSlug?: string, clientPageIsland?: {
59
59
  clientLayoutPaths: readonly string[];
60
- }): Promise<React.ReactElement>;
60
+ }, pageProps?: Record<string, unknown>): Promise<React.ReactElement>;
61
61
  }
62
62
  export {};
63
63
  //# sourceMappingURL=layout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/orchestrator/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAGzE,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAUjF,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,EAAE,aAAa,GAAG,YAAY,CAAC;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,eAAe,CAAC;IACjC,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,oBAAoB,CAAC;IAClC,iBAAiB,EAAE,aAAa,CAAC;CAClC;AAED,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,SAAS,GAAG,SAAS,CAAC;IACpC,aAAa,EAAE,UAAU,EAAE,CAAC;CAC7B;AASD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,KAAK,CAAC;QAAE,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AC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAC1C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,EAC7D,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE;QAAE,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,EAC3D,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC;CAuD/B"}
@@ -159,7 +159,7 @@ export class LayoutOrchestrator {
159
159
  "layout.mdxCount": nestedLayouts.filter((l) => l.kind === "mdx").length,
160
160
  });
161
161
  }
162
- applyLayoutsAndWrappers(pageElement, pageInfo, layoutBundle, nestedLayouts, layoutDataMap, requestUrl, params, frontmatter, headings, projectSlug, clientPageIsland) {
162
+ applyLayoutsAndWrappers(pageElement, pageInfo, layoutBundle, nestedLayouts, layoutDataMap, requestUrl, params, frontmatter, headings, projectSlug, clientPageIsland, pageProps) {
163
163
  return withSpan("layout.applyLayoutsAndWrappers", async () => {
164
164
  const reactVersion = await this.getReactVersion();
165
165
  const mergedComponents = {
@@ -181,6 +181,7 @@ export class LayoutOrchestrator {
181
181
  requestUrl,
182
182
  params,
183
183
  frontmatter,
184
+ pageProps,
184
185
  headings,
185
186
  reactVersion,
186
187
  });
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/orchestrator/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,iCAAiC,CAAC;AASzC,OAAO,KAAK,EAAE,cAAc,EAAE,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