rari 0.5.25 → 0.5.27
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/{app-routes-DZjfJPdB.mjs → app-routes-KhTu0CFP.mjs} +1 -19
- package/dist/app-routes-q03OTf5N.mjs +3 -0
- package/dist/client.d.mts +2 -2
- package/dist/client.mjs +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/{runtime-client-DrRcA8ca.d.mts → runtime-client-DS02_tXZ.d.mts} +37 -45
- package/dist/{runtime-client-jOuczfIg.mjs → runtime-client-DXbydP6X.mjs} +88 -309
- package/dist/{vite-CMYX6HNZ.d.mts → vite-BbAT_IZh.d.mts} +2 -26
- package/dist/{vite-00sc6n_j.mjs → vite-Crp6BBHv.mjs} +7 -29
- package/dist/vite.d.mts +3 -3
- package/dist/vite.mjs +4 -4
- package/package.json +6 -6
- package/src/client.ts +3 -2
- package/src/router/ClientRouter.tsx +16 -103
- package/src/router/app-routes.ts +1 -29
- package/src/router/index.ts +5 -19
- package/src/router/route-info-client.ts +68 -0
- package/src/router/route-info-types.ts +16 -0
- package/src/router/vite-plugin.ts +9 -15
- package/src/runtime/AppRouterProvider.tsx +16 -18
- package/src/runtime/NavigationProvider.tsx +1 -4
- package/src/runtime/entry-client.js +10 -52
- package/src/runtime/rsc-client-runtime.js +2 -47
- package/src/vite/index.ts +0 -21
- package/src/vite.ts +0 -3
- package/dist/app-routes-DZXtLRKV.mjs +0 -3
|
@@ -188,16 +188,6 @@ var AppRouteGenerator = class {
|
|
|
188
188
|
generateComponentId(routePath, type) {
|
|
189
189
|
return `${type}:${routePath}`;
|
|
190
190
|
}
|
|
191
|
-
async findLayoutChain(routePath, manifest) {
|
|
192
|
-
const chain = [];
|
|
193
|
-
const segments = routePath.split("/").filter(Boolean);
|
|
194
|
-
for (let i = segments.length; i >= 0; i--) {
|
|
195
|
-
const currentPath = i === 0 ? "/" : `/${segments.slice(0, i).join("/")}`;
|
|
196
|
-
const layout = manifest.layouts.find((l) => l.path === currentPath);
|
|
197
|
-
if (layout) chain.unshift(layout);
|
|
198
|
-
}
|
|
199
|
-
return chain;
|
|
200
|
-
}
|
|
201
191
|
shouldScanDirectory(name) {
|
|
202
192
|
return ![
|
|
203
193
|
"node_modules",
|
|
@@ -271,14 +261,6 @@ async function generateAppRouteManifest(appDir, options = {}) {
|
|
|
271
261
|
...options
|
|
272
262
|
}).generateManifest();
|
|
273
263
|
}
|
|
274
|
-
async function writeManifest(manifest, outputPath) {
|
|
275
|
-
const json = JSON.stringify(manifest, null, 2);
|
|
276
|
-
await promises.writeFile(outputPath, json, "utf-8");
|
|
277
|
-
}
|
|
278
|
-
async function loadManifest(manifestPath) {
|
|
279
|
-
const content = await promises.readFile(manifestPath, "utf-8");
|
|
280
|
-
return JSON.parse(content);
|
|
281
|
-
}
|
|
282
264
|
|
|
283
265
|
//#endregion
|
|
284
|
-
export {
|
|
266
|
+
export { generateAppRouteManifest as t };
|
package/dist/client.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { type AppRouteEntry, type AppRouteManifest, type AppRouteMatch, ClientRouter, type ClientRouterProps, DefaultError, DefaultLoading, ErrorBoundary, type ErrorEntry, type ErrorProps, type GenerateMetadata, type GenerateStaticParams, HttpRuntimeClient, type
|
|
1
|
+
import { $ as PageProps, A as NavigationErrorOverlayProps, B as AppRouteEntry, C as clearPropsCacheForComponent, D as extractStaticParams, E as extractServerPropsWithCache, F as createNavigationError, G as GenerateMetadata, H as AppRouteMatch, I as fetchWithTimeout, J as LayoutProps, K as GenerateStaticParams, L as LayoutErrorBoundary, M as NavigationErrorHandler, N as NavigationErrorHandlerOptions, O as hasServerSideDataFetching, P as NavigationErrorType, Q as NotFoundProps, R as ClientRouter, S as clearPropsCache, T as extractServerProps, U as ErrorEntry, V as AppRouteManifest, W as ErrorProps, X as LoadingProps, Y as LoadingEntry, Z as NotFoundEntry, _ as RouteInfoRequest, a as LoadingSpinner, b as ServerPropsResult, c as createErrorBoundary, d as PreservedState, et as RouteSegment, f as ScrollPosition, g as RouteInfoError, h as routeInfoCache, i as HttpRuntimeClient, j as NavigationError, k as NavigationErrorOverlay, l as createHttpRuntimeClient, m as StatePreserverConfig, n as DefaultLoading, o as NotFound, p as StatePreserver, q as LayoutEntry, r as ErrorBoundary, s as RuntimeClient, t as DefaultError, tt as RouteSegmentType, u as createLoadingBoundary, v as RouteInfoResponse, w as extractMetadata, x as StaticParamsResult, y as MetadataResult, z as ClientRouterProps } from "./runtime-client-DS02_tXZ.mjs";
|
|
2
|
+
export { type AppRouteEntry, type AppRouteManifest, type AppRouteMatch, ClientRouter, type ClientRouterProps, DefaultError, DefaultLoading, ErrorBoundary, type ErrorEntry, type ErrorProps, type GenerateMetadata, type GenerateStaticParams, HttpRuntimeClient, type LayoutEntry, LayoutErrorBoundary, type LayoutProps, type LoadingEntry, type LoadingProps, LoadingSpinner, type MetadataResult, type NavigationError, NavigationErrorHandler, type NavigationErrorHandlerOptions, NavigationErrorOverlay, type NavigationErrorOverlayProps, type NavigationErrorType, NotFound, type NotFoundEntry, type NotFoundProps, type PageProps, type PreservedState, RouteInfoError, RouteInfoRequest, RouteInfoResponse, type RouteSegment, type RouteSegmentType, type RuntimeClient, type ScrollPosition, type ServerPropsResult, StatePreserver, type StatePreserverConfig, type StaticParamsResult, clearPropsCache, clearPropsCacheForComponent, createErrorBoundary, createHttpRuntimeClient, createLoadingBoundary, createNavigationError, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, fetchWithTimeout, hasServerSideDataFetching, routeInfoCache };
|
package/dist/client.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as createNavigationError, S as NavigationErrorHandler, _ as LayoutErrorBoundary, a as LoadingSpinner, b as routeInfoCache, c as createHttpRuntimeClient, d as clearPropsCacheForComponent, f as extractMetadata, g as hasServerSideDataFetching, h as extractStaticParams, i as HttpRuntimeClient, l as createLoadingBoundary, m as extractServerPropsWithCache, n as DefaultLoading, o as NotFound, p as extractServerProps, r as ErrorBoundary, s as createErrorBoundary, t as DefaultError, u as clearPropsCache, v as ClientRouter, w as fetchWithTimeout, x as NavigationErrorOverlay, y as StatePreserver } from "./runtime-client-DXbydP6X.mjs";
|
|
2
2
|
|
|
3
|
-
export { ClientRouter, DefaultError, DefaultLoading, ErrorBoundary, HttpRuntimeClient, LayoutErrorBoundary,
|
|
3
|
+
export { ClientRouter, DefaultError, DefaultLoading, ErrorBoundary, HttpRuntimeClient, LayoutErrorBoundary, LoadingSpinner, NavigationErrorHandler, NavigationErrorOverlay, NotFound, StatePreserver, clearPropsCache, clearPropsCacheForComponent, createErrorBoundary, createHttpRuntimeClient, createLoadingBoundary, createNavigationError, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, fetchWithTimeout, hasServerSideDataFetching, routeInfoCache };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { a as rari, c as
|
|
3
|
-
export { ApiRouteHandlers, AppRouteEntry,
|
|
1
|
+
import { $ as PageProps, B as AppRouteEntry, C as clearPropsCacheForComponent, D as extractStaticParams, E as extractServerPropsWithCache, G as GenerateMetadata, H as AppRouteMatch, J as LayoutProps, K as GenerateStaticParams, O as hasServerSideDataFetching, Q as NotFoundProps, S as clearPropsCache, T as extractServerProps, U as ErrorEntry, V as AppRouteManifest, W as ErrorProps, X as LoadingProps, Y as LoadingEntry, Z as NotFoundEntry, b as ServerPropsResult, et as RouteSegment, i as HttpRuntimeClient, l as createHttpRuntimeClient, q as LayoutEntry, s as RuntimeClient, tt as RouteSegmentType, w as extractMetadata, x as StaticParamsResult, y as MetadataResult } from "./runtime-client-DS02_tXZ.mjs";
|
|
2
|
+
import { a as rari, c as headers, d as RouteContext, f as RouteHandler, i as defineRariOptions, l as ApiRouteHandlers, n as Response, o as rariRouter, r as defineRariConfig, s as generateAppRouteManifest, t as Request, u as RariResponse } from "./vite-BbAT_IZh.mjs";
|
|
3
|
+
export { ApiRouteHandlers, AppRouteEntry, AppRouteManifest, AppRouteMatch, ErrorEntry, ErrorProps, GenerateMetadata, GenerateStaticParams, HttpRuntimeClient, LayoutEntry, LayoutProps, LoadingEntry, LoadingProps, MetadataResult, NotFoundEntry, NotFoundProps, PageProps, RariResponse, Request, Response, RouteContext, RouteHandler, RouteSegment, RouteSegmentType, RuntimeClient, ServerPropsResult, StaticParamsResult, clearPropsCache, clearPropsCacheForComponent, createHttpRuntimeClient, defineRariConfig, defineRariOptions, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, generateAppRouteManifest, hasServerSideDataFetching, headers, rari, rariRouter };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as headers, i as rariRouter, n as defineRariOptions, o as RariResponse, r as rari, t as defineRariConfig } from "./vite-
|
|
2
|
-
import {
|
|
3
|
-
import { c as createHttpRuntimeClient, d as clearPropsCacheForComponent, f as extractMetadata, g as hasServerSideDataFetching, h as extractStaticParams, i as HttpRuntimeClient, m as extractServerPropsWithCache, p as extractServerProps, u as clearPropsCache } from "./runtime-client-
|
|
1
|
+
import { a as headers, i as rariRouter, n as defineRariOptions, o as RariResponse, r as rari, t as defineRariConfig } from "./vite-Crp6BBHv.mjs";
|
|
2
|
+
import { t as generateAppRouteManifest } from "./app-routes-KhTu0CFP.mjs";
|
|
3
|
+
import { c as createHttpRuntimeClient, d as clearPropsCacheForComponent, f as extractMetadata, g as hasServerSideDataFetching, h as extractStaticParams, i as HttpRuntimeClient, m as extractServerPropsWithCache, p as extractServerProps, u as clearPropsCache } from "./runtime-client-DXbydP6X.mjs";
|
|
4
4
|
import "./server-build-CQpjQCX6.mjs";
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { HttpRuntimeClient, RariResponse, clearPropsCache, clearPropsCacheForComponent, createHttpRuntimeClient, defineRariConfig, defineRariOptions, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, generateAppRouteManifest, hasServerSideDataFetching, headers, rari, rariRouter };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React, { Component, ErrorInfo, ReactElement, ReactNode } from "react";
|
|
2
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/router/app-types.d.ts
|
|
@@ -98,13 +98,11 @@ type GenerateStaticParams<TParams extends Record<string, string | string[]> = Re
|
|
|
98
98
|
//#endregion
|
|
99
99
|
//#region src/router/ClientRouter.d.ts
|
|
100
100
|
interface ClientRouterProps {
|
|
101
|
-
children: React
|
|
102
|
-
manifest: AppRouteManifest;
|
|
101
|
+
children: React.ReactNode;
|
|
103
102
|
initialRoute: string;
|
|
104
103
|
}
|
|
105
104
|
declare function ClientRouter({
|
|
106
105
|
children,
|
|
107
|
-
manifest,
|
|
108
106
|
initialRoute
|
|
109
107
|
}: ClientRouterProps): react_jsx_runtime0.JSX.Element;
|
|
110
108
|
//#endregion
|
|
@@ -127,39 +125,6 @@ declare class LayoutErrorBoundary extends Component<LayoutErrorBoundaryProps, La
|
|
|
127
125
|
render(): ReactNode;
|
|
128
126
|
}
|
|
129
127
|
//#endregion
|
|
130
|
-
//#region src/router/LayoutManager.d.ts
|
|
131
|
-
interface LayoutDiff {
|
|
132
|
-
commonLayouts: LayoutEntry[];
|
|
133
|
-
unmountLayouts: LayoutEntry[];
|
|
134
|
-
mountLayouts: LayoutEntry[];
|
|
135
|
-
updateLayouts: LayoutEntry[];
|
|
136
|
-
}
|
|
137
|
-
interface LayoutInstance {
|
|
138
|
-
entry: LayoutEntry;
|
|
139
|
-
component: React.ComponentType<any>;
|
|
140
|
-
props: any;
|
|
141
|
-
key: string;
|
|
142
|
-
ref: React.RefObject<any>;
|
|
143
|
-
mountedAt: number;
|
|
144
|
-
lastUpdated: number;
|
|
145
|
-
}
|
|
146
|
-
declare class LayoutManager {
|
|
147
|
-
private layoutInstances;
|
|
148
|
-
constructor();
|
|
149
|
-
computeLayoutDiff(currentChain: LayoutEntry[], targetChain: LayoutEntry[], currentProps?: Map<string, any>, targetProps?: Map<string, any>): LayoutDiff;
|
|
150
|
-
private havePropsChanged;
|
|
151
|
-
applyLayoutDiff(diff: LayoutDiff): void;
|
|
152
|
-
preserveLayout(entry: LayoutEntry): void;
|
|
153
|
-
mountLayout(entry: LayoutEntry): void;
|
|
154
|
-
unmountLayout(entry: LayoutEntry): void;
|
|
155
|
-
updateLayout(entry: LayoutEntry, props?: any): void;
|
|
156
|
-
getLayoutInstance(path: string): LayoutInstance | undefined;
|
|
157
|
-
isLayoutMounted(path: string): boolean;
|
|
158
|
-
getAllInstances(): LayoutInstance[];
|
|
159
|
-
clearAll(): void;
|
|
160
|
-
getInstanceCount(): number;
|
|
161
|
-
}
|
|
162
|
-
//#endregion
|
|
163
128
|
//#region src/router/navigation-error-handler.d.ts
|
|
164
129
|
type NavigationErrorType = 'fetch-error' | 'timeout' | 'abort' | 'parse-error' | 'network-error' | 'not-found' | 'server-error';
|
|
165
130
|
interface NavigationError {
|
|
@@ -294,6 +259,33 @@ declare function extractServerPropsWithCache(componentPath: string, params: Reco
|
|
|
294
259
|
declare function clearPropsCache(): void;
|
|
295
260
|
declare function clearPropsCacheForComponent(componentPath: string): void;
|
|
296
261
|
//#endregion
|
|
262
|
+
//#region src/router/route-info-types.d.ts
|
|
263
|
+
interface RouteInfoRequest {
|
|
264
|
+
path: string;
|
|
265
|
+
}
|
|
266
|
+
interface RouteInfoResponse {
|
|
267
|
+
exists: boolean;
|
|
268
|
+
layouts: string[];
|
|
269
|
+
loading: string | null;
|
|
270
|
+
isDynamic: boolean;
|
|
271
|
+
params?: string[];
|
|
272
|
+
}
|
|
273
|
+
interface RouteInfoError {
|
|
274
|
+
error: string;
|
|
275
|
+
code: 'NOT_FOUND' | 'INVALID_PATH' | 'SERVER_ERROR';
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/router/route-info-client.d.ts
|
|
279
|
+
declare class RouteInfoCache {
|
|
280
|
+
private cache;
|
|
281
|
+
private pendingRequests;
|
|
282
|
+
get(path: string): Promise<RouteInfoResponse>;
|
|
283
|
+
private fetchRouteInfo;
|
|
284
|
+
clear(): void;
|
|
285
|
+
invalidate(path: string): void;
|
|
286
|
+
}
|
|
287
|
+
declare const routeInfoCache: RouteInfoCache;
|
|
288
|
+
//#endregion
|
|
297
289
|
//#region src/router/StatePreserver.d.ts
|
|
298
290
|
interface ScrollPosition {
|
|
299
291
|
x: number;
|
|
@@ -393,7 +385,7 @@ declare function createLoadingBoundary(fallback: ReactElement): ({
|
|
|
393
385
|
children
|
|
394
386
|
}: {
|
|
395
387
|
children: ReactNode;
|
|
396
|
-
}) => React
|
|
388
|
+
}) => React.FunctionComponentElement<React.SuspenseProps>;
|
|
397
389
|
declare class ErrorBoundary extends Component<{
|
|
398
390
|
children: ReactNode;
|
|
399
391
|
fallback?: (error: Error, reset: () => void) => ReactElement;
|
|
@@ -408,14 +400,14 @@ declare class ErrorBoundary extends Component<{
|
|
|
408
400
|
error: Error;
|
|
409
401
|
};
|
|
410
402
|
componentDidCatch(error: Error, errorInfo: any): void;
|
|
411
|
-
render(): React
|
|
403
|
+
render(): React.ReactNode;
|
|
412
404
|
}
|
|
413
405
|
declare function createErrorBoundary(fallback?: (error: Error, reset: () => void) => ReactElement): ({
|
|
414
406
|
children
|
|
415
407
|
}: {
|
|
416
408
|
children: ReactNode;
|
|
417
|
-
}) => React
|
|
418
|
-
declare function NotFound(): React
|
|
409
|
+
}) => React.CElement<any, ErrorBoundary>;
|
|
410
|
+
declare function NotFound(): React.DetailedReactHTMLElement<{
|
|
419
411
|
style: {
|
|
420
412
|
padding: string;
|
|
421
413
|
textAlign: "center";
|
|
@@ -425,7 +417,7 @@ declare function LoadingSpinner({
|
|
|
425
417
|
size
|
|
426
418
|
}: {
|
|
427
419
|
size?: 'small' | 'medium' | 'large';
|
|
428
|
-
}): React
|
|
420
|
+
}): React.DetailedReactHTMLElement<{
|
|
429
421
|
style: {
|
|
430
422
|
display: "inline-block";
|
|
431
423
|
width: string;
|
|
@@ -436,7 +428,7 @@ declare function LoadingSpinner({
|
|
|
436
428
|
animation: "spin 1s linear infinite";
|
|
437
429
|
};
|
|
438
430
|
}, HTMLElement>;
|
|
439
|
-
declare function DefaultLoading(): React
|
|
431
|
+
declare function DefaultLoading(): React.DetailedReactHTMLElement<{
|
|
440
432
|
style: {
|
|
441
433
|
display: "flex";
|
|
442
434
|
justifyContent: "center";
|
|
@@ -451,7 +443,7 @@ declare function DefaultError({
|
|
|
451
443
|
}: {
|
|
452
444
|
error: Error;
|
|
453
445
|
reset: () => void;
|
|
454
|
-
}): React
|
|
446
|
+
}): React.DetailedReactHTMLElement<{
|
|
455
447
|
style: {
|
|
456
448
|
padding: string;
|
|
457
449
|
border: string;
|
|
@@ -461,4 +453,4 @@ declare function DefaultError({
|
|
|
461
453
|
};
|
|
462
454
|
}, HTMLElement>;
|
|
463
455
|
//#endregion
|
|
464
|
-
export {
|
|
456
|
+
export { PageProps as $, NavigationErrorOverlayProps as A, AppRouteEntry as B, clearPropsCacheForComponent as C, extractStaticParams as D, extractServerPropsWithCache as E, createNavigationError as F, GenerateMetadata as G, AppRouteMatch as H, fetchWithTimeout as I, LayoutProps as J, GenerateStaticParams as K, LayoutErrorBoundary as L, NavigationErrorHandler as M, NavigationErrorHandlerOptions as N, hasServerSideDataFetching as O, NavigationErrorType as P, NotFoundProps as Q, ClientRouter as R, clearPropsCache as S, extractServerProps as T, ErrorEntry as U, AppRouteManifest as V, ErrorProps as W, LoadingProps as X, LoadingEntry as Y, NotFoundEntry as Z, RouteInfoRequest as _, LoadingSpinner as a, ServerPropsResult as b, createErrorBoundary as c, PreservedState as d, RouteSegment as et, ScrollPosition as f, RouteInfoError as g, routeInfoCache as h, HttpRuntimeClient as i, NavigationError as j, NavigationErrorOverlay as k, createHttpRuntimeClient as l, StatePreserverConfig as m, DefaultLoading as n, NotFound as o, StatePreserver as p, LayoutEntry as q, ErrorBoundary as r, RuntimeClient as s, DefaultError as t, RouteSegmentType as tt, createLoadingBoundary as u, RouteInfoResponse as v, extractMetadata as w, StaticParamsResult as x, MetadataResult as y, ClientRouterProps as z };
|