| 1 | import { R as RouteModule, t as LinkDescriptor, L as Location, u as Func, v as Pretty, w as MetaDescriptor, G as GetLoaderData, x as ServerDataFunctionArgs, y as MiddlewareNextFunction, z as ClientDataFunctionArgs, B as DataStrategyResult, E as ServerDataFrom, N as Normalize, I as GetActionData } from '../../routeModules-CM_clkdE.js';
|
| 2 | import { R as RouteFiles, P as Pages } from '../../register-D1WlEpq9.js';
|
| 3 | import 'react';
|
| 4 |
|
| 5 | type MaybePromise<T> = T | Promise<T>;
|
| 6 | type Props = {
|
| 7 | params: unknown;
|
| 8 | loaderData: unknown;
|
| 9 | actionData: unknown;
|
| 10 | };
|
| 11 | type RouteInfo = Props & {
|
| 12 | module: RouteModule;
|
| 13 | matches: Array<MatchInfo>;
|
| 14 | };
|
| 15 | type MatchInfo = {
|
| 16 | id: string;
|
| 17 | module: RouteModule;
|
| 18 | };
|
| 19 | type MetaMatch<T extends MatchInfo> = Pretty<{
|
| 20 | id: T["id"];
|
| 21 | params: Record<string, string | undefined>;
|
| 22 | pathname: string;
|
| 23 | meta: MetaDescriptor[];
|
| 24 |
|
| 25 | data: GetLoaderData<T["module"]>;
|
| 26 | loaderData: GetLoaderData<T["module"]>;
|
| 27 | handle?: unknown;
|
| 28 | error?: unknown;
|
| 29 | }>;
|
| 30 | type MetaMatches<T extends Array<MatchInfo>> = T extends [infer F extends MatchInfo, ...infer R extends Array<MatchInfo>] ? [MetaMatch<F>, ...MetaMatches<R>] : Array<MetaMatch<MatchInfo> | undefined>;
|
| 31 | type HasErrorBoundary<T extends RouteInfo> = T["module"] extends {
|
| 32 | ErrorBoundary: Func;
|
| 33 | } ? true : false;
|
| 34 | type CreateMetaArgs<T extends RouteInfo> = {
|
| 35 |
|
| 36 | location: Location;
|
| 37 |
|
| 38 | params: T["params"];
|
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 |
|
| 44 | data: T["loaderData"] | (HasErrorBoundary<T> extends true ? undefined : never);
|
| 45 |
|
| 46 | loaderData: T["loaderData"] | (HasErrorBoundary<T> extends true ? undefined : never);
|
| 47 |
|
| 48 | error?: unknown;
|
| 49 |
|
| 50 | matches: MetaMatches<T["matches"]>;
|
| 51 | };
|
| 52 | type MetaDescriptors = MetaDescriptor[];
|
| 53 | type HeadersArgs = {
|
| 54 | loaderHeaders: Headers;
|
| 55 | parentHeaders: Headers;
|
| 56 | actionHeaders: Headers;
|
| 57 | errorHeaders: Headers | undefined;
|
| 58 | };
|
| 59 | type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T["params"]>, next: MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
|
| 60 | type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T["params"]>, next: MiddlewareNextFunction<Record<string, DataStrategyResult>>) => MaybePromise<Record<string, DataStrategyResult> | void>;
|
| 61 | type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
|
| 62 | type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
|
| 63 |
|
| 64 | serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
|
| 65 | };
|
| 66 | type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
|
| 67 | type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
|
| 68 |
|
| 69 | serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
|
| 70 | };
|
| 71 | type CreateHydrateFallbackProps<T extends RouteInfo, RSCEnabled extends boolean> = {
|
| 72 | params: T["params"];
|
| 73 | } & (RSCEnabled extends true ? {
|
| 74 |
|
| 75 | loaderData?: ServerDataFrom<T["module"]["loader"]>;
|
| 76 |
|
| 77 | actionData?: ServerDataFrom<T["module"]["action"]>;
|
| 78 | } : {
|
| 79 |
|
| 80 | loaderData?: T["loaderData"];
|
| 81 |
|
| 82 | actionData?: T["actionData"];
|
| 83 | });
|
| 84 | type Match<T extends MatchInfo> = Pretty<{
|
| 85 | id: T["id"];
|
| 86 | params: Record<string, string | undefined>;
|
| 87 | pathname: string;
|
| 88 |
|
| 89 | data: GetLoaderData<T["module"]>;
|
| 90 | loaderData: GetLoaderData<T["module"]>;
|
| 91 | handle: unknown;
|
| 92 | }>;
|
| 93 | type Matches<T extends Array<MatchInfo>> = T extends [infer F extends MatchInfo, ...infer R extends Array<MatchInfo>] ? [Match<F>, ...Matches<R>] : Array<Match<MatchInfo> | undefined>;
|
| 94 | type CreateComponentProps<T extends RouteInfo, RSCEnabled extends boolean> = {
|
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 |
|
| 109 | params: T["params"];
|
| 110 |
|
| 111 | matches: Matches<T["matches"]>;
|
| 112 | } & (RSCEnabled extends true ? {
|
| 113 |
|
| 114 | loaderData: ServerDataFrom<T["module"]["loader"]>;
|
| 115 |
|
| 116 | actionData?: ServerDataFrom<T["module"]["action"]>;
|
| 117 | } : {
|
| 118 |
|
| 119 | loaderData: T["loaderData"];
|
| 120 |
|
| 121 | actionData?: T["actionData"];
|
| 122 | });
|
| 123 | type CreateErrorBoundaryProps<T extends RouteInfo, RSCEnabled extends boolean> = {
|
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 |
|
| 138 | params: T["params"];
|
| 139 | error: unknown;
|
| 140 | } & (RSCEnabled extends true ? {
|
| 141 |
|
| 142 | loaderData?: ServerDataFrom<T["module"]["loader"]>;
|
| 143 |
|
| 144 | actionData?: ServerDataFrom<T["module"]["action"]>;
|
| 145 | } : {
|
| 146 |
|
| 147 | loaderData?: T["loaderData"];
|
| 148 |
|
| 149 | actionData?: T["actionData"];
|
| 150 | });
|
| 151 | type GetAnnotations<Info extends RouteInfo> = {
|
| 152 | LinkDescriptors: LinkDescriptor[];
|
| 153 | LinksFunction: () => LinkDescriptor[];
|
| 154 | MetaArgs: CreateMetaArgs<Info>;
|
| 155 | MetaDescriptors: MetaDescriptors;
|
| 156 | MetaFunction: (args: CreateMetaArgs<Info>) => MetaDescriptors;
|
| 157 | HeadersArgs: HeadersArgs;
|
| 158 | HeadersFunction: (args: HeadersArgs) => Headers | HeadersInit;
|
| 159 | MiddlewareFunction: CreateServerMiddlewareFunction<Info>;
|
| 160 | ClientMiddlewareFunction: CreateClientMiddlewareFunction<Info>;
|
| 161 | LoaderArgs: CreateServerLoaderArgs<Info>;
|
| 162 | ClientLoaderArgs: CreateClientLoaderArgs<Info>;
|
| 163 | ActionArgs: CreateServerActionArgs<Info>;
|
| 164 | ClientActionArgs: CreateClientActionArgs<Info>;
|
| 165 | HydrateFallbackProps: CreateHydrateFallbackProps<Info, false>;
|
| 166 | ServerHydrateFallbackProps: CreateHydrateFallbackProps<Info, true>;
|
| 167 | ComponentProps: CreateComponentProps<Info, false>;
|
| 168 | ServerComponentProps: CreateComponentProps<Info, true>;
|
| 169 | ErrorBoundaryProps: CreateErrorBoundaryProps<Info, false>;
|
| 170 | ServerErrorBoundaryProps: CreateErrorBoundaryProps<Info, true>;
|
| 171 | };
|
| 172 |
|
| 173 | type Params<RouteFile extends keyof RouteFiles> = Normalize<Pages[RouteFiles[RouteFile]["page"]]["params"]>;
|
| 174 |
|
| 175 | type GetInfo<T extends {
|
| 176 | file: keyof RouteFiles;
|
| 177 | module: RouteModule;
|
| 178 | }> = {
|
| 179 | params: Params<T["file"]>;
|
| 180 | loaderData: GetLoaderData<T["module"]>;
|
| 181 | actionData: GetActionData<T["module"]>;
|
| 182 | };
|
| 183 |
|
| 184 | export type { GetAnnotations, GetInfo };
|