@riverbankcms/sdk 0.4.1 → 0.4.3
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/README.md +73 -0
- package/dist/cli/index.js +46 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/client/client.d.mts +3 -3
- package/dist/client/client.d.ts +3 -3
- package/dist/client/client.js +90 -170
- package/dist/client/client.js.map +1 -1
- package/dist/client/client.mjs +90 -170
- package/dist/client/client.mjs.map +1 -1
- package/dist/client/hooks.d.mts +3 -3
- package/dist/client/hooks.d.ts +3 -3
- package/dist/client/rendering/client.d.mts +1 -1
- package/dist/client/rendering/client.d.ts +1 -1
- package/dist/client/rendering/client.js +84 -142
- package/dist/client/rendering/client.js.map +1 -1
- package/dist/client/rendering/client.mjs +84 -142
- package/dist/client/rendering/client.mjs.map +1 -1
- package/dist/client/resolver-CYyfzTQ9.d.mts +61 -0
- package/dist/client/resolver-CYyfzTQ9.d.ts +61 -0
- package/dist/client/usePage--fGlyrgj.d.mts +6439 -0
- package/dist/client/usePage-BC8Q2E3t.d.mts +6431 -0
- package/dist/client/usePage-CE7X5NcN.d.ts +6439 -0
- package/dist/client/usePage-CHEybPMD.d.ts +6429 -0
- package/dist/client/usePage-D4fxZbRR.d.mts +6429 -0
- package/dist/client/usePage-DpRNZUtP.d.ts +6431 -0
- package/dist/server/{Layout-CHG77dhK.d.ts → Layout-CXI_VkhN.d.ts} +1 -1
- package/dist/server/{Layout-B_zUr9ci.d.mts → Layout-p6f3TLw9.d.mts} +1 -1
- package/dist/server/{chunk-XK2YIISA.mjs → chunk-24F6FTCI.mjs} +2 -2
- package/dist/server/{chunk-BUCJWG6G.js → chunk-2SSEBAHC.js} +5 -5
- package/dist/server/{chunk-BUCJWG6G.js.map → chunk-2SSEBAHC.js.map} +1 -1
- package/dist/server/{chunk-ZIM53VP6.js → chunk-6JBKKV3G.js} +27 -4
- package/dist/server/chunk-6JBKKV3G.js.map +1 -0
- package/dist/server/{chunk-ZEAJW6T3.mjs → chunk-ES6QDZUX.mjs} +3 -2
- package/dist/server/chunk-ES6QDZUX.mjs.map +1 -0
- package/dist/server/{chunk-SWPHIUVE.js → chunk-G35R7N7B.js} +3 -2
- package/dist/server/chunk-G35R7N7B.js.map +1 -0
- package/dist/server/{chunk-BOHTTHY5.mjs → chunk-I6K5REFT.mjs} +27 -4
- package/dist/server/chunk-I6K5REFT.mjs.map +1 -0
- package/dist/server/{chunk-SFQ7VF3G.mjs → chunk-LCYGQDAB.mjs} +10 -6
- package/dist/server/chunk-LCYGQDAB.mjs.map +1 -0
- package/dist/server/{chunk-P6CDRJN3.js → chunk-TNYU5EIO.js} +16 -12
- package/dist/server/chunk-TNYU5EIO.js.map +1 -0
- package/dist/server/{chunk-NKXS4TBK.mjs → chunk-U2NI3TS3.mjs} +87 -169
- package/dist/server/chunk-U2NI3TS3.mjs.map +1 -0
- package/dist/server/{chunk-IT5ICP43.js → chunk-VHDDXCK6.js} +94 -176
- package/dist/server/chunk-VHDDXCK6.js.map +1 -0
- package/dist/server/{components-Bo3LPpVb.d.mts → components-C75e4poV.d.mts} +20 -12
- package/dist/server/{components-ClFs4PUa.d.ts → components-Dhiemsjd.d.ts} +20 -12
- package/dist/server/components.d.mts +5 -5
- package/dist/server/components.d.ts +5 -5
- package/dist/server/components.js +3 -3
- package/dist/server/components.mjs +2 -2
- package/dist/server/config-validation.d.mts +2 -2
- package/dist/server/config-validation.d.ts +2 -2
- package/dist/server/config-validation.js +3 -3
- package/dist/server/config-validation.mjs +2 -2
- package/dist/server/config.d.mts +3 -3
- package/dist/server/config.d.ts +3 -3
- package/dist/server/config.js +3 -3
- package/dist/server/config.mjs +2 -2
- package/dist/server/data.d.mts +2 -2
- package/dist/server/data.d.ts +2 -2
- package/dist/server/{index-Dj7VKH34.d.mts → index-C6o9LPvq.d.mts} +1 -1
- package/dist/server/{index-DbSfrRA0.d.ts → index-CAwBj3-A.d.ts} +1 -1
- package/dist/server/index.d.mts +4 -4
- package/dist/server/index.d.ts +4 -4
- package/dist/server/{loadContent-C_FipaAC.d.mts → loadContent-CdXfuCuE.d.mts} +3 -3
- package/dist/server/{loadContent-C2SwqmXy.d.ts → loadContent-CsvQRoxb.d.ts} +3 -3
- package/dist/server/{loadPage-naVvoua8.d.ts → loadPage-BA0HiT-6.d.ts} +72 -28
- package/dist/server/{loadPage-DUHBXDEW.js → loadPage-DLC7DJZP.js} +3 -3
- package/dist/server/{loadPage-DUHBXDEW.js.map → loadPage-DLC7DJZP.js.map} +1 -1
- package/dist/server/{loadPage-LYVKY3WZ.mjs → loadPage-GEGN4UAL.mjs} +2 -2
- package/dist/server/{loadPage-mavT3Jae.d.mts → loadPage-p3AWwwrd.d.mts} +72 -28
- package/dist/server/metadata.d.mts +3 -3
- package/dist/server/metadata.d.ts +3 -3
- package/dist/server/navigation.d.mts +2 -2
- package/dist/server/navigation.d.ts +2 -2
- package/dist/server/rendering/server.d.mts +4 -4
- package/dist/server/rendering/server.d.ts +4 -4
- package/dist/server/rendering/server.js +4 -4
- package/dist/server/rendering/server.mjs +3 -3
- package/dist/server/rendering.d.mts +7 -7
- package/dist/server/rendering.d.ts +7 -7
- package/dist/server/rendering.js +5 -5
- package/dist/server/rendering.mjs +4 -4
- package/dist/server/routing.d.mts +78 -5
- package/dist/server/routing.d.ts +78 -5
- package/dist/server/routing.js +57 -3
- package/dist/server/routing.js.map +1 -1
- package/dist/server/routing.mjs +55 -1
- package/dist/server/routing.mjs.map +1 -1
- package/dist/server/server.d.mts +5 -5
- package/dist/server/server.d.ts +5 -5
- package/dist/server/server.js +2 -2
- package/dist/server/server.mjs +1 -1
- package/dist/server/theme-bridge.js +7 -7
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/{types-BA-J9K8r.d.mts → types-BLf-hE50.d.mts} +19 -6
- package/dist/server/{types-5XdVD2J1.d.ts → types-BWQ-TohG.d.ts} +19 -6
- package/dist/server/{types-CMqVHYLG.d.ts → types-CL916r6x.d.ts} +23 -1
- package/dist/server/{types-BC9eB2KH.d.mts → types-CdhKJrB0.d.mts} +1 -1
- package/dist/server/{types-CAnC529E.d.ts → types-Dj8B3QRb.d.ts} +1 -1
- package/dist/server/{types-CYfHxUhe.d.mts → types-txWsSxN7.d.mts} +23 -1
- package/dist/server/{validation-C7W2Fe0i.d.ts → validation-CoU8uAiu.d.ts} +1 -1
- package/dist/server/{validation-hg1sqhrt.d.mts → validation-DzvDwwRo.d.mts} +1 -1
- package/package.json +3 -3
- package/dist/server/chunk-BOHTTHY5.mjs.map +0 -1
- package/dist/server/chunk-IT5ICP43.js.map +0 -1
- package/dist/server/chunk-NKXS4TBK.mjs.map +0 -1
- package/dist/server/chunk-P6CDRJN3.js.map +0 -1
- package/dist/server/chunk-SFQ7VF3G.mjs.map +0 -1
- package/dist/server/chunk-SWPHIUVE.js.map +0 -1
- package/dist/server/chunk-ZEAJW6T3.mjs.map +0 -1
- package/dist/server/chunk-ZIM53VP6.js.map +0 -1
- /package/dist/server/{chunk-XK2YIISA.mjs.map → chunk-24F6FTCI.mjs.map} +0 -0
- /package/dist/server/{loadPage-LYVKY3WZ.mjs.map → loadPage-GEGN4UAL.mjs.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { R as RiverbankClient, S as SiteResponse } from './types-
|
|
1
|
+
import { R as RiverbankClient, S as SiteResponse } from './types-CdhKJrB0.mjs';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
|
-
import React__default
|
|
4
|
+
import React__default from 'react';
|
|
5
5
|
import { P as PageOutline, S as SdkCustomBlock } from './schema-Bpy9N5ZI.mjs';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import { T as Theme } from './types-
|
|
7
|
+
import { T as Theme } from './types-BLf-hE50.mjs';
|
|
8
8
|
import { R as ResolvedBlockData, D as DataLoaderOverrides } from './types-CbagRQ_7.mjs';
|
|
9
9
|
|
|
10
10
|
declare const colorTokens: readonly ["background/base", "background/elevated", "surface/base", "surface/subtle", "surface/inverted", "content/primary", "content/secondary", "accent/primary", "accent/secondary", "border/base"];
|
|
@@ -64,22 +64,6 @@ type ResolverContext = {
|
|
|
64
64
|
fragmentRegistry?: Record<string, any>;
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
type SystemBlockComponentProps<TContent = Record<string, unknown>> = {
|
|
68
|
-
content: TContent;
|
|
69
|
-
theme?: ThemeTokens;
|
|
70
|
-
themeConfig?: Theme;
|
|
71
|
-
registry?: ResolverContext["registry"];
|
|
72
|
-
transforms?: TransformRegistry;
|
|
73
|
-
viewModelOverrides?: Record<string, unknown>;
|
|
74
|
-
data?: Record<string, unknown>;
|
|
75
|
-
pathBase?: string;
|
|
76
|
-
blockId?: string | null;
|
|
77
|
-
blockKind?: string;
|
|
78
|
-
blockBindings?: Record<string, unknown>;
|
|
79
|
-
fragmentRegistry?: ResolverContext["fragmentRegistry"];
|
|
80
|
-
};
|
|
81
|
-
type SystemBlockComponent<TContent = Record<string, unknown>> = ComponentType<SystemBlockComponentProps<TContent>>;
|
|
82
|
-
|
|
83
67
|
/**
|
|
84
68
|
* Occurrence context for event pages.
|
|
85
69
|
* Passed through to blocks that need occurrence information (e.g., event-registration).
|
|
@@ -100,16 +84,66 @@ type PageRendererDataContext = {
|
|
|
100
84
|
routes?: RouteMap;
|
|
101
85
|
occurrenceContext?: OccurrenceContextData | null;
|
|
102
86
|
contentEntry?: Record<string, unknown> | null;
|
|
87
|
+
supabaseUrl?: string;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Props passed to block override components.
|
|
91
|
+
*
|
|
92
|
+
* These props are RSC-safe (no functions) so overrides can be Client Components.
|
|
93
|
+
* Unlike internal SDK block components, overrides don't receive `registry` or
|
|
94
|
+
* `fragmentRegistry` which contain function references that can't cross the
|
|
95
|
+
* RSC serialization boundary.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```tsx
|
|
99
|
+
* 'use client';
|
|
100
|
+
*
|
|
101
|
+
* import type { BlockOverrideProps, HeroContent } from '@riverbankcms/sdk/rendering';
|
|
102
|
+
*
|
|
103
|
+
* export function CustomHero({ content, theme, data }: BlockOverrideProps<HeroContent>) {
|
|
104
|
+
* const [expanded, setExpanded] = useState(false);
|
|
105
|
+
* return <div>...</div>;
|
|
106
|
+
* }
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
type BlockOverrideProps<TContent = Record<string, unknown>> = {
|
|
110
|
+
/** Block content data */
|
|
111
|
+
content: TContent;
|
|
112
|
+
/** Theme tokens for styling */
|
|
113
|
+
theme?: ThemeTokens;
|
|
114
|
+
/** Full theme configuration */
|
|
115
|
+
themeConfig?: Theme;
|
|
116
|
+
/** Pre-fetched data from data loaders */
|
|
117
|
+
data?: Record<string, unknown>;
|
|
118
|
+
/** Block instance ID (null for unsaved blocks) */
|
|
119
|
+
blockId: string | null;
|
|
120
|
+
/** Block kind identifier (e.g., "block.hero" or "custom.my-block") */
|
|
121
|
+
blockKind: string;
|
|
103
122
|
};
|
|
104
123
|
/**
|
|
105
124
|
* Block override component type.
|
|
106
|
-
* Override components receive the same props as default block components.
|
|
107
125
|
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
126
|
+
* Override components can be either Server Components or Client Components.
|
|
127
|
+
* They receive only serializable props (no functions) to support RSC boundaries.
|
|
128
|
+
*
|
|
129
|
+
* @example Server Component override
|
|
130
|
+
* ```tsx
|
|
131
|
+
* export function CustomHero({ content, theme, data }: BlockOverrideProps<HeroContent>) {
|
|
132
|
+
* return <div className="custom-hero">...</div>;
|
|
133
|
+
* }
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* @example Client Component override
|
|
137
|
+
* ```tsx
|
|
138
|
+
* 'use client';
|
|
139
|
+
*
|
|
140
|
+
* export function CustomHero({ content, theme, data }: BlockOverrideProps<HeroContent>) {
|
|
141
|
+
* const [state, setState] = useState(null);
|
|
142
|
+
* return <div className="custom-hero">...</div>;
|
|
143
|
+
* }
|
|
144
|
+
* ```
|
|
111
145
|
*/
|
|
112
|
-
type BlockOverrideComponent =
|
|
146
|
+
type BlockOverrideComponent = React$1.ComponentType<BlockOverrideProps<any>>;
|
|
113
147
|
/**
|
|
114
148
|
* Map of block kinds to custom override components.
|
|
115
149
|
* Keys can be either:
|
|
@@ -119,8 +153,8 @@ type BlockOverrideComponent = SystemBlockComponent<any>;
|
|
|
119
153
|
* @example
|
|
120
154
|
* ```tsx
|
|
121
155
|
* const overrides: BlockOverrides = {
|
|
122
|
-
* 'hero': CustomHero, // CustomHero
|
|
123
|
-
* 'bodyText': CustomBodyText, // CustomBodyText
|
|
156
|
+
* 'hero': CustomHero, // CustomHero uses BlockOverrideProps<HeroContent>
|
|
157
|
+
* 'bodyText': CustomBodyText, // CustomBodyText uses BlockOverrideProps<BodyTextContent>
|
|
124
158
|
* };
|
|
125
159
|
* ```
|
|
126
160
|
*/
|
|
@@ -159,6 +193,11 @@ type PageProps = {
|
|
|
159
193
|
* allowing blocks to use SDK-defined color tokens for section backgrounds.
|
|
160
194
|
*/
|
|
161
195
|
sdkConfig?: RuntimeSdkConfig | null;
|
|
196
|
+
/**
|
|
197
|
+
* Supabase storage URL for direct image access.
|
|
198
|
+
* SDK sites receive this from the API instead of requiring NEXT_PUBLIC_SUPABASE_URL env var.
|
|
199
|
+
*/
|
|
200
|
+
supabaseUrl?: string;
|
|
162
201
|
/**
|
|
163
202
|
* Additional context data for content entry pages.
|
|
164
203
|
* Used to pass occurrence context and content entry data to blocks.
|
|
@@ -235,7 +274,7 @@ type PageProps = {
|
|
|
235
274
|
* }
|
|
236
275
|
* ```
|
|
237
276
|
*/
|
|
238
|
-
declare function Page({ page, theme, themeTokens: providedTokens, siteId, resolvedData, routeMap, wrapBlock, registry, usePlaceholders, blockOverrides, sdkConfig, dataContext, }: PageProps): react_jsx_runtime.JSX.Element;
|
|
277
|
+
declare function Page({ page, theme, themeTokens: providedTokens, siteId, resolvedData, routeMap, wrapBlock, registry, usePlaceholders, blockOverrides, sdkConfig, supabaseUrl, dataContext, }: PageProps): react_jsx_runtime.JSX.Element;
|
|
239
278
|
|
|
240
279
|
/**
|
|
241
280
|
* Server-side helper to fetch all data needed for <Page> component.
|
|
@@ -314,6 +353,11 @@ type LoadPageResult = Omit<PageProps, 'registry' | 'wrapBlock' | 'usePlaceholder
|
|
|
314
353
|
* Contains SDK-defined theme palette, section backgrounds, and style options.
|
|
315
354
|
*/
|
|
316
355
|
sdkConfig: RuntimeSdkConfig | null;
|
|
356
|
+
/**
|
|
357
|
+
* Supabase storage URL for direct image access.
|
|
358
|
+
* SDK sites use this instead of NEXT_PUBLIC_SUPABASE_URL env var.
|
|
359
|
+
*/
|
|
360
|
+
supabaseUrl?: string;
|
|
317
361
|
};
|
|
318
362
|
/**
|
|
319
363
|
* Server-side helper to fetch all data needed for <Page> component.
|
|
@@ -374,4 +418,4 @@ type LoadPageResult = Omit<PageProps, 'registry' | 'wrapBlock' | 'usePlaceholder
|
|
|
374
418
|
*/
|
|
375
419
|
declare function loadPage(params: LoadPageParams): Promise<LoadPageResult>;
|
|
376
420
|
|
|
377
|
-
export { type BlockOverrides as B, type LoadPageParams as L, type PageProps as P, type RuntimeSdkConfig as R, type
|
|
421
|
+
export { type BlockOverrides as B, type LoadPageParams as L, type PageProps as P, type RuntimeSdkConfig as R, type ThemeTokens as T, type LoadPageResult as a, Page as b, PageRenderer as c, type RouteMap as d, type BlockOverrideComponent as e, type BlockOverrideProps as f, type ResolverContext as g, type TransformRegistry as h, loadPage as l };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as LoadPageResult } from './loadPage-
|
|
2
|
-
import { S as SiteResponse } from './types-
|
|
1
|
+
import { a as LoadPageResult } from './loadPage-p3AWwwrd.mjs';
|
|
2
|
+
import { S as SiteResponse } from './types-CdhKJrB0.mjs';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
|
5
5
|
import './schema-Bpy9N5ZI.mjs';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import './types-
|
|
7
|
+
import './types-BLf-hE50.mjs';
|
|
8
8
|
import '@riverbankcms/ai';
|
|
9
9
|
import '@riverbankcms/media-storage-supabase';
|
|
10
10
|
import '@riverbankcms/db';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as LoadPageResult } from './loadPage-
|
|
2
|
-
import { S as SiteResponse } from './types-
|
|
1
|
+
import { a as LoadPageResult } from './loadPage-BA0HiT-6.js';
|
|
2
|
+
import { S as SiteResponse } from './types-Dj8B3QRb.js';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
|
5
5
|
import './schema-Bpy9N5ZI.js';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import './types-
|
|
7
|
+
import './types-BWQ-TohG.js';
|
|
8
8
|
import '@riverbankcms/ai';
|
|
9
9
|
import '@riverbankcms/media-storage-supabase';
|
|
10
10
|
import '@riverbankcms/db';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NavigationMenuWithItems } from './types-
|
|
2
|
-
export { L as LinkPayload, a as NavigationItemRecord } from './types-
|
|
1
|
+
import { N as NavigationMenuWithItems } from './types-BLf-hE50.mjs';
|
|
2
|
+
export { L as LinkPayload, a as NavigationItemRecord } from './types-BLf-hE50.mjs';
|
|
3
3
|
import '@riverbankcms/ai';
|
|
4
4
|
import './schema-Bpy9N5ZI.mjs';
|
|
5
5
|
import 'zod';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NavigationMenuWithItems } from './types-
|
|
2
|
-
export { L as LinkPayload, a as NavigationItemRecord } from './types-
|
|
1
|
+
import { N as NavigationMenuWithItems } from './types-BWQ-TohG.js';
|
|
2
|
+
export { L as LinkPayload, a as NavigationItemRecord } from './types-BWQ-TohG.js';
|
|
3
3
|
import '@riverbankcms/ai';
|
|
4
4
|
import './schema-Bpy9N5ZI.js';
|
|
5
5
|
import 'zod';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { b as Page, P as PageProps } from '../loadPage-
|
|
2
|
-
export { H as HeaderData, L as Layout, a as LayoutProps } from '../Layout-
|
|
1
|
+
export { b as Page, P as PageProps } from '../loadPage-p3AWwwrd.mjs';
|
|
2
|
+
export { H as HeaderData, L as Layout, a as LayoutProps } from '../Layout-p6f3TLw9.mjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { T as Theme } from '../types-
|
|
5
|
+
import { T as Theme } from '../types-BLf-hE50.mjs';
|
|
6
6
|
import '../schema-Bpy9N5ZI.mjs';
|
|
7
|
-
import { R as RiverbankClient } from '../types-
|
|
7
|
+
import { R as RiverbankClient } from '../types-CdhKJrB0.mjs';
|
|
8
8
|
import { B as BlockKind } from '../blockKinds-B6MWzNWp.mjs';
|
|
9
9
|
import 'zod';
|
|
10
10
|
import '../types-CbagRQ_7.mjs';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { b as Page, P as PageProps } from '../loadPage-
|
|
2
|
-
export { H as HeaderData, L as Layout, a as LayoutProps } from '../Layout-
|
|
1
|
+
export { b as Page, P as PageProps } from '../loadPage-BA0HiT-6.js';
|
|
2
|
+
export { H as HeaderData, L as Layout, a as LayoutProps } from '../Layout-CXI_VkhN.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { T as Theme } from '../types-
|
|
5
|
+
import { T as Theme } from '../types-BWQ-TohG.js';
|
|
6
6
|
import '../schema-Bpy9N5ZI.js';
|
|
7
|
-
import { R as RiverbankClient } from '../types-
|
|
7
|
+
import { R as RiverbankClient } from '../types-Dj8B3QRb.js';
|
|
8
8
|
import { B as BlockKind } from '../blockKinds-B6MWzNWp.js';
|
|
9
9
|
import 'zod';
|
|
10
10
|
import '../types-DuQCNVV0.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk2SSEBAHCjs = require('../chunk-2SSEBAHC.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('../chunk-
|
|
7
|
+
var _chunkTNYU5EIOjs = require('../chunk-TNYU5EIO.js');
|
|
8
|
+
require('../chunk-VHDDXCK6.js');
|
|
9
9
|
require('../chunk-HOY77YBF.js');
|
|
10
10
|
require('../chunk-EGTDJ4PL.js');
|
|
11
11
|
require('../chunk-DGUM43GV.js');
|
|
@@ -13,5 +13,5 @@ require('../chunk-DGUM43GV.js');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
exports.Block =
|
|
16
|
+
exports.Block = _chunk2SSEBAHCjs.Block; exports.Layout = _chunkTNYU5EIOjs.Layout; exports.Page = _chunkTNYU5EIOjs.Page;
|
|
17
17
|
//# sourceMappingURL=server.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Block
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-24F6FTCI.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Layout,
|
|
6
6
|
Page
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-LCYGQDAB.mjs";
|
|
8
|
+
import "../chunk-U2NI3TS3.mjs";
|
|
9
9
|
import "../chunk-7DS4Q3GA.mjs";
|
|
10
10
|
import "../chunk-USQF2XTU.mjs";
|
|
11
11
|
import "../chunk-BJTO5JO5.mjs";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { e as BlockOverrideComponent, B as BlockOverrides, L as LoadPageParams, a as LoadPageResult, b as Page, P as PageProps, c as PageRenderer, d as RouteMap,
|
|
2
|
-
export { H as HeaderData, L as Layout, a as LayoutProps } from './Layout-
|
|
1
|
+
export { e as BlockOverrideComponent, f as BlockOverrideProps, B as BlockOverrides, L as LoadPageParams, a as LoadPageResult, b as Page, P as PageProps, c as PageRenderer, d as RouteMap, T as ThemeTokens, l as loadPage } from './loadPage-p3AWwwrd.mjs';
|
|
2
|
+
export { H as HeaderData, L as Layout, a as LayoutProps } from './Layout-p6f3TLw9.mjs';
|
|
3
3
|
export { Block, BlockProps } from './rendering/server.mjs';
|
|
4
|
-
export { C as ContentEntryData, L as LoadContentParams, b as LoadContentResult, a as isEntryContent, i as isPageContent, l as loadContent } from './loadContent-
|
|
5
|
-
export { C as CustomLinkValue, E as ExternalLinkValue, I as InternalLinkValue, d as LinkValue, c as SiteFooterContent, S as SiteHeaderContent, T as Theme } from './types-
|
|
4
|
+
export { C as ContentEntryData, L as LoadContentParams, b as LoadContentResult, a as isEntryContent, i as isPageContent, l as loadContent } from './loadContent-CdXfuCuE.mjs';
|
|
5
|
+
export { C as CustomLinkValue, E as ExternalLinkValue, I as InternalLinkValue, d as LinkValue, c as SiteFooterContent, S as SiteHeaderContent, T as Theme } from './types-BLf-hE50.mjs';
|
|
6
6
|
export { P as PageOutline } from './schema-Bpy9N5ZI.mjs';
|
|
7
|
-
import { G as GradientConfig, M as Media } from './components-
|
|
8
|
-
export {
|
|
9
|
-
import './types-
|
|
7
|
+
import { G as GradientConfig, M as Media } from './components-C75e4poV.mjs';
|
|
8
|
+
export { f as BackgroundInput, B as BodyTextContent, H as HeroContent, a as HeroMedia, g as ResolvedBackground, R as RichText, c as RichTextPrimitiveProps, e as SectionBackground, h as SectionBackgroundProps, S as SystemBlockComponentProps, T as TipTapNode, b as buildThemeRuntime, d as resolveBackground, r as resolveImageUrl } from './components-C75e4poV.mjs';
|
|
9
|
+
import './types-CdhKJrB0.mjs';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
11
11
|
import 'react';
|
|
12
12
|
import 'zod';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { e as BlockOverrideComponent, B as BlockOverrides, L as LoadPageParams, a as LoadPageResult, b as Page, P as PageProps, c as PageRenderer, d as RouteMap,
|
|
2
|
-
export { H as HeaderData, L as Layout, a as LayoutProps } from './Layout-
|
|
1
|
+
export { e as BlockOverrideComponent, f as BlockOverrideProps, B as BlockOverrides, L as LoadPageParams, a as LoadPageResult, b as Page, P as PageProps, c as PageRenderer, d as RouteMap, T as ThemeTokens, l as loadPage } from './loadPage-BA0HiT-6.js';
|
|
2
|
+
export { H as HeaderData, L as Layout, a as LayoutProps } from './Layout-CXI_VkhN.js';
|
|
3
3
|
export { Block, BlockProps } from './rendering/server.js';
|
|
4
|
-
export { C as ContentEntryData, L as LoadContentParams, b as LoadContentResult, a as isEntryContent, i as isPageContent, l as loadContent } from './loadContent-
|
|
5
|
-
export { C as CustomLinkValue, E as ExternalLinkValue, I as InternalLinkValue, d as LinkValue, c as SiteFooterContent, S as SiteHeaderContent, T as Theme } from './types-
|
|
4
|
+
export { C as ContentEntryData, L as LoadContentParams, b as LoadContentResult, a as isEntryContent, i as isPageContent, l as loadContent } from './loadContent-CsvQRoxb.js';
|
|
5
|
+
export { C as CustomLinkValue, E as ExternalLinkValue, I as InternalLinkValue, d as LinkValue, c as SiteFooterContent, S as SiteHeaderContent, T as Theme } from './types-BWQ-TohG.js';
|
|
6
6
|
export { P as PageOutline } from './schema-Bpy9N5ZI.js';
|
|
7
|
-
import { G as GradientConfig, M as Media } from './components-
|
|
8
|
-
export {
|
|
9
|
-
import './types-
|
|
7
|
+
import { G as GradientConfig, M as Media } from './components-Dhiemsjd.js';
|
|
8
|
+
export { f as BackgroundInput, B as BodyTextContent, H as HeroContent, a as HeroMedia, g as ResolvedBackground, R as RichText, c as RichTextPrimitiveProps, e as SectionBackground, h as SectionBackgroundProps, S as SystemBlockComponentProps, T as TipTapNode, b as buildThemeRuntime, d as resolveBackground, r as resolveImageUrl } from './components-Dhiemsjd.js';
|
|
9
|
+
import './types-Dj8B3QRb.js';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
11
11
|
import 'react';
|
|
12
12
|
import 'zod';
|
package/dist/server/rendering.js
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
var _chunkTO7FD6TQjs = require('./chunk-TO7FD6TQ.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkG35R7N7Bjs = require('./chunk-G35R7N7B.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunk2SSEBAHCjs = require('./chunk-2SSEBAHC.js');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkTNYU5EIOjs = require('./chunk-TNYU5EIO.js');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ var _chunkP6CDRJN3js = require('./chunk-P6CDRJN3.js');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkVHDDXCK6js = require('./chunk-VHDDXCK6.js');
|
|
24
24
|
require('./chunk-Y7347JMZ.js');
|
|
25
25
|
require('./chunk-HOY77YBF.js');
|
|
26
26
|
require('./chunk-EGTDJ4PL.js');
|
|
@@ -39,5 +39,5 @@ require('./chunk-DGUM43GV.js');
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
exports.Block =
|
|
42
|
+
exports.Block = _chunk2SSEBAHCjs.Block; exports.Layout = _chunkTNYU5EIOjs.Layout; exports.Page = _chunkTNYU5EIOjs.Page; exports.PageRenderer = _chunkVHDDXCK6js.PageRenderer; exports.RichText = _chunkVHDDXCK6js.RichText; exports.SectionBackground = _chunkVHDDXCK6js.SectionBackground; exports.buildThemeRuntime = _chunkVHDDXCK6js.buildThemeRuntime; exports.isEntryContent = _chunkTO7FD6TQjs.isEntryContent; exports.isPageContent = _chunkTO7FD6TQjs.isPageContent; exports.loadContent = _chunkTO7FD6TQjs.loadContent; exports.loadPage = _chunkG35R7N7Bjs.loadPage; exports.resolveBackground = _chunkVHDDXCK6js.resolveBackground; exports.resolveImageUrl = _chunkVHDDXCK6js.resolveImageUrl;
|
|
43
43
|
//# sourceMappingURL=rendering.js.map
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
} from "./chunk-OP2GHK27.mjs";
|
|
6
6
|
import {
|
|
7
7
|
loadPage
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ES6QDZUX.mjs";
|
|
9
9
|
import {
|
|
10
10
|
Block
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-24F6FTCI.mjs";
|
|
12
12
|
import {
|
|
13
13
|
Layout,
|
|
14
14
|
Page
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LCYGQDAB.mjs";
|
|
16
16
|
import {
|
|
17
17
|
PageRenderer,
|
|
18
18
|
RichText,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
buildThemeRuntime,
|
|
21
21
|
resolveBackground,
|
|
22
22
|
resolveImageUrl
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-U2NI3TS3.mjs";
|
|
24
24
|
import "./chunk-A2FZMRDW.mjs";
|
|
25
25
|
import "./chunk-7DS4Q3GA.mjs";
|
|
26
26
|
import "./chunk-USQF2XTU.mjs";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { R as RiverbankClient } from './types-
|
|
2
|
-
import { a as LoadPageResult } from './loadPage-
|
|
3
|
-
import './types-
|
|
4
|
-
import '@riverbankcms/ai';
|
|
1
|
+
import { R as RiverbankClient } from './types-CdhKJrB0.mjs';
|
|
2
|
+
import { a as LoadPageResult } from './loadPage-p3AWwwrd.mjs';
|
|
3
|
+
import { R as RiverbankSiteConfig } from './types-txWsSxN7.mjs';
|
|
5
4
|
import './schema-Bpy9N5ZI.mjs';
|
|
5
|
+
import './types-BLf-hE50.mjs';
|
|
6
|
+
import '@riverbankcms/ai';
|
|
6
7
|
import 'zod';
|
|
7
8
|
import '@riverbankcms/media-storage-supabase';
|
|
8
9
|
import '@riverbankcms/db';
|
|
@@ -117,4 +118,76 @@ declare function resolveRoutes(params: {
|
|
|
117
118
|
resolution: RouteResolution;
|
|
118
119
|
}>>;
|
|
119
120
|
|
|
120
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Content route matching utilities.
|
|
123
|
+
*
|
|
124
|
+
* Derive route matching from SDK config to determine whether a URL path
|
|
125
|
+
* is a CMS page or a content entry, without duplicating route patterns.
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Extract the first path segment from each routable content type's routePattern.
|
|
130
|
+
*
|
|
131
|
+
* Useful for simple prefix-based routing decisions. For more precise matching
|
|
132
|
+
* that handles nested patterns, use `isContentEntryPath` instead.
|
|
133
|
+
*
|
|
134
|
+
* @param config - The SDK config object from defineConfig()
|
|
135
|
+
* @returns Array of first path segments from content type routePatterns
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* import { getContentEntryPrefixes } from '@riverbankcms/sdk/routing';
|
|
140
|
+
* import config from '../riverbank.config';
|
|
141
|
+
*
|
|
142
|
+
* // Config with routePatterns: '/blog/{slug}', '/work/projects/{slug}'
|
|
143
|
+
* const prefixes = getContentEntryPrefixes(config);
|
|
144
|
+
* // Returns ['blog', 'work']
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
declare function getContentEntryPrefixes(config: RiverbankSiteConfig): string[];
|
|
148
|
+
/**
|
|
149
|
+
* Result of checking if a path matches a content entry route.
|
|
150
|
+
*/
|
|
151
|
+
type ContentEntryMatch = {
|
|
152
|
+
/** Whether the path matches a content entry route pattern */
|
|
153
|
+
isEntry: boolean;
|
|
154
|
+
/** The content type key if matched (e.g., 'blog-post') */
|
|
155
|
+
contentType?: string;
|
|
156
|
+
/** The slug extracted from the path if matched */
|
|
157
|
+
slug?: string;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Check if a URL path matches any content entry route pattern.
|
|
161
|
+
*
|
|
162
|
+
* Supports nested patterns like '/work/projects/{slug}'. Returns the matched
|
|
163
|
+
* content type key and extracted slug, useful for routing decisions.
|
|
164
|
+
*
|
|
165
|
+
* **Note:** Content types are checked in array order. If multiple patterns
|
|
166
|
+
* could match a path, the first matching content type wins. Order more specific
|
|
167
|
+
* patterns before generic ones in your config.
|
|
168
|
+
*
|
|
169
|
+
* @param config - The SDK config object from defineConfig()
|
|
170
|
+
* @param path - URL path as string ('/blog/my-post') or segments ['blog', 'my-post']
|
|
171
|
+
* @returns Match result with content type and slug if matched
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* import { isContentEntryPath } from '@riverbankcms/sdk/routing';
|
|
176
|
+
* import config from '../riverbank.config';
|
|
177
|
+
*
|
|
178
|
+
* // Simple pattern: '/blog/{slug}'
|
|
179
|
+
* isContentEntryPath(config, '/blog/my-post');
|
|
180
|
+
* // Returns { isEntry: true, contentType: 'blog-post', slug: 'my-post' }
|
|
181
|
+
*
|
|
182
|
+
* // Nested pattern: '/work/projects/{slug}'
|
|
183
|
+
* isContentEntryPath(config, '/work/projects/website-redesign');
|
|
184
|
+
* // Returns { isEntry: true, contentType: 'project', slug: 'website-redesign' }
|
|
185
|
+
*
|
|
186
|
+
* // Non-matching path
|
|
187
|
+
* isContentEntryPath(config, '/about');
|
|
188
|
+
* // Returns { isEntry: false }
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
declare function isContentEntryPath(config: RiverbankSiteConfig, path: string | string[]): ContentEntryMatch;
|
|
192
|
+
|
|
193
|
+
export { type ContentEntryMatch, type ResolveRouteParams, type RouteResolution, getContentEntryPrefixes, isContentEntryPath, resolveRoute, resolveRoutes };
|
package/dist/server/routing.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { R as RiverbankClient } from './types-
|
|
2
|
-
import { a as LoadPageResult } from './loadPage-
|
|
3
|
-
import './types-
|
|
4
|
-
import '@riverbankcms/ai';
|
|
1
|
+
import { R as RiverbankClient } from './types-Dj8B3QRb.js';
|
|
2
|
+
import { a as LoadPageResult } from './loadPage-BA0HiT-6.js';
|
|
3
|
+
import { R as RiverbankSiteConfig } from './types-CL916r6x.js';
|
|
5
4
|
import './schema-Bpy9N5ZI.js';
|
|
5
|
+
import './types-BWQ-TohG.js';
|
|
6
|
+
import '@riverbankcms/ai';
|
|
6
7
|
import 'zod';
|
|
7
8
|
import '@riverbankcms/media-storage-supabase';
|
|
8
9
|
import '@riverbankcms/db';
|
|
@@ -117,4 +118,76 @@ declare function resolveRoutes(params: {
|
|
|
117
118
|
resolution: RouteResolution;
|
|
118
119
|
}>>;
|
|
119
120
|
|
|
120
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Content route matching utilities.
|
|
123
|
+
*
|
|
124
|
+
* Derive route matching from SDK config to determine whether a URL path
|
|
125
|
+
* is a CMS page or a content entry, without duplicating route patterns.
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Extract the first path segment from each routable content type's routePattern.
|
|
130
|
+
*
|
|
131
|
+
* Useful for simple prefix-based routing decisions. For more precise matching
|
|
132
|
+
* that handles nested patterns, use `isContentEntryPath` instead.
|
|
133
|
+
*
|
|
134
|
+
* @param config - The SDK config object from defineConfig()
|
|
135
|
+
* @returns Array of first path segments from content type routePatterns
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* import { getContentEntryPrefixes } from '@riverbankcms/sdk/routing';
|
|
140
|
+
* import config from '../riverbank.config';
|
|
141
|
+
*
|
|
142
|
+
* // Config with routePatterns: '/blog/{slug}', '/work/projects/{slug}'
|
|
143
|
+
* const prefixes = getContentEntryPrefixes(config);
|
|
144
|
+
* // Returns ['blog', 'work']
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
declare function getContentEntryPrefixes(config: RiverbankSiteConfig): string[];
|
|
148
|
+
/**
|
|
149
|
+
* Result of checking if a path matches a content entry route.
|
|
150
|
+
*/
|
|
151
|
+
type ContentEntryMatch = {
|
|
152
|
+
/** Whether the path matches a content entry route pattern */
|
|
153
|
+
isEntry: boolean;
|
|
154
|
+
/** The content type key if matched (e.g., 'blog-post') */
|
|
155
|
+
contentType?: string;
|
|
156
|
+
/** The slug extracted from the path if matched */
|
|
157
|
+
slug?: string;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Check if a URL path matches any content entry route pattern.
|
|
161
|
+
*
|
|
162
|
+
* Supports nested patterns like '/work/projects/{slug}'. Returns the matched
|
|
163
|
+
* content type key and extracted slug, useful for routing decisions.
|
|
164
|
+
*
|
|
165
|
+
* **Note:** Content types are checked in array order. If multiple patterns
|
|
166
|
+
* could match a path, the first matching content type wins. Order more specific
|
|
167
|
+
* patterns before generic ones in your config.
|
|
168
|
+
*
|
|
169
|
+
* @param config - The SDK config object from defineConfig()
|
|
170
|
+
* @param path - URL path as string ('/blog/my-post') or segments ['blog', 'my-post']
|
|
171
|
+
* @returns Match result with content type and slug if matched
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* import { isContentEntryPath } from '@riverbankcms/sdk/routing';
|
|
176
|
+
* import config from '../riverbank.config';
|
|
177
|
+
*
|
|
178
|
+
* // Simple pattern: '/blog/{slug}'
|
|
179
|
+
* isContentEntryPath(config, '/blog/my-post');
|
|
180
|
+
* // Returns { isEntry: true, contentType: 'blog-post', slug: 'my-post' }
|
|
181
|
+
*
|
|
182
|
+
* // Nested pattern: '/work/projects/{slug}'
|
|
183
|
+
* isContentEntryPath(config, '/work/projects/website-redesign');
|
|
184
|
+
* // Returns { isEntry: true, contentType: 'project', slug: 'website-redesign' }
|
|
185
|
+
*
|
|
186
|
+
* // Non-matching path
|
|
187
|
+
* isContentEntryPath(config, '/about');
|
|
188
|
+
* // Returns { isEntry: false }
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
declare function isContentEntryPath(config: RiverbankSiteConfig, path: string | string[]): ContentEntryMatch;
|
|
192
|
+
|
|
193
|
+
export { type ContentEntryMatch, type ResolveRouteParams, type RouteResolution, getContentEntryPrefixes, isContentEntryPath, resolveRoute, resolveRoutes };
|
package/dist/server/routing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }require('./chunk-DGUM43GV.js');
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('./chunk-DGUM43GV.js');
|
|
2
2
|
|
|
3
3
|
// src/routing/resolveRoute.ts
|
|
4
4
|
async function resolveRoute(params) {
|
|
@@ -10,7 +10,7 @@ async function resolveRoute(params) {
|
|
|
10
10
|
preview
|
|
11
11
|
});
|
|
12
12
|
if (pageResponse) {
|
|
13
|
-
const { loadPage } = await Promise.resolve().then(() => _interopRequireWildcard(require("./loadPage-
|
|
13
|
+
const { loadPage } = await Promise.resolve().then(() => _interopRequireWildcard(require("./loadPage-DLC7DJZP.js")));
|
|
14
14
|
const pageData = await loadPage({
|
|
15
15
|
client,
|
|
16
16
|
siteId,
|
|
@@ -53,7 +53,61 @@ async function resolveRoutes(params) {
|
|
|
53
53
|
return resolutions;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
// src/routing/contentRoutes.ts
|
|
57
|
+
function getContentEntryPrefixes(config) {
|
|
58
|
+
const contentTypes = _nullishCoalesce(_optionalChain([config, 'access', _ => _.content, 'optionalAccess', _2 => _2.contentTypes]), () => ( []));
|
|
59
|
+
return contentTypes.filter(
|
|
60
|
+
(ct) => ct.hasPages && typeof ct.routePattern === "string"
|
|
61
|
+
).map((ct) => {
|
|
62
|
+
const match = ct.routePattern.match(/^\/([^/]+)/);
|
|
63
|
+
const segment = _optionalChain([match, 'optionalAccess', _3 => _3[1]]);
|
|
64
|
+
if (_optionalChain([segment, 'optionalAccess', _4 => _4.includes, 'call', _5 => _5("{")])) return void 0;
|
|
65
|
+
return segment;
|
|
66
|
+
}).filter((prefix) => typeof prefix === "string");
|
|
67
|
+
}
|
|
68
|
+
function isContentEntryPath(config, path) {
|
|
69
|
+
const segments = typeof path === "string" ? path.split("/").filter(Boolean) : path;
|
|
70
|
+
const contentTypes = _nullishCoalesce(_optionalChain([config, 'access', _6 => _6.content, 'optionalAccess', _7 => _7.contentTypes]), () => ( []));
|
|
71
|
+
for (const ct of contentTypes) {
|
|
72
|
+
if (!ct.hasPages || !ct.routePattern) continue;
|
|
73
|
+
const patternSegments = parseRoutePattern(ct.routePattern);
|
|
74
|
+
const match = matchPattern(segments, patternSegments);
|
|
75
|
+
if (match.matches) {
|
|
76
|
+
return {
|
|
77
|
+
isEntry: true,
|
|
78
|
+
contentType: ct.key,
|
|
79
|
+
slug: match.slug
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return { isEntry: false };
|
|
84
|
+
}
|
|
85
|
+
function parseRoutePattern(pattern) {
|
|
86
|
+
const segments = pattern.split("/").filter(Boolean);
|
|
87
|
+
const staticSegments = [];
|
|
88
|
+
for (const segment of segments) {
|
|
89
|
+
if (segment.includes("{")) break;
|
|
90
|
+
staticSegments.push(segment);
|
|
91
|
+
}
|
|
92
|
+
return staticSegments;
|
|
93
|
+
}
|
|
94
|
+
function matchPattern(pathSegments, patternSegments) {
|
|
95
|
+
if (pathSegments.length < patternSegments.length + 1) {
|
|
96
|
+
return { matches: false };
|
|
97
|
+
}
|
|
98
|
+
for (let i = 0; i < patternSegments.length; i++) {
|
|
99
|
+
if (pathSegments[i] !== patternSegments[i]) {
|
|
100
|
+
return { matches: false };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const slugSegments = pathSegments.slice(patternSegments.length);
|
|
104
|
+
const slug = slugSegments.join("/");
|
|
105
|
+
return { matches: true, slug };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
56
110
|
|
|
57
111
|
|
|
58
|
-
exports.resolveRoute = resolveRoute; exports.resolveRoutes = resolveRoutes;
|
|
112
|
+
exports.getContentEntryPrefixes = getContentEntryPrefixes; exports.isContentEntryPath = isContentEntryPath; exports.resolveRoute = resolveRoute; exports.resolveRoutes = resolveRoutes;
|
|
59
113
|
//# sourceMappingURL=routing.js.map
|