|
1 | | -import type { Location } from "../router/history"; |
| 1 | +import type { ActionFunction, LoaderFunction } from "../router/utils"; |
2 | 2 | import type { |
3 | | - ActionFunction as RRActionFunction, |
4 | | - ActionFunctionArgs as RRActionFunctionArgs, |
5 | | - AgnosticRouteMatch, |
6 | | - LoaderFunction as RRLoaderFunction, |
7 | | - LoaderFunctionArgs as RRLoaderFunctionArgs, |
8 | | - Params, |
9 | | -} from "../router/utils"; |
10 | | -import type { AppData, AppLoadContext } from "./data"; |
11 | | -import type { SerializeFrom } from "../dom/ssr/components"; |
12 | | -import type { LinkDescriptor } from "../router/links"; |
| 3 | + ClientActionFunction, |
| 4 | + ClientLoaderFunction, |
| 5 | + LinksFunction, |
| 6 | + MetaFunction, |
| 7 | +} from "../dom/ssr/routeModules"; |
13 | 8 |
|
14 | 9 | export interface RouteModules<RouteModule> { |
15 | 10 | [routeId: string]: RouteModule | undefined; |
16 | 11 | } |
17 | 12 |
|
18 | | -/** |
19 | | - * @deprecated Use `LoaderFunctionArgs`/`ActionFunctionArgs` instead |
20 | | - */ |
21 | | -export type DataFunctionArgs = RRActionFunctionArgs<AppLoadContext> & |
22 | | - RRLoaderFunctionArgs<AppLoadContext> & { |
23 | | - // Context is always provided in Remix, and typed for module augmentation support. |
24 | | - // RR also doesn't export DataFunctionArgs, so we extend the two interfaces here |
25 | | - // even tough they're identical under the hood |
26 | | - context: AppLoadContext; |
27 | | - }; |
28 | | - |
29 | | -/** |
30 | | - * A function that handles data mutations for a route on the server |
31 | | - */ |
32 | | -export type ActionFunction = ( |
33 | | - args: ActionFunctionArgs |
34 | | -) => ReturnType<RRActionFunction>; |
35 | | - |
36 | | -/** |
37 | | - * Arguments passed to a route `action` function |
38 | | - */ |
39 | | -export type ActionFunctionArgs = RRActionFunctionArgs<AppLoadContext> & { |
40 | | - // Context is always provided in Remix, and typed for module augmentation support. |
41 | | - context: AppLoadContext; |
42 | | -}; |
43 | | - |
44 | | -/** |
45 | | - * A function that handles data mutations for a route on the client |
46 | | - * @private Public API is exported from @react-router/react |
47 | | - */ |
48 | | -type ClientActionFunction = ( |
49 | | - args: ClientActionFunctionArgs |
50 | | -) => ReturnType<RRActionFunction>; |
51 | | - |
52 | | -/** |
53 | | - * Arguments passed to a route `clientAction` function |
54 | | - * @private Public API is exported from @react-router/react |
55 | | - */ |
56 | | -export type ClientActionFunctionArgs = RRActionFunctionArgs<undefined> & { |
57 | | - serverAction: <T = AppData>() => Promise<SerializeFrom<T>>; |
58 | | -}; |
59 | | - |
60 | | -/** |
61 | | - * A function that loads data for a route on the server |
62 | | - */ |
63 | | -export type LoaderFunction = ( |
64 | | - args: LoaderFunctionArgs |
65 | | -) => ReturnType<RRLoaderFunction>; |
66 | | - |
67 | | -/** |
68 | | - * Arguments passed to a route `loader` function |
69 | | - */ |
70 | | -export type LoaderFunctionArgs = RRLoaderFunctionArgs<AppLoadContext> & { |
71 | | - // Context is always provided in Remix, and typed for module augmentation support. |
72 | | - context: AppLoadContext; |
73 | | -}; |
74 | | - |
75 | | -/** |
76 | | - * A function that loads data for a route on the client |
77 | | - * @private Public API is exported from @react-router/react |
78 | | - */ |
79 | | -type ClientLoaderFunction = (( |
80 | | - args: ClientLoaderFunctionArgs |
81 | | -) => ReturnType<RRLoaderFunction>) & { |
82 | | - hydrate?: boolean; |
83 | | -}; |
84 | | - |
85 | | -/** |
86 | | - * Arguments passed to a route `clientLoader` function |
87 | | - * @private Public API is exported from @react-router/react |
88 | | - */ |
89 | | -export type ClientLoaderFunctionArgs = RRLoaderFunctionArgs<undefined> & { |
90 | | - serverLoader: <T = AppData>() => Promise<SerializeFrom<T>>; |
91 | | -}; |
92 | | - |
93 | 13 | export type HeadersArgs = { |
94 | 14 | loaderHeaders: Headers; |
95 | 15 | parentHeaders: Headers; |
|
0 commit comments