rari 0.5.29 → 0.6.0
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/RariRequest-CCo4Z2pl.mjs +156 -0
- package/dist/RariRequest-Cfba2VzK.mjs +3 -0
- package/dist/app-routes-BZjZ4Vwn.mjs +3 -0
- package/dist/cli.mjs +3 -3
- package/dist/client.d.mts +134 -2
- package/dist/client.mjs +1214 -2
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +6 -5
- package/dist/mdx.d.mts +10 -0
- package/dist/mdx.mjs +78 -0
- package/dist/proxy/runtime-executor.d.mts +2 -0
- package/dist/proxy/runtime-executor.mjs +86 -0
- package/dist/robots-generator-D2SgtWQx.mjs +105 -0
- package/dist/runtime-client-BnuxQ4y8.mjs +475 -0
- package/dist/{runtime-client-DS02_tXZ.d.mts → runtime-client-q41T0L1o.d.mts} +30 -153
- package/dist/runtime-executor-Hcop_nAb.d.mts +27 -0
- package/dist/server-build-2zPPZQQe.mjs +3 -0
- package/dist/{server-build-CQpjQCX6.mjs → server-build-r9ka8T91.mjs} +38 -21
- package/dist/vite-B0zfwvJc.d.mts +239 -0
- package/dist/{vite-CHxbBtJP.mjs → vite-MiXviq7b.mjs} +810 -664
- package/dist/vite.d.mts +4 -3
- package/dist/vite.mjs +6 -5
- package/package.json +12 -16
- package/src/api-routes.ts +2 -3
- package/src/cli.ts +1 -2
- package/src/client.ts +1 -4
- package/src/deployment/railway.ts +1 -2
- package/src/deployment/render.ts +1 -2
- package/src/index.ts +1 -0
- package/src/mdx.ts +2 -0
- package/src/platform.ts +2 -4
- package/src/proxy/RariRequest.ts +206 -0
- package/src/proxy/RariResponse.ts +136 -0
- package/src/proxy/execute-proxy.ts +143 -0
- package/src/proxy/executor.ts +172 -0
- package/src/proxy/index.ts +16 -0
- package/src/proxy/matcher.ts +151 -0
- package/src/proxy/runtime-executor.ts +151 -0
- package/src/proxy/types.ts +127 -0
- package/src/proxy/vite-plugin.ts +153 -0
- package/src/router/ClientRouter.tsx +19 -38
- package/src/router/LayoutErrorBoundary.tsx +2 -4
- package/src/router/StatePreserver.ts +10 -22
- package/src/router/app-routes.ts +9 -16
- package/src/router/app-types.ts +0 -37
- package/src/router/debounce.ts +5 -21
- package/src/router/navigation-types.ts +0 -14
- package/src/router/navigation-utils.ts +11 -62
- package/src/router/props-extractor.ts +54 -56
- package/src/router/robots-generator.ts +146 -0
- package/src/router/route-info-client.ts +3 -6
- package/src/router/vite-plugin.ts +16 -36
- package/src/runtime/AppRouterProvider.tsx +27 -50
- package/src/runtime/actions.ts +6 -8
- package/src/runtime/csrf.ts +1 -2
- package/src/runtime/entry-client.js +70 -30
- package/src/runtime/mdx-client-components.ts +58 -0
- package/src/runtime/react-server-dom-rari-client.js +8 -16
- package/src/runtime/react-server-dom-shim.d.ts +26 -0
- package/src/runtime/react-server-dom-shim.js +3 -6
- package/src/runtime/rsc-client-runtime.js +62 -122
- package/src/runtime-client.ts +8 -21
- package/src/types/metadata-route.ts +14 -0
- package/src/vite/hmr-coordinator.ts +4 -9
- package/src/vite/hmr-error-handler.ts +2 -4
- package/src/vite/hmr-types.d.ts +1 -1
- package/src/vite/index.ts +196 -151
- package/src/vite/server-build.ts +54 -85
- package/src/vite.ts +28 -11
- package/dist/app-routes-q03OTf5N.mjs +0 -3
- package/dist/hooks/useActionState.d.mts +0 -13
- package/dist/hooks/useActionState.mjs +0 -97
- package/dist/loading-component-map-C1KKbIfe.mjs +0 -37
- package/dist/loading-component-map-DZYu3WJb.mjs +0 -3
- package/dist/runtime-client-Cbat2QnR.mjs +0 -1712
- package/dist/server-build-DpwAKSJu.mjs +0 -3
- package/dist/vite-BbAT_IZh.d.mts +0 -70
- package/src/async-context.ts +0 -34
- package/src/hooks/useActionState.ts +0 -147
- package/src/router/LayoutDataManager.ts +0 -141
- package/src/router/LayoutManager.ts +0 -176
- package/src/router/LoadingComponentRegistry.ts +0 -151
- package/src/router/hmr-utils.ts +0 -117
- package/src/router/index.ts +0 -100
- package/src/router/loading-component-map.ts +0 -50
- package/src/router/rsc-parser.ts +0 -200
- package/src/router/rsc-types.ts +0 -29
- package/src/router/types.ts +0 -14
- package/src/runtime/LayoutWrapper.tsx +0 -13
- package/src/runtime/NavigationProvider.tsx +0 -56
- package/src/runtime/api-request.ts +0 -158
- package/src/vite/hmr-client.ts +0 -83
- package/src/vite/hmr-error-overlay.ts +0 -117
- package/src/vite/hmr-progress-indicator.ts +0 -196
- package/src/vite/loading-component-bundler.ts +0 -119
- /package/dist/{app-routes-KhTu0CFP.mjs → app-routes-DngkPk-T.mjs} +0 -0
- /package/dist/{chunk-DFPPfDFE.mjs → chunk-CVb4hTOq.mjs} +0 -0
- /package/dist/{platform-Bv9HDvl_.mjs → platform-CSErW1jU.mjs} +0 -0
- /package/dist/{railway-B8SUWVNF.mjs → railway-O2zC15UA.mjs} +0 -0
- /package/dist/{render-CnuI67F1.mjs → render-0G06nNDC.mjs} +0 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
//#region src/proxy/RariRequest.ts
|
|
2
|
+
var RequestCookiesImpl = class {
|
|
3
|
+
cookies;
|
|
4
|
+
pendingDeletes;
|
|
5
|
+
pendingSets;
|
|
6
|
+
constructor(cookieHeader) {
|
|
7
|
+
this.cookies = /* @__PURE__ */ new Map();
|
|
8
|
+
this.pendingDeletes = /* @__PURE__ */ new Set();
|
|
9
|
+
this.pendingSets = /* @__PURE__ */ new Map();
|
|
10
|
+
if (cookieHeader) this.parseCookieHeader(cookieHeader);
|
|
11
|
+
}
|
|
12
|
+
parseCookieHeader(header) {
|
|
13
|
+
const pairs = header.split(";").map((pair) => pair.trim());
|
|
14
|
+
for (const pair of pairs) {
|
|
15
|
+
const [name, ...valueParts] = pair.split("=");
|
|
16
|
+
if (name) {
|
|
17
|
+
const value = valueParts.join("=");
|
|
18
|
+
this.cookies.set(name, {
|
|
19
|
+
name,
|
|
20
|
+
value
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
get(name) {
|
|
26
|
+
if (this.pendingDeletes.has(name)) return void 0;
|
|
27
|
+
const pending = this.pendingSets.get(name);
|
|
28
|
+
if (pending) return {
|
|
29
|
+
name: pending.name,
|
|
30
|
+
value: pending.value,
|
|
31
|
+
path: pending.options?.path
|
|
32
|
+
};
|
|
33
|
+
return this.cookies.get(name);
|
|
34
|
+
}
|
|
35
|
+
getAll() {
|
|
36
|
+
const result = [];
|
|
37
|
+
this.cookies.forEach((cookie) => {
|
|
38
|
+
if (!this.pendingDeletes.has(cookie.name)) result.push(cookie);
|
|
39
|
+
});
|
|
40
|
+
this.pendingSets.forEach((cookie) => {
|
|
41
|
+
result.push({
|
|
42
|
+
name: cookie.name,
|
|
43
|
+
value: cookie.value,
|
|
44
|
+
path: cookie.options?.path
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
has(name) {
|
|
50
|
+
if (this.pendingDeletes.has(name)) return false;
|
|
51
|
+
return this.pendingSets.has(name) || this.cookies.has(name);
|
|
52
|
+
}
|
|
53
|
+
delete(name) {
|
|
54
|
+
this.pendingDeletes.add(name);
|
|
55
|
+
this.pendingSets.delete(name);
|
|
56
|
+
}
|
|
57
|
+
set(nameOrOptions, value, options) {
|
|
58
|
+
if (typeof nameOrOptions === "string") {
|
|
59
|
+
this.pendingSets.set(nameOrOptions, {
|
|
60
|
+
name: nameOrOptions,
|
|
61
|
+
value,
|
|
62
|
+
options
|
|
63
|
+
});
|
|
64
|
+
this.pendingDeletes.delete(nameOrOptions);
|
|
65
|
+
} else {
|
|
66
|
+
const { name, value: val, ...opts } = nameOrOptions;
|
|
67
|
+
this.pendingSets.set(name, {
|
|
68
|
+
name,
|
|
69
|
+
value: val,
|
|
70
|
+
options: opts
|
|
71
|
+
});
|
|
72
|
+
this.pendingDeletes.delete(name);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
getPendingChanges() {
|
|
76
|
+
return {
|
|
77
|
+
deletes: Array.from(this.pendingDeletes),
|
|
78
|
+
sets: Array.from(this.pendingSets.values())
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var RariURLImpl = class {
|
|
83
|
+
url;
|
|
84
|
+
constructor(url) {
|
|
85
|
+
this.url = typeof url === "string" ? new URL(url) : url;
|
|
86
|
+
}
|
|
87
|
+
get href() {
|
|
88
|
+
return this.url.href;
|
|
89
|
+
}
|
|
90
|
+
get origin() {
|
|
91
|
+
return this.url.origin;
|
|
92
|
+
}
|
|
93
|
+
get protocol() {
|
|
94
|
+
return this.url.protocol;
|
|
95
|
+
}
|
|
96
|
+
get hostname() {
|
|
97
|
+
return this.url.hostname;
|
|
98
|
+
}
|
|
99
|
+
get port() {
|
|
100
|
+
return this.url.port;
|
|
101
|
+
}
|
|
102
|
+
get pathname() {
|
|
103
|
+
return this.url.pathname;
|
|
104
|
+
}
|
|
105
|
+
set pathname(value) {
|
|
106
|
+
this.url.pathname = value;
|
|
107
|
+
}
|
|
108
|
+
get search() {
|
|
109
|
+
return this.url.search;
|
|
110
|
+
}
|
|
111
|
+
set search(value) {
|
|
112
|
+
this.url.search = value;
|
|
113
|
+
}
|
|
114
|
+
get searchParams() {
|
|
115
|
+
return this.url.searchParams;
|
|
116
|
+
}
|
|
117
|
+
get hash() {
|
|
118
|
+
return this.url.hash;
|
|
119
|
+
}
|
|
120
|
+
set hash(value) {
|
|
121
|
+
this.url.hash = value;
|
|
122
|
+
}
|
|
123
|
+
toString() {
|
|
124
|
+
return this.url.toString();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
var RariRequest = class RariRequest {
|
|
128
|
+
url;
|
|
129
|
+
method;
|
|
130
|
+
headers;
|
|
131
|
+
cookies;
|
|
132
|
+
rariUrl;
|
|
133
|
+
ip;
|
|
134
|
+
geo;
|
|
135
|
+
constructor(input, init) {
|
|
136
|
+
if (input instanceof Request) {
|
|
137
|
+
this.url = input.url;
|
|
138
|
+
this.method = input.method;
|
|
139
|
+
this.headers = new Headers(input.headers);
|
|
140
|
+
} else {
|
|
141
|
+
this.url = typeof input === "string" ? input : input.toString();
|
|
142
|
+
this.method = init?.method || "GET";
|
|
143
|
+
this.headers = new Headers(init?.headers);
|
|
144
|
+
}
|
|
145
|
+
this.rariUrl = new RariURLImpl(this.url);
|
|
146
|
+
this.cookies = new RequestCookiesImpl(this.headers.get("cookie") || void 0);
|
|
147
|
+
this.ip = init?.ip;
|
|
148
|
+
this.geo = init?.geo;
|
|
149
|
+
}
|
|
150
|
+
static fromRequest(request, options) {
|
|
151
|
+
return new RariRequest(request, options);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
//#endregion
|
|
156
|
+
export { RariRequest as t };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as __require } from "./chunk-
|
|
2
|
+
import { t as __require } from "./chunk-CVb4hTOq.mjs";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import process from "node:process";
|
|
@@ -187,7 +187,7 @@ async function deployToRailway() {
|
|
|
187
187
|
logError(`Already running in ${getPlatformName()} environment. Use "rari start" instead.`);
|
|
188
188
|
process.exit(1);
|
|
189
189
|
}
|
|
190
|
-
const { createRailwayDeployment } = await import("./railway-
|
|
190
|
+
const { createRailwayDeployment } = await import("./railway-O2zC15UA.mjs");
|
|
191
191
|
await createRailwayDeployment();
|
|
192
192
|
}
|
|
193
193
|
async function deployToRender() {
|
|
@@ -196,7 +196,7 @@ async function deployToRender() {
|
|
|
196
196
|
logError(`Already running in ${getPlatformName()} environment. Use "rari start" instead.`);
|
|
197
197
|
process.exit(1);
|
|
198
198
|
}
|
|
199
|
-
const { createRenderDeployment } = await import("./render-
|
|
199
|
+
const { createRenderDeployment } = await import("./render-0G06nNDC.mjs");
|
|
200
200
|
await createRenderDeployment();
|
|
201
201
|
}
|
|
202
202
|
async function main() {
|
package/dist/client.d.mts
CHANGED
|
@@ -1,2 +1,134 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { A as LoadingEntry, C as AppRouteMatch, D as GenerateStaticParams, E as GenerateMetadata, M as PageProps, N as RouteSegment, O as LayoutEntry, P as RouteSegmentType, S as AppRouteManifest, T as ErrorProps, _ as extractServerProps, a as LoadingSpinner, b as hasServerSideDataFetching, c as createErrorBoundary, d as MetadataResult, f as ServerPropsResult, g as extractMetadata, h as clearPropsCacheForComponent, i as HttpRuntimeClient, j as NotFoundEntry, k as LayoutProps, l as createHttpRuntimeClient, m as clearPropsCache, n as DefaultLoading, o as NotFound, p as StaticParamsResult, r as ErrorBoundary, s as RuntimeClient, t as DefaultError, u as createLoadingBoundary, v as extractServerPropsWithCache, w as ErrorEntry, x as AppRouteEntry, y as extractStaticParams } from "./runtime-client-q41T0L1o.mjs";
|
|
2
|
+
import React, { Component, ErrorInfo, ReactNode } from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/router/ClientRouter.d.ts
|
|
6
|
+
interface ClientRouterProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
initialRoute: string;
|
|
9
|
+
}
|
|
10
|
+
declare function ClientRouter({
|
|
11
|
+
children,
|
|
12
|
+
initialRoute
|
|
13
|
+
}: ClientRouterProps): react_jsx_runtime0.JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/router/LayoutErrorBoundary.d.ts
|
|
16
|
+
interface LayoutErrorBoundaryProps {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
layoutPath: string;
|
|
19
|
+
fallback?: (error: Error, reset: () => void) => ReactNode;
|
|
20
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
21
|
+
}
|
|
22
|
+
interface LayoutErrorBoundaryState {
|
|
23
|
+
hasError: boolean;
|
|
24
|
+
error: Error | null;
|
|
25
|
+
}
|
|
26
|
+
declare class LayoutErrorBoundary extends Component<LayoutErrorBoundaryProps, LayoutErrorBoundaryState> {
|
|
27
|
+
constructor(props: LayoutErrorBoundaryProps);
|
|
28
|
+
static getDerivedStateFromError(error: Error): LayoutErrorBoundaryState;
|
|
29
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
30
|
+
reset: () => void;
|
|
31
|
+
render(): ReactNode;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/router/navigation-error-handler.d.ts
|
|
35
|
+
type NavigationErrorType = 'fetch-error' | 'timeout' | 'abort' | 'parse-error' | 'network-error' | 'not-found' | 'server-error';
|
|
36
|
+
interface NavigationError {
|
|
37
|
+
type: NavigationErrorType;
|
|
38
|
+
message: string;
|
|
39
|
+
originalError?: Error;
|
|
40
|
+
statusCode?: number;
|
|
41
|
+
url?: string;
|
|
42
|
+
timestamp: number;
|
|
43
|
+
retryable: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface NavigationErrorHandlerOptions {
|
|
46
|
+
timeout?: number;
|
|
47
|
+
maxRetries?: number;
|
|
48
|
+
onError?: (error: NavigationError) => void;
|
|
49
|
+
onRetry?: (attempt: number, error: NavigationError) => void;
|
|
50
|
+
}
|
|
51
|
+
declare class NavigationErrorHandler {
|
|
52
|
+
private options;
|
|
53
|
+
private retryCount;
|
|
54
|
+
constructor(options?: NavigationErrorHandlerOptions);
|
|
55
|
+
handleError(error: unknown, url: string): NavigationError;
|
|
56
|
+
canRetry(error: NavigationError, url: string): boolean;
|
|
57
|
+
incrementRetry(url: string): number;
|
|
58
|
+
resetRetry(url: string): void;
|
|
59
|
+
getRetryCount(url: string): number;
|
|
60
|
+
clearRetries(): void;
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/router/NavigationErrorOverlay.d.ts
|
|
64
|
+
interface NavigationErrorOverlayProps {
|
|
65
|
+
error: NavigationError;
|
|
66
|
+
onRetry?: () => void;
|
|
67
|
+
onReload?: () => void;
|
|
68
|
+
onDismiss?: () => void;
|
|
69
|
+
retryCount?: number;
|
|
70
|
+
maxRetries?: number;
|
|
71
|
+
}
|
|
72
|
+
declare function NavigationErrorOverlay({
|
|
73
|
+
error,
|
|
74
|
+
onRetry,
|
|
75
|
+
onReload,
|
|
76
|
+
onDismiss,
|
|
77
|
+
retryCount,
|
|
78
|
+
maxRetries
|
|
79
|
+
}: NavigationErrorOverlayProps): react_jsx_runtime0.JSX.Element;
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/router/route-info-types.d.ts
|
|
82
|
+
interface RouteInfoRequest {
|
|
83
|
+
path: string;
|
|
84
|
+
}
|
|
85
|
+
interface RouteInfoResponse {
|
|
86
|
+
exists: boolean;
|
|
87
|
+
layouts: string[];
|
|
88
|
+
loading: string | null;
|
|
89
|
+
isDynamic: boolean;
|
|
90
|
+
params?: string[];
|
|
91
|
+
}
|
|
92
|
+
interface RouteInfoError {
|
|
93
|
+
error: string;
|
|
94
|
+
code: 'NOT_FOUND' | 'INVALID_PATH' | 'SERVER_ERROR';
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/router/StatePreserver.d.ts
|
|
98
|
+
interface ScrollPosition {
|
|
99
|
+
x: number;
|
|
100
|
+
y: number;
|
|
101
|
+
element: string;
|
|
102
|
+
}
|
|
103
|
+
interface PreservedState {
|
|
104
|
+
scrollPositions: Map<string, ScrollPosition>;
|
|
105
|
+
formData: Map<string, FormData>;
|
|
106
|
+
focusedElement: string | null;
|
|
107
|
+
}
|
|
108
|
+
interface StatePreserverConfig {
|
|
109
|
+
maxHistorySize?: number;
|
|
110
|
+
scrollableSelector?: string;
|
|
111
|
+
}
|
|
112
|
+
declare class StatePreserver {
|
|
113
|
+
private stateHistory;
|
|
114
|
+
private routeAccessOrder;
|
|
115
|
+
private maxHistorySize;
|
|
116
|
+
private scrollableSelector;
|
|
117
|
+
constructor(config?: StatePreserverConfig);
|
|
118
|
+
captureState(route: string): PreservedState;
|
|
119
|
+
private captureScrollPositions;
|
|
120
|
+
private captureFormData;
|
|
121
|
+
private captureFocusedElement;
|
|
122
|
+
private storeState;
|
|
123
|
+
getHistorySize(): number;
|
|
124
|
+
hasState(route: string): boolean;
|
|
125
|
+
getState(route: string): PreservedState | undefined;
|
|
126
|
+
clearAll(): void;
|
|
127
|
+
clearState(route: string): void;
|
|
128
|
+
restoreState(route: string): boolean;
|
|
129
|
+
private restoreScrollPositions;
|
|
130
|
+
private restoreFormData;
|
|
131
|
+
private restoreFocus;
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
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, LoadingSpinner, type MetadataResult, type NavigationError, NavigationErrorHandler, type NavigationErrorHandlerOptions, NavigationErrorOverlay, type NavigationErrorOverlayProps, type NavigationErrorType, NotFound, type NotFoundEntry, 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, extractMetadata, extractServerProps, extractServerPropsWithCache, extractStaticParams, hasServerSideDataFetching };
|