@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/CHANGELOG.md +27 -0
- package/package.json +4 -4
- package/src/index.js +58 -149
- package/src/load-config.js +79 -6
- package/src/project-codegen.js +201 -0
- package/src/routes.js +55 -1
- package/src/server/production.js +23 -6
- package/src/server/render-route.js +30 -22
- package/src/server/virtual-entry.js +29 -7
- package/tests/project-codegen.test.js +42 -0
- package/tests/render-route-props.test.js +256 -0
- package/types/index.d.ts +15 -3
- package/types/production.d.ts +6 -1
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:
|
|
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:
|
|
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 {} */
|
package/types/production.d.ts
CHANGED
|
@@ -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: (
|
|
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>;
|