@ripple-ts/vite-plugin 0.3.64 → 0.3.66

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/types/index.d.ts CHANGED
@@ -34,7 +34,7 @@ export function loadRippleConfig(
34
34
  export class RenderRoute {
35
35
  readonly type: 'render';
36
36
  path: string;
37
- entry: string;
37
+ entry: RenderRouteEntry;
38
38
  layout?: string;
39
39
  before: Middleware[];
40
40
  constructor(options: RenderRouteOptions);
@@ -59,8 +59,8 @@ export type Route = RenderRoute | ServerRoute;
59
59
  export interface RenderRouteOptions {
60
60
  /** URL path pattern (e.g., '/', '/posts/:id', '/docs/*slug') */
61
61
  path: string;
62
- /** Path to the Ripple component entry file */
63
- entry: string;
62
+ /** Path to the Ripple component entry file, optionally with a preferred named export */
63
+ entry: RenderRouteEntry;
64
64
  /** Path to the layout component (wraps the entry) */
65
65
  layout?: string;
66
66
  /** Middleware to run before rendering */
@@ -107,6 +107,15 @@ export interface RipplePluginOptions {
107
107
  excludeRippleExternalModules?: boolean;
108
108
  }
109
109
 
110
+ export type Component<T = Record<string, any>> = (props: T) => void;
111
+
112
+ export type RenderRouteEntry = string | readonly [exportName: string, path: string];
113
+
114
+ export interface RootBoundaryOptions {
115
+ pending?: Component<Record<string, never>>;
116
+ catch?: Component<{ error: unknown; reset: () => void }>;
117
+ }
118
+
110
119
  export interface CompatFactoryConfig {
111
120
  /** Module specifier that exports the compat factory */
112
121
  from: string;
@@ -150,6 +159,8 @@ export interface RippleConfigOptions {
150
159
  router?: {
151
160
  routes: Route[];
152
161
  };
162
+ /** Global root pending/catch UI used by client and SSR render roots */
163
+ rootBoundary?: RootBoundaryOptions;
153
164
  /** Global middlewares applied to all routes */
154
165
  middlewares?: Middleware[];
155
166
  /**
@@ -199,6 +210,7 @@ export interface ResolvedRippleConfig {
199
210
  router: {
200
211
  routes: Route[];
201
212
  };
213
+ rootBoundary: RootBoundaryOptions;
202
214
  /** @default [] */
203
215
  middlewares: Middleware[];
204
216
  /** @default {} */
@@ -4,6 +4,7 @@ import type {
4
4
  Middleware,
5
5
  ResolvedRippleConfig,
6
6
  RippleConfigOptions,
7
+ RootBoundaryOptions,
7
8
  } from '@ripple-ts/vite-plugin';
8
9
 
9
10
  export function resolveRippleConfig(
@@ -27,6 +28,7 @@ export interface ServerManifest {
27
28
  rpcModules?: Record<string, Record<string, Function>>;
28
29
  /** Trust X-Forwarded-* headers when deriving origin for RPC fetch */
29
30
  trustProxy?: boolean;
31
+ rootBoundary?: RootBoundaryOptions;
30
32
  /** Platform-specific runtime primitives from the adapter */
31
33
  runtime: RuntimePrimitives;
32
34
  /**
@@ -46,7 +48,10 @@ export interface RenderResult {
46
48
  }
47
49
 
48
50
  export interface HandlerOptions {
49
- render: (component: Function) => Promise<RenderResult>;
51
+ render: (
52
+ component: Function,
53
+ options?: { rootBoundary?: RootBoundaryOptions },
54
+ ) => Promise<RenderResult>;
50
55
  getCss: (css: Set<string>) => string;
51
56
  htmlTemplate: string;
52
57
  executeServerFunction: (fn: Function, body: string) => Promise<string>;