INDIE UNPKG

114 kBTypeScriptView Raw
1
2import * as React from "react";
3import { ComponentType, ReactElement } from "react";
4import { CookieParseOptions, CookieParseOptions as CookieParseOptions$1, CookieSerializeOptions, CookieSerializeOptions as CookieSerializeOptions$1 } from "cookie-es";
5import { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLink, Navigate, Outlet, Route, Router, RouterProvider, Routes, ScrollRestoration, StaticRouter, StaticRouterProvider, unstable_HistoryRouter } from "react-router/internal/react-server-client";
6import { ReactFormState } from "react-dom/client";
7
8//#region lib/router/history.d.ts
9/**
10 * Actions represent the type of change to a location value.
11 */
12declare enum Action {
13 /**
14 * A POP indicates a change to an arbitrary index in the history stack, such
15 * as a back or forward navigation. It does not describe the direction of the
16 * navigation, only that the current index changed.
17 *
18 * Note: This is the default action for newly created history objects.
19 */
20 Pop = "POP",
21 /**
22 * A PUSH indicates a new entry being added to the history stack, such as when
23 * a link is clicked and a new page loads. When this happens, all subsequent
24 * entries in the stack are lost.
25 */
26 Push = "PUSH",
27 /**
28 * A REPLACE indicates the entry at the current index in the history stack
29 * being replaced by a new one.
30 */
31 Replace = "REPLACE"
32}
33/**
34 * The pathname, search, and hash values of a URL.
35 */
36interface Path {
37 /**
38 * A URL pathname, beginning with a /.
39 */
40 pathname: string;
41 /**
42 * A URL search string, beginning with a ?.
43 */
44 search: string;
45 /**
46 * A URL fragment identifier, beginning with a #.
47 */
48 hash: string;
49}
50/**
51 * An entry in a history stack. A location contains information about the
52 * URL path, as well as possibly some arbitrary state and a key.
53 */
54interface Location$1<State = any> extends Path {
55 /**
56 * A value of arbitrary data associated with this location.
57 */
58 state: State;
59 /**
60 * A unique string associated with this location. May be used to safely store
61 * and retrieve data in some other storage API, like `localStorage`.
62 *
63 * Note: This value is always "default" on the initial location.
64 */
65 key: string;
66 /**
67 * The masked location displayed in the URL bar, which differs from the URL the
68 * router is operating on
69 */
70 mask?: Path;
71}
72/**
73 * A change to the current location.
74 */
75interface Update {
76 /**
77 * The action that triggered the change.
78 */
79 action: Action;
80 /**
81 * The new location.
82 */
83 location: Location$1;
84 /**
85 * The delta between this location and the former location in the history stack
86 */
87 delta: number | null;
88}
89/**
90 * A function that receives notifications about location changes.
91 */
92interface Listener {
93 (update: Update): void;
94}
95/**
96 * Describes a location that is the destination of some navigation used in
97 * {@link Link}, {@link useNavigate}, etc.
98 */
99type To = string | Partial<Path>;
100/**
101 * A history is an interface to the navigation stack. The history serves as the
102 * source of truth for the current location, as well as provides a set of
103 * methods that may be used to change it.
104 *
105 * It is similar to the DOM's `window.history` object, but with a smaller, more
106 * focused API.
107 */
108interface History {
109 /**
110 * The last action that modified the current location. This will always be
111 * Action.Pop when a history instance is first created. This value is mutable.
112 */
113 readonly action: Action;
114 /**
115 * The current location. This value is mutable.
116 */
117 readonly location: Location$1;
118 /**
119 * Returns a valid href for the given `to` value that may be used as
120 * the value of an <a href> attribute.
121 *
122 * @param to - The destination URL
123 */
124 createHref(to: To): string;
125 /**
126 * Returns a URL for the given `to` value
127 *
128 * @param to - The destination URL
129 */
130 createURL(to: To): URL;
131 /**
132 * Encode a location the same way window.history would do (no-op for memory
133 * history) so we ensure our PUSH/REPLACE navigations for data routers
134 * behave the same as POP
135 *
136 * @param to Unencoded path
137 */
138 encodeLocation(to: To): Path;
139 /**
140 * Pushes a new location onto the history stack, increasing its length by one.
141 * If there were any entries in the stack after the current one, they are
142 * lost.
143 *
144 * @param to - The new URL
145 * @param state - Data to associate with the new location
146 */
147 push(to: To, state?: any): void;
148 /**
149 * Replaces the current location in the history stack with a new one. The
150 * location that was replaced will no longer be available.
151 *
152 * @param to - The new URL
153 * @param state - Data to associate with the new location
154 */
155 replace(to: To, state?: any): void;
156 /**
157 * Navigates `n` entries backward/forward in the history stack relative to the
158 * current index. For example, a "back" navigation would use go(-1).
159 *
160 * @param delta - The delta in the stack index
161 */
162 go(delta: number): void;
163 /**
164 * Sets up a listener that will be called whenever the current location
165 * changes.
166 *
167 * @param listener - A function that will be called when the location changes
168 * @returns unlisten - A function that may be used to stop listening
169 */
170 listen(listener: Listener): () => void;
171}
172//#endregion
173//#region lib/router/utils.d.ts
174type MaybePromise<T> = T | Promise<T>;
175/**
176 * Map of routeId -> data returned from a loader/action/error
177 */
178interface RouteData {
179 [routeId: string]: any;
180}
181type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete";
182type UpperCaseFormMethod = Uppercase<LowerCaseFormMethod>;
183/**
184 * Users can specify either lowercase or uppercase form methods on `<Form>`,
185 * useSubmit(), `<fetcher.Form>`, etc.
186 */
187type HTMLFormMethod = LowerCaseFormMethod | UpperCaseFormMethod;
188/**
189 * Active navigation/fetcher form methods are exposed in uppercase on the
190 * RouterState. This is to align with the normalization done via fetch().
191 */
192type FormMethod = UpperCaseFormMethod;
193type FormEncType = "application/x-www-form-urlencoded" | "multipart/form-data" | "application/json" | "text/plain";
194type JsonObject = { [Key in string]: JsonValue } & { [Key in string]?: JsonValue | undefined };
195type JsonArray = JsonValue[] | readonly JsonValue[];
196type JsonPrimitive = string | number | boolean | null;
197type JsonValue = JsonPrimitive | JsonObject | JsonArray;
198/**
199 * @private
200 * Internal interface to pass around for action submissions, not intended for
201 * external consumption
202 */
203type Submission = {
204 formMethod: FormMethod;
205 formAction: string;
206 formEncType: FormEncType;
207 formData: FormData;
208 json: undefined;
209 text: undefined;
210} | {
211 formMethod: FormMethod;
212 formAction: string;
213 formEncType: FormEncType;
214 formData: undefined;
215 json: JsonValue;
216 text: undefined;
217} | {
218 formMethod: FormMethod;
219 formAction: string;
220 formEncType: FormEncType;
221 formData: undefined;
222 json: undefined;
223 text: string;
224};
225/**
226 * A context instance used as the key for the `get`/`set` methods of a
227 * {@link RouterContextProvider}. Accepts an optional default
228 * value to be returned if no value has been set.
229 */
230interface RouterContext<T = unknown> {
231 defaultValue?: T;
232}
233/**
234 * Creates a type-safe {@link RouterContext} object that can be used to
235 * store and retrieve arbitrary values in [`action`](../../start/framework/route-module#action)s,
236 * [`loader`](../../start/framework/route-module#loader)s, and [middleware](../../how-to/middleware).
237 * Similar to React's [`createContext`](https://react.dev/reference/react/createContext),
238 * but specifically designed for React Router's request/response lifecycle.
239 *
240 * If a `defaultValue` is provided, it will be returned from `context.get()`
241 * when no value has been set for the context. Otherwise, reading this context
242 * when no value has been set will throw an error.
243 *
244 * ```tsx filename=app/context.ts
245 * import { createContext } from "react-router";
246 *
247 * // Create a context for user data
248 * export const userContext =
249 * createContext<User | null>(null);
250 * ```
251 *
252 * ```tsx filename=app/middleware/auth.ts
253 * import { getUserFromSession } from "~/auth.server";
254 * import { userContext } from "~/context";
255 *
256 * export const authMiddleware = async ({
257 * context,
258 * request,
259 * }) => {
260 * const user = await getUserFromSession(request);
261 * context.set(userContext, user);
262 * };
263 * ```
264 *
265 * ```tsx filename=app/routes/profile.tsx
266 * import { userContext } from "~/context";
267 *
268 * export async function loader({
269 * context,
270 * }: Route.LoaderArgs) {
271 * const user = context.get(userContext);
272 *
273 * if (!user) {
274 * throw new Response("Unauthorized", { status: 401 });
275 * }
276 *
277 * return { user };
278 * }
279 * ```
280 *
281 * @public
282 * @category Utils
283 * @mode framework
284 * @mode data
285 * @param defaultValue An optional default value for the context. This value
286 * will be returned if no value has been set for this context.
287 * @returns A {@link RouterContext} object that can be used with
288 * `context.get()` and `context.set()` in [`action`](../../start/framework/route-module#action)s,
289 * [`loader`](../../start/framework/route-module#loader)s, and [middleware](../../how-to/middleware).
290 */
291declare function createContext<T>(defaultValue?: T): RouterContext<T>;
292/**
293 * Provides methods for writing/reading values in application context in a
294 * type-safe way. Primarily for usage with [middleware](../../how-to/middleware).
295 *
296 * @example
297 * import {
298 * createContext,
299 * RouterContextProvider
300 * } from "react-router";
301 *
302 * const userContext = createContext<User | null>(null);
303 * const contextProvider = new RouterContextProvider();
304 * contextProvider.set(userContext, getUser());
305 * // ^ Type-safe
306 * const user = contextProvider.get(userContext);
307 * // ^ User
308 *
309 * @public
310 * @category Utils
311 * @mode framework
312 * @mode data
313 */
314declare class RouterContextProvider {
315 #private;
316 /**
317 * Create a new `RouterContextProvider` instance
318 * @param init An optional initial context map to populate the provider with
319 */
320 constructor(init?: Map<RouterContext, unknown>);
321 /**
322 * Access a value from the context. If no value has been set for the context,
323 * it will return the context's `defaultValue` if provided, or throw an error
324 * if no `defaultValue` was set.
325 * @param context The context to get the value for
326 * @returns The value for the context, or the context's `defaultValue` if no
327 * value was set
328 */
329 get<T>(context: RouterContext<T>): T;
330 /**
331 * Set a value for the context. If the context already has a value set, this
332 * will overwrite it.
333 *
334 * @param context The context to set the value for
335 * @param value The value to set for the context
336 * @returns {void}
337 */
338 set<C extends RouterContext>(context: C, value: C extends RouterContext<infer T> ? T : never): void;
339}
340type DefaultContext = Readonly<RouterContextProvider>;
341/**
342 * @private
343 * Arguments passed to route loader/action functions. Same for now but we keep
344 * this as a private implementation detail in case they diverge in the future.
345 */
346interface DataFunctionArgs<Context> {
347 /** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
348 request: Request;
349 /**
350 * A URL instance representing the application location being navigated to or
351 * fetched.
352 *
353 * In Framework mode, this is a normalized URL with React-Router-specific
354 * implementation details removed (`.data` suffixes, `index`/`_routes` search
355 * params). For the raw incoming URL, use `request.url`.
356 */
357 url: URL;
358 /**
359 * Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
360 * Mostly useful as a identifier to aggregate on for logging/tracing/etc.
361 */
362 pattern: string;
363 /**
364 * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
365 * @example
366 * // app/routes.ts
367 * route("teams/:teamId", "./team.tsx"),
368 *
369 * // app/team.tsx
370 * export function loader({
371 * params,
372 * }: Route.LoaderArgs) {
373 * params.teamId;
374 * // ^ string
375 * }
376 */
377 params: Params;
378 /**
379 * This is the context passed in to your server adapter's getLoadContext() function.
380 * It's a way to bridge the gap between the adapter's request/response API with your React Router app.
381 * It is only applicable if you are using a custom server adapter.
382 */
383 context: Context;
384}
385/**
386 * Route middleware `next` function to call downstream handlers and then complete
387 * middlewares from the bottom-up
388 */
389interface MiddlewareNextFunction<Result = unknown> {
390 (): Promise<Result>;
391}
392/**
393 * Route middleware function signature. Receives the same "data" arguments as a
394 * `loader`/`action` (`request`, `params`, `context`) as the first parameter and
395 * a `next` function as the second parameter which will call downstream handlers
396 * and then complete middlewares from the bottom-up
397 */
398type MiddlewareFunction<Result = unknown> = (args: DataFunctionArgs<Readonly<RouterContextProvider>>, next: MiddlewareNextFunction<Result>) => MaybePromise<Result | void>;
399/**
400 * Arguments passed to loader functions
401 */
402interface LoaderFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {}
403/**
404 * Arguments passed to action functions
405 */
406interface ActionFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {}
407/**
408 * Loaders and actions can return anything
409 */
410type DataFunctionValue = unknown;
411type DataFunctionReturnValue = MaybePromise<DataFunctionValue>;
412/**
413 * Route loader function signature
414 */
415type LoaderFunction<Context = DefaultContext> = {
416 (args: LoaderFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
417} & {
418 hydrate?: boolean;
419};
420/**
421 * Route action function signature
422 */
423interface ActionFunction<Context = DefaultContext> {
424 (args: ActionFunctionArgs<Context>, handlerCtx?: unknown): DataFunctionReturnValue;
425}
426/**
427 * Arguments passed to shouldRevalidate function
428 */
429interface ShouldRevalidateFunctionArgs {
430 /** This is the url the navigation started from. You can compare it with `nextUrl` to decide if you need to revalidate this route's data. */
431 currentUrl: URL;
432 /** These are the {@link https://reactrouter.com/start/framework/routing#dynamic-segments dynamic route params} from the URL that can be compared to the `nextParams` to decide if you need to reload or not. Perhaps you're using only a partial piece of the param for data loading, you don't need to revalidate if a superfluous part of the param changed. */
433 currentParams: DataRouteMatch["params"];
434 /** In the case of navigation, this the URL the user is requesting. Some revalidations are not navigation, so it will simply be the same as currentUrl. */
435 nextUrl: URL;
436 /** In the case of navigation, these are the {@link https://reactrouter.com/start/framework/routing#dynamic-segments dynamic route params} from the next location the user is requesting. Some revalidations are not navigation, so it will simply be the same as currentParams. */
437 nextParams: DataRouteMatch["params"];
438 /** The method (probably `"GET"` or `"POST"`) used in the form submission that triggered the revalidation. */
439 formMethod?: Submission["formMethod"];
440 /** The form action (`<Form action="/somewhere">`) that triggered the revalidation. */
441 formAction?: Submission["formAction"];
442 /** The form encType (`<Form encType="application/x-www-form-urlencoded">) used in the form submission that triggered the revalidation*/
443 formEncType?: Submission["formEncType"];
444 /** The form submission data when the form's encType is `text/plain` */
445 text?: Submission["text"];
446 /** The form submission data when the form's encType is `application/x-www-form-urlencoded` or `multipart/form-data` */
447 formData?: Submission["formData"];
448 /** The form submission data when the form's encType is `application/json` */
449 json?: Submission["json"];
450 /** The status code of the action response */
451 actionStatus?: number;
452 /**
453 * When a submission causes the revalidation this will be the result of the action—either action data or an error if the action failed. It's common to include some information in the action result to instruct shouldRevalidate to revalidate or not.
454 *
455 * @example
456 * export async function action() {
457 * await saveSomeStuff();
458 * return { ok: true };
459 * }
460 *
461 * export function shouldRevalidate({
462 * actionResult,
463 * }) {
464 * if (actionResult?.ok) {
465 * return false;
466 * }
467 * return true;
468 * }
469 */
470 actionResult?: any;
471 /**
472 * By default, React Router doesn't call every loader all the time. There are reliable optimizations it can make by default. For example, only loaders with changing params are called. Consider navigating from the following URL to the one below it:
473 *
474 * /projects/123/tasks/abc
475 * /projects/123/tasks/def
476 * React Router will only call the loader for tasks/def because the param for projects/123 didn't change.
477 *
478 * It's safest to always return defaultShouldRevalidate after you've done your specific optimizations that return false, otherwise your UI might get out of sync with your data on the server.
479 */
480 defaultShouldRevalidate: boolean;
481}
482/**
483 * Route shouldRevalidate function signature. This runs after any submission
484 * (navigation or fetcher), so we flatten the navigation/fetcher submission
485 * onto the arguments. It shouldn't matter whether it came from a navigation
486 * or a fetcher, what really matters is the URLs and the formData since loaders
487 * have to re-run based on the data models that were potentially mutated.
488 */
489interface ShouldRevalidateFunction {
490 (args: ShouldRevalidateFunctionArgs): boolean;
491}
492interface DataStrategyMatch extends RouteMatch<string, DataRouteObject> {
493 /**
494 * @private
495 */
496 _lazyPromises?: {
497 middleware: Promise<void> | undefined;
498 handler: Promise<void> | undefined;
499 route: Promise<void> | undefined;
500 };
501 /**
502 * @deprecated Deprecated in favor of `shouldCallHandler`
503 *
504 * A boolean value indicating whether this route handler should be called in
505 * this pass.
506 *
507 * The `matches` array always includes _all_ matched routes even when only
508 * _some_ route handlers need to be called so that things like middleware can
509 * be implemented.
510 *
511 * `shouldLoad` is usually only interesting if you are skipping the route
512 * handler entirely and implementing custom handler logic - since it lets you
513 * determine if that custom logic should run for this route or not.
514 *
515 * For example:
516 * - If you are on `/parent/child/a` and you navigate to `/parent/child/b` -
517 * you'll get an array of three matches (`[parent, child, b]`), but only `b`
518 * will have `shouldLoad=true` because the data for `parent` and `child` is
519 * already loaded
520 * - If you are on `/parent/child/a` and you submit to `a`'s [`action`](https://reactrouter.com/docs/start/data/route-object#action),
521 * then only `a` will have `shouldLoad=true` for the action execution of
522 * `dataStrategy`
523 * - After the [`action`](https://reactrouter.com/docs/start/data/route-object#action),
524 * `dataStrategy` will be called again for the [`loader`](https://reactrouter.com/docs/start/data/route-object#loader)
525 * revalidation, and all matches will have `shouldLoad=true` (assuming no
526 * custom `shouldRevalidate` implementations)
527 */
528 shouldLoad: boolean;
529 /**
530 * Arguments passed to the `shouldRevalidate` function for this `loader` execution.
531 * Will be `null` if this is not a revalidating loader {@link DataStrategyMatch}.
532 */
533 shouldRevalidateArgs: ShouldRevalidateFunctionArgs | null;
534 /**
535 * Determine if this route's handler should be called during this `dataStrategy`
536 * execution. Calling it with no arguments will leverage the default revalidation
537 * behavior. You can pass your own `defaultShouldRevalidate` value if you wish
538 * to change the default revalidation behavior with your `dataStrategy`.
539 *
540 * @param defaultShouldRevalidate `defaultShouldRevalidate` override value (optional)
541 */
542 shouldCallHandler(defaultShouldRevalidate?: boolean): boolean;
543 /**
544 * An async function that will resolve any `route.lazy` implementations and
545 * execute the route's handler (if necessary), returning a {@link DataStrategyResult}
546 *
547 * - Calling `match.resolve` does not mean you're calling the
548 * [`action`](https://reactrouter.com/docs/start/data/route-object#action)/[`loader`](https://reactrouter.com/docs/start/data/route-object#loader)
549 * (the "handler") - `resolve` will only call the `handler` internally if
550 * needed _and_ if you don't pass your own `handlerOverride` function parameter
551 * - It is safe to call `match.resolve` for all matches, even if they have
552 * `shouldLoad=false`, and it will no-op if no loading is required
553 * - You should generally always call `match.resolve()` for `shouldLoad:true`
554 * routes to ensure that any `route.lazy` implementations are processed
555 * - See the examples below for how to implement custom handler execution via
556 * `match.resolve`
557 */
558 resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
559}
560/**
561 * The operation that initiated a data strategy execution. Static handler
562 * executions use `"static"`.
563 */
564type DataStrategyInitiator = "initialization" | "navigation" | "fetcher" | "revalidation" | "static";
565interface DataStrategyFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
566 /**
567 * Matches for this route extended with Data strategy APIs
568 */
569 matches: DataStrategyMatch[];
570 runClientMiddleware: (cb: DataStrategyFunction<Context>) => Promise<Record<string, DataStrategyResult>>;
571 /**
572 * The operation that initiated this data strategy execution
573 *
574 * This field is experimental and subject to breaking changes.
575 */
576 unstable_initiator: DataStrategyInitiator;
577 /**
578 * The history action (`"PUSH"`, `"REPLACE"`, or `"POP"`) for a navigation-
579 * initiated execution, including fetchers reloaded by that navigation.
580 * `null` for initialization, fetcher, revalidation, and static executions.
581 *
582 * This field is experimental and subject to breaking changes.
583 */
584 unstable_navigationType: Action | null;
585 /**
586 * The key of the fetcher targeted by this data strategy execution, otherwise
587 * `null`. Fetchers reloaded during a navigation or revalidation retain that
588 * `unstable_initiator` while providing their key here.
589 */
590 fetcherKey: string | null;
591}
592/**
593 * Result from a loader or action called via dataStrategy
594 */
595interface DataStrategyResult {
596 type: "data" | "error";
597 result: unknown;
598}
599interface DataStrategyFunction<Context = DefaultContext> {
600 (args: DataStrategyFunctionArgs<Context>): Promise<Record<string, DataStrategyResult>>;
601}
602type PatchRoutesOnNavigationFunctionArgs = {
603 signal: AbortSignal;
604 path: string;
605 matches: RouteMatch[];
606 fetcherKey: string | undefined;
607 patch: (routeId: string | null, children: RouteObject[]) => void;
608};
609type PatchRoutesOnNavigationFunction = (opts: PatchRoutesOnNavigationFunctionArgs) => MaybePromise<void>;
610/**
611 * Function provided to set route-specific properties from route objects
612 */
613interface MapRoutePropertiesFunction {
614 (route: DataRouteObject): Partial<DataRouteObject>;
615}
616/**
617 * Keys we cannot change from within a lazy object. We spread all other keys
618 * onto the route. Either they're meaningful to the router, or they'll get
619 * ignored.
620 */
621type UnsupportedLazyRouteObjectKey = "lazy" | "caseSensitive" | "path" | "id" | "index" | "children" | "unstable_validateParams";
622/**
623 * Keys we cannot change from within a lazy() function. We spread all other keys
624 * onto the route. Either they're meaningful to the router, or they'll get
625 * ignored.
626 */
627type UnsupportedLazyRouteFunctionKey = UnsupportedLazyRouteObjectKey | "middleware";
628/**
629 * lazy object to load route properties, which can add non-matching
630 * related properties to a route
631 */
632type LazyRouteObject<R extends RouteObject> = { [K in keyof R as K extends UnsupportedLazyRouteObjectKey ? never : K]?: () => Promise<R[K] | null | undefined> };
633/**
634 * lazy() function to load a route definition, which can add non-matching
635 * related properties to a route
636 */
637interface LazyRouteFunction<R extends RouteObject> {
638 (): Promise<Omit<R, UnsupportedLazyRouteFunctionKey> & Partial<Record<UnsupportedLazyRouteFunctionKey, never>>>;
639}
640type LazyRouteDefinition<R extends RouteObject> = LazyRouteObject<R> | LazyRouteFunction<R>;
641/**
642 * Base RouteObject with common props shared by all types of routes
643 * @internal
644 */
645type BaseRouteObject = {
646 /**
647 * Whether the path should be case-sensitive. Defaults to `false`.
648 */
649 caseSensitive?: boolean;
650 /**
651 * The path pattern to match. If unspecified or empty, then this becomes a
652 * layout route.
653 */
654 path?: string;
655 /**
656 * The unique identifier for this route (for use with {@link DataRouter}s)
657 */
658 id?: string;
659 /**
660 * The route middleware.
661 * See [`middleware`](../../start/data/route-object#middleware).
662 */
663 middleware?: MiddlewareFunction[];
664 /**
665 * The route loader.
666 * See [`loader`](../../start/data/route-object#loader).
667 */
668 loader?: LoaderFunction | boolean;
669 /**
670 * The route action.
671 * See [`action`](../../start/data/route-object#action).
672 */
673 action?: ActionFunction | boolean;
674 /**
675 * The route shouldRevalidate function.
676 * See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate).
677 */
678 shouldRevalidate?: ShouldRevalidateFunction;
679 /**
680 * A map of route param names to regular expressions used to validate params
681 * after a route-pattern match.
682 */
683 unstable_validateParams?: Record<string, RegExp>;
684 /**
685 * The route handle.
686 */
687 handle?: any;
688 /**
689 * A function that returns a promise that resolves to the route object.
690 * Used for code-splitting routes.
691 * See [`lazy`](../../start/data/route-object#lazy).
692 */
693 lazy?: LazyRouteDefinition<BaseRouteObject>;
694 /**
695 * The React Component to render when this route matches.
696 * Mutually exclusive with `element`.
697 */
698 Component?: React.ComponentType | null;
699 /**
700 * The React element to render when this Route matches.
701 * Mutually exclusive with `Component`.
702 */
703 element?: React.ReactNode | null;
704 /**
705 * The React Component to render at this route if an error occurs.
706 * Mutually exclusive with `errorElement`.
707 */
708 ErrorBoundary?: React.ComponentType | null;
709 /**
710 * The React element to render at this route if an error occurs.
711 * Mutually exclusive with `ErrorBoundary`.
712 */
713 errorElement?: React.ReactNode | null;
714 /**
715 * The React Component to render while this router is loading data.
716 * Mutually exclusive with `hydrateFallbackElement`.
717 */
718 HydrateFallback?: React.ComponentType | null;
719 /**
720 * The React element to render while this router is loading data.
721 * Mutually exclusive with `HydrateFallback`.
722 */
723 hydrateFallbackElement?: React.ReactNode | null;
724};
725/**
726 * Index routes must not have children
727 */
728type IndexRouteObject = BaseRouteObject & {
729 /**
730 * Child Route objects - not valid on index routes.
731 */
732 children?: undefined;
733 /**
734 * Whether this is an index route.
735 */
736 index: true;
737};
738/**
739 * Non-index routes may have children, but cannot have `index` set to `true`.
740 */
741type NonIndexRouteObject = BaseRouteObject & {
742 /**
743 * Child Route objects.
744 */
745 children?: RouteObject[];
746 /**
747 * Whether this is an index route - must be `false` or undefined on non-index routes.
748 */
749 index?: false;
750};
751/**
752 * A route object represents a logical route, with (optionally) its child
753 * routes organized in a tree-like structure.
754 */
755type RouteObject = IndexRouteObject | NonIndexRouteObject;
756type DataIndexRouteObject = IndexRouteObject & {
757 id: string;
758};
759type DataNonIndexRouteObject = NonIndexRouteObject & {
760 children?: DataRouteObject[];
761 id: string;
762};
763/**
764 * A data route object, which is just a RouteObject with a required unique ID
765 */
766type DataRouteObject = DataIndexRouteObject | DataNonIndexRouteObject;
767type RouteManifest<R = DataRouteObject> = Record<string, R | undefined>;
768/**
769 * The parameters that were parsed from the URL path.
770 */
771type Params<Key extends string = string> = { readonly [key in Key]: string | undefined };
772/**
773 * A RouteMatch contains info about how a route matched a URL.
774 */
775interface RouteMatch<ParamKey extends string = string, RouteObjectType extends RouteObject = RouteObject> {
776 /**
777 * The names and values of dynamic parameters in the URL.
778 */
779 params: Params<ParamKey>;
780 /**
781 * The portion of the URL pathname that was matched.
782 */
783 pathname: string;
784 /**
785 * The portion of the URL pathname that was matched before child routes.
786 */
787 pathnameBase: string;
788 /**
789 * The route object that was used to match.
790 */
791 route: RouteObjectType;
792}
793interface DataRouteMatch extends RouteMatch<string, DataRouteObject> {}
794/**
795 * Matches the given routes to a location and returns the match data.
796 *
797 * @example
798 * import { matchRoutes } from "react-router";
799 *
800 * let routes = [{
801 * path: "/",
802 * Component: Root,
803 * children: [{
804 * path: "dashboard",
805 * Component: Dashboard,
806 * }]
807 * }];
808 *
809 * matchRoutes(routes, "/dashboard"); // [rootMatch, dashboardMatch]
810 *
811 * @public
812 * @category Utils
813 * @param routes The array of route objects to match against.
814 * @param locationArg The location to match against, either a string path or a
815 * partial {@link Location} object
816 * @param basename Optional base path to strip from the location before matching.
817 * Defaults to `/`.
818 * @returns An array of matched routes, or `null` if no matches were found.
819 */
820declare function matchRoutes<RouteObjectType extends RouteObject = RouteObject>(routes: RouteObjectType[], locationArg: Partial<Location$1> | string, basename?: string): RouteMatch<string, RouteObjectType>[] | null;
821interface UIMatch<Data = unknown, Handle = unknown> {
822 id: string;
823 pathname: string;
824 /**
825 * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the matched route.
826 */
827 params: RouteMatch["params"];
828 /**
829 * The return value from the matched route's loader or clientLoader. This might
830 * be `undefined` if this route's `loader` (or a deeper route's `loader`) threw
831 * an error and we're currently displaying an `ErrorBoundary`.
832 */
833 loaderData: Data | undefined;
834 /**
835 * The {@link https://reactrouter.com/start/framework/route-module#handle handle object}
836 * exported from the matched route module
837 */
838 handle: Handle;
839}
840interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
841 relativePath: string;
842 caseSensitive: boolean;
843 childrenIndex: number;
844 route: RouteObjectType;
845 matcher?: RegExp;
846 compiledParams?: CompiledPathParam[];
847}
848/**
849 * @private
850 * PRIVATE - DO NOT USE
851 *
852 * A "branch" of routes that match a given route pattern.
853 * This is an internal interface not intended for direct external usage.
854 */
855interface RouteBranch<RouteObjectType extends RouteObject = RouteObject> {
856 path: string;
857 score: number;
858 routesMeta: RouteMeta<RouteObjectType>[];
859}
860type CompiledPathParam = {
861 paramName: string;
862 isOptional?: boolean;
863};
864declare class DataWithResponseInit<D> {
865 type: string;
866 data: D;
867 init: ResponseInit | null;
868 constructor(data: D, init?: ResponseInit);
869}
870/**
871 * Create "responses" that contain `headers`/`status` without forcing
872 * serialization into an actual [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
873 *
874 * @example
875 * import { data } from "react-router";
876 *
877 * export async function action({ request }: Route.ActionArgs) {
878 * let formData = await request.formData();
879 * let item = await createItem(formData);
880 * return data(item, {
881 * headers: { "X-Custom-Header": "value" }
882 * status: 201,
883 * });
884 * }
885 *
886 * @public
887 * @category Utils
888 * @mode framework
889 * @mode data
890 * @param data The data to be included in the response.
891 * @param init The status code or a `ResponseInit` object to be included in the
892 * response.
893 * @returns A {@link DataWithResponseInit} instance containing the data and
894 * response init.
895 */
896declare function data<D>(data: D, init?: number | ResponseInit): DataWithResponseInit<D>;
897type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;
898/**
899 * A redirect [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response).
900 * Sets the status code and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
901 * header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
902 *
903 * This utility accepts absolute URLs and can navigate to external domains, so
904 * the application should validate any user-supplied inputs to redirects.
905 *
906 * @example
907 * import { redirect } from "react-router";
908 *
909 * export async function loader({ request }: Route.LoaderArgs) {
910 * if (!isLoggedIn(request))
911 * throw redirect("/login");
912 * }
913 *
914 * // ...
915 * }
916 *
917 * @public
918 * @category Utils
919 * @mode framework
920 * @mode data
921 * @param url The URL to redirect to.
922 * @param init The status code or a `ResponseInit` object to be included in the
923 * response.
924 * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
925 * object with the redirect status and [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
926 * header.
927 */
928declare const redirect$1: RedirectFunction;
929/**
930 * A redirect [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
931 * that will force a document reload to the new location. Sets the status code
932 * and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
933 * header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
934 *
935 * This utility accepts absolute URLs and can navigate to external domains, so
936 * the application should validate any user-supplied inputs to redirects.
937 *
938 * ```tsx filename=routes/logout.tsx
939 * import { redirectDocument } from "react-router";
940 *
941 * import { destroySession } from "../sessions.server";
942 *
943 * export async function action({ request }: Route.ActionArgs) {
944 * let session = await getSession(request.headers.get("Cookie"));
945 * return redirectDocument("/", {
946 * headers: { "Set-Cookie": await destroySession(session) }
947 * });
948 * }
949 * ```
950 *
951 * @public
952 * @category Utils
953 * @mode framework
954 * @mode data
955 * @param url The URL to redirect to.
956 * @param init The status code or a `ResponseInit` object to be included in the
957 * response.
958 * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
959 * object with the redirect status and [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
960 * header.
961 */
962declare const redirectDocument$1: RedirectFunction;
963/**
964 * A redirect [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
965 * that will perform a [`history.replaceState`](https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState)
966 * instead of a [`history.pushState`](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState)
967 * for client-side navigation redirects. Sets the status code and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
968 * header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).
969 *
970 * @example
971 * import { replace } from "react-router";
972 *
973 * export async function loader() {
974 * return replace("/new-location");
975 * }
976 *
977 * @public
978 * @category Utils
979 * @mode framework
980 * @mode data
981 * @param url The URL to redirect to.
982 * @param init The status code or a `ResponseInit` object to be included in the
983 * response.
984 * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
985 * object with the redirect status and [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
986 * header.
987 */
988declare const replace$2: RedirectFunction;
989type ErrorResponse = {
990 status: number;
991 statusText: string;
992 data: any;
993};
994/**
995 * Check if the given error is an {@link ErrorResponse} generated from a 4xx/5xx
996 * [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
997 * thrown from an [`action`](../../start/framework/route-module#action) or
998 * [`loader`](../../start/framework/route-module#loader) function.
999 *
1000 * @example
1001 * import { isRouteErrorResponse } from "react-router";
1002 *
1003 * export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
1004 * if (isRouteErrorResponse(error)) {
1005 * return (
1006 * <>
1007 * <p>Error: `${error.status}: ${error.statusText}`</p>
1008 * <p>{error.data}</p>
1009 * </>
1010 * );
1011 * }
1012 *
1013 * return (
1014 * <p>Error: {error instanceof Error ? error.message : "Unknown Error"}</p>
1015 * );
1016 * }
1017 *
1018 * @public
1019 * @category Utils
1020 * @mode framework
1021 * @mode data
1022 * @param error The error to check.
1023 * @returns `true` if the error is an {@link ErrorResponse}, `false` otherwise.
1024 */
1025declare function isRouteErrorResponse(error: any): error is ErrorResponse;
1026//#endregion
1027//#region lib/components.d.ts
1028/**
1029 * Function signature for client side error handling for loader/actions errors
1030 * and rendering errors via `componentDidCatch`
1031 */
1032interface ClientOnErrorFunction {
1033 (error: unknown, info: {
1034 location: Location$1;
1035 params: Params;
1036 pattern: string;
1037 errorInfo?: React.ErrorInfo;
1038 }): void;
1039}
1040interface AwaitResolveRenderFunction<Resolve = any> {
1041 (data: Awaited<Resolve>): React.ReactNode;
1042}
1043/**
1044 * @category Types
1045 */
1046interface AwaitProps<Resolve> {
1047 /**
1048 * When using a function, the resolved value is provided as the parameter.
1049 *
1050 * ```tsx [2]
1051 * <Await resolve={reviewsPromise}>
1052 * {(resolvedReviews) => <Reviews items={resolvedReviews} />}
1053 * </Await>
1054 * ```
1055 *
1056 * When using React elements, {@link useAsyncValue} will provide the
1057 * resolved value:
1058 *
1059 * ```tsx [2]
1060 * <Await resolve={reviewsPromise}>
1061 * <Reviews />
1062 * </Await>
1063 *
1064 * function Reviews() {
1065 * const resolvedReviews = useAsyncValue();
1066 * return <div>...</div>;
1067 * }
1068 * ```
1069 */
1070 children: React.ReactNode | AwaitResolveRenderFunction<Resolve>;
1071 /**
1072 * The error element renders instead of the `children` when the [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
1073 * rejects.
1074 *
1075 * ```tsx
1076 * <Await
1077 * errorElement={<div>Oops</div>}
1078 * resolve={reviewsPromise}
1079 * >
1080 * <Reviews />
1081 * </Await>
1082 * ```
1083 *
1084 * To provide a more contextual error, you can use the {@link useAsyncError} in a
1085 * child component
1086 *
1087 * ```tsx
1088 * <Await
1089 * errorElement={<ReviewsError />}
1090 * resolve={reviewsPromise}
1091 * >
1092 * <Reviews />
1093 * </Await>
1094 *
1095 * function ReviewsError() {
1096 * const error = useAsyncError();
1097 * return <div>Error loading reviews: {error.message}</div>;
1098 * }
1099 * ```
1100 *
1101 * If you do not provide an `errorElement`, the rejected value will bubble up
1102 * to the nearest route-level [`ErrorBoundary`](../../start/framework/route-module#errorboundary)
1103 * and be accessible via the {@link useRouteError} hook.
1104 */
1105 errorElement?: React.ReactNode;
1106 /**
1107 * Takes a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
1108 * returned from a [`loader`](../../start/framework/route-module#loader) to be
1109 * resolved and rendered.
1110 *
1111 * ```tsx
1112 * import { Await, useLoaderData } from "react-router";
1113 *
1114 * export async function loader() {
1115 * let reviews = getReviews(); // not awaited
1116 * let book = await getBook();
1117 * return {
1118 * book,
1119 * reviews, // this is a promise
1120 * };
1121 * }
1122 *
1123 * export default function Book() {
1124 * const {
1125 * book,
1126 * reviews, // this is the same promise
1127 * } = useLoaderData();
1128 *
1129 * return (
1130 * <div>
1131 * <h1>{book.title}</h1>
1132 * <p>{book.description}</p>
1133 * <React.Suspense fallback={<ReviewsSkeleton />}>
1134 * <Await
1135 * // and is the promise we pass to Await
1136 * resolve={reviews}
1137 * >
1138 * <Reviews />
1139 * </Await>
1140 * </React.Suspense>
1141 * </div>
1142 * );
1143 * }
1144 * ```
1145 */
1146 resolve: Resolve;
1147}
1148/**
1149 * Used to render promise values with automatic error handling.
1150 *
1151 * **Note:** `<Await>` expects to be rendered inside a [`<React.Suspense>`](https://react.dev/reference/react/Suspense)
1152 *
1153 * @example
1154 * import { Await, useLoaderData } from "react-router";
1155 *
1156 * export async function loader() {
1157 * // not awaited
1158 * const reviews = getReviews();
1159 * // awaited (blocks the transition)
1160 * const book = await fetch("/api/book").then((res) => res.json());
1161 * return { book, reviews };
1162 * }
1163 *
1164 * function Book() {
1165 * const { book, reviews } = useLoaderData();
1166 * return (
1167 * <div>
1168 * <h1>{book.title}</h1>
1169 * <p>{book.description}</p>
1170 * <React.Suspense fallback={<ReviewsSkeleton />}>
1171 * <Await
1172 * resolve={reviews}
1173 * errorElement={
1174 * <div>Could not load reviews 😬</div>
1175 * }
1176 * children={(resolvedReviews) => (
1177 * <Reviews items={resolvedReviews} />
1178 * )}
1179 * />
1180 * </React.Suspense>
1181 * </div>
1182 * );
1183 * }
1184 *
1185 * @public
1186 * @category Components
1187 * @mode framework
1188 * @mode data
1189 * @param props Props
1190 * @param {AwaitProps.children} props.children n/a
1191 * @param {AwaitProps.errorElement} props.errorElement n/a
1192 * @param {AwaitProps.resolve} props.resolve n/a
1193 * @returns React element for the rendered awaited value
1194 */
1195declare function Await$1<Resolve>({
1196 children,
1197 errorElement,
1198 resolve
1199}: AwaitProps<Resolve>): React.JSX.Element;
1200//#endregion
1201//#region lib/server-runtime/serverHandoff.d.ts
1202type ServerHandoff = {
1203 criticalCss?: CriticalCss;
1204 basename: string | undefined;
1205 future: FutureConfig$1;
1206 ssr: boolean;
1207 isSpaMode: boolean;
1208 unstable_apiOnly?: boolean;
1209 unstable_apiServerOrigin?: string;
1210 routeDiscovery: ServerBuild["routeDiscovery"];
1211};
1212//#endregion
1213//#region lib/dom/global.d.ts
1214type WindowReactRouterContext = ServerHandoff & {
1215 state: HydrationState;
1216 stream: ReadableStream<Uint8Array> | undefined;
1217 streamController: ReadableStreamDefaultController<Uint8Array>;
1218};
1219interface ViewTransition {
1220 finished: Promise<void>;
1221 ready: Promise<void>;
1222 updateCallbackDone: Promise<void>;
1223 skipTransition(): void;
1224}
1225declare global {
1226 var __staticRouterHydrationData: HydrationState | undefined;
1227 var __reactRouterVersion: string;
1228 interface Document {
1229 startViewTransition(cb: () => Promise<void> | void): ViewTransition;
1230 }
1231 var __reactRouterContext: WindowReactRouterContext | undefined;
1232 var __reactRouterManifest: AssetsManifest | undefined;
1233 var __reactRouterRouteModules: RouteModules | undefined;
1234 var __reactRouterDataRouter: Router$1 | undefined;
1235 var __reactRouterHdrActive: boolean;
1236 var $RefreshRuntime$: {
1237 performReactRefresh: () => void;
1238 } | undefined;
1239}
1240//#endregion
1241//#region lib/dom/ssr/single-fetch.d.ts
1242/**
1243 * Describes the operation that initiated an internal router request.
1244 *
1245 * Requests that reload fetchers as part of a navigation, revalidation, or
1246 * initialization redirect keep that initiating `type`. `fetcherKey` identifies
1247 * the fetcher being loaded, or is `null` when the request targets route loaders
1248 * or actions.
1249 *
1250 * `navigationType` is the history action (`"PUSH"`, `"REPLACE"`, or `"POP"`)
1251 * for navigation-initiated data requests, including reloaded fetchers. It is
1252 * `null` for initialization, fetcher, and revalidation requests. Manifest
1253 * requests have no navigation type.
1254 */
1255type RouterFetchContext = {
1256 type: "manifest";
1257} | {
1258 type: "navigation";
1259 fetcherKey: string | null;
1260 navigationType: Action;
1261} | {
1262 type: "initialization" | "fetcher" | "revalidation";
1263 fetcherKey: string | null;
1264 navigationType: null;
1265};
1266type RouterFetch = (request: Request, context: RouterFetchContext) => Promise<Response>;
1267//#endregion
1268//#region lib/dom/ssr/route-discovery.d.ts
1269/** A discovery response from a different build. */
1270type ManifestMismatchEvent = {
1271 source: "eager" | "navigation" | "fetcher" | "imperative";
1272 version: string;
1273 reloadUrl: string | null;
1274 loadAllRoutes(): Promise<void>;
1275 stopPropagation(): void; /** Run built-in recovery for this source, at most once per mismatch event. */
1276 defaultBehavior(): Promise<void>;
1277};
1278/** The result of imperative route discovery. */
1279type DiscoveryResult = {
1280 type: "success";
1281} | {
1282 type: "version-mismatch";
1283} | {
1284 type: "aborted";
1285};
1286/** Options for {@link unstable_useRouteDiscovery}. */
1287type RouteDiscoveryOptions = {
1288 onManifestMismatch?: (event: ManifestMismatchEvent) => void | Promise<void>;
1289};
1290type Registration = {
1291 current: RouteDiscoveryOptions;
1292};
1293type DiscoveryState = "partial" | "loading" | "complete";
1294type RouteDiscoverySsrInfo = {
1295 manifest: AssetsManifest;
1296 routeModules: RouteModules;
1297 router: Router$1 | undefined;
1298 context: Pick<WindowReactRouterContext, "ssr" | "routeDiscovery" | "isSpaMode" | "basename" | "unstable_apiServerOrigin" | "unstable_apiOnly">;
1299};
1300declare class RouteDiscoveryRuntime {
1301 private ssrInfo;
1302 readonly enabled: boolean;
1303 readonly discoveredPaths: Set<string>;
1304 readonly nextPaths: Set<string>;
1305 state: DiscoveryState;
1306 ready: boolean;
1307 private registrations;
1308 private listeners;
1309 private fullLoadErrorListeners;
1310 private fullLoad?;
1311 private loadedManifest?;
1312 private mismatch?;
1313 private fetchImplementation;
1314 private loadManifest;
1315 onError?: ClientOnErrorFunction;
1316 constructor(ssrInfo: RouteDiscoverySsrInfo, {
1317 fetch: fetchImplementation,
1318 loadManifest
1319 }?: {
1320 fetch?: RouterFetch;
1321 loadManifest?: () => Promise<AssetsManifest>;
1322 });
1323 private get router();
1324 private loadManifestAsset;
1325 subscribe: (listener: () => void) => () => void;
1326 private update;
1327 markReady: () => void;
1328 register(registration: Registration): () => void;
1329 private isComplete;
1330 loadAllRoutes: () => Promise<void>;
1331 reportError(error: unknown): void;
1332 private dispatchMismatch;
1333 private requestUrl;
1334 discoverRoutes: (paths: string[], options?: {
1335 signal?: AbortSignal;
1336 }) => Promise<DiscoveryResult>;
1337 discover(paths: string[], source: ManifestMismatchEvent["source"], reloadUrl: string | null, signal?: AbortSignal, patch?: (routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean) => void): Promise<DiscoveryResult>;
1338}
1339//#endregion
1340//#region lib/dom/ssr/entry.d.ts
1341type SerializedError = {
1342 message: string;
1343 stack?: string;
1344};
1345interface FrameworkContextObject {
1346 routeDiscoveryRuntime?: RouteDiscoveryRuntime;
1347 routeDiscoveryState?: DiscoveryState;
1348 manifest: AssetsManifest;
1349 routeModules: RouteModules;
1350 criticalCss?: CriticalCss;
1351 serverHandoffString?: string;
1352 future: FutureConfig$1;
1353 ssr: boolean;
1354 isSpaMode: boolean;
1355 unstable_apiOnly?: boolean;
1356 unstable_apiServerOrigin?: string;
1357 routeDiscovery: ServerBuild["routeDiscovery"];
1358 nonce?: string;
1359 serializeError?(error: Error): SerializedError;
1360 renderMeta?: {
1361 didRenderScripts?: boolean;
1362 streamCache?: Record<number, Promise<void> & {
1363 result?: {
1364 done: boolean;
1365 value: string;
1366 };
1367 error?: unknown;
1368 }>;
1369 };
1370}
1371interface EntryContext extends FrameworkContextObject {
1372 /**
1373 * @deprecated This property was an internal implementation detail and was
1374 * never intended for use in `entry.server.tsx`. It is always an empty array.
1375 */
1376 branches: RouteBranch<DataRouteObject>[];
1377 staticHandlerContext: StaticHandlerContext;
1378 serverHandoffStream?: ReadableStream<Uint8Array>;
1379}
1380interface FutureConfig$1 {
1381 unstable_customRouteDiscovery?: boolean;
1382}
1383type CriticalCss = string | {
1384 rel: "stylesheet";
1385 href: string;
1386};
1387interface AssetsManifest {
1388 entry: {
1389 imports: string[];
1390 module: string;
1391 };
1392 routes: RouteManifest<EntryRoute>;
1393 url: string;
1394 version: string;
1395 hmr?: {
1396 timestamp?: number;
1397 runtime: string;
1398 };
1399 sri?: Record<string, string> | true;
1400}
1401//#endregion
1402//#region lib/server-runtime/routes.d.ts
1403type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
1404interface ServerRoute extends Route$1 {
1405 children: ServerRoute[];
1406 module: ServerRouteModule;
1407}
1408//#endregion
1409//#region lib/server-runtime/build.d.ts
1410type OptionalCriticalCss = CriticalCss | undefined;
1411/**
1412 * The output of the compiler for the server build.
1413 */
1414interface ServerBuild {
1415 entry: {
1416 module: ServerEntryModule;
1417 };
1418 routes: ServerRouteManifest;
1419 assets: AssetsManifest;
1420 basename?: string;
1421 publicPath: string;
1422 assetsBuildDirectory: string;
1423 future: FutureConfig$1;
1424 /**
1425 * Whether runtime server requests are supported, including API-only builds.
1426 */
1427 ssr: boolean;
1428 /**
1429 * The origin to use for server requests in API-only mode.
1430 * @internal
1431 */
1432 unstable_apiServerOrigin?: string;
1433 /**
1434 * Whether production document rendering is disabled while data and route
1435 * discovery requests remain supported.
1436 * @internal
1437 */
1438 unstable_apiOnly?: boolean;
1439 unstable_getCriticalCss?: (args: {
1440 pathname: string;
1441 }) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
1442 /**
1443 * @deprecated This is now done via a custom header during prerendering
1444 */
1445 isSpaMode: boolean;
1446 prerender: string[];
1447 routeDiscovery: {
1448 mode: "lazy" | "initial";
1449 manifestPath: string;
1450 };
1451 allowedActionOrigins?: string[] | false;
1452}
1453interface HandleDocumentRequestFunction {
1454 (request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: RouterContextProvider): Promise<Response> | Response;
1455}
1456interface HandleDataRequestFunction {
1457 (response: Response, args: {
1458 request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
1459 context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
1460 params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
1461 }): Promise<Response> | Response;
1462}
1463interface HandleErrorFunction {
1464 (error: unknown, args: {
1465 request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
1466 context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
1467 params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
1468 }): void;
1469}
1470/**
1471 * A module that serves as the entry point for a Remix app during server
1472 * rendering.
1473 */
1474interface ServerEntryModule {
1475 default: HandleDocumentRequestFunction;
1476 handleDataRequest?: HandleDataRequestFunction;
1477 handleError?: HandleErrorFunction;
1478 instrumentations?: ServerInstrumentation[];
1479 streamTimeout?: number;
1480}
1481//#endregion
1482//#region lib/router/instrumentation.d.ts
1483type ServerInstrumentation = {
1484 handler?: InstrumentRequestHandlerFunction;
1485 route?: InstrumentRouteFunction;
1486};
1487type ClientInstrumentation = {
1488 router?: InstrumentRouterFunction;
1489 route?: InstrumentRouteFunction;
1490};
1491type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
1492type InstrumentRouterFunction = (router: InstrumentableRouter) => void;
1493type InstrumentRouteFunction = (route: InstrumentableRoute) => void;
1494/**
1495 * Route metadata available after React Router has matched an instrumented
1496 * request, navigation, or fetcher call.
1497 */
1498type InstrumentationResultMeta = {
1499 url: LoaderFunctionArgs["url"];
1500 pattern: string;
1501 params: LoaderFunctionArgs["params"];
1502};
1503/**
1504 * Result returned by route-level instrumented handler calls, such as
1505 * instrumented loaders, actions, middleware, and lazy route functions.
1506 */
1507type InstrumentationHandlerResult = {
1508 status: "success";
1509 error: undefined;
1510} | {
1511 status: "error";
1512 error: Error;
1513};
1514/**
1515 * Result returned by client-side router instrumented navigation and fetcher
1516 * calls.
1517 */
1518type InstrumentationClientRouterResult = InstrumentationHandlerResult & {
1519 meta: InstrumentationResultMeta | undefined;
1520};
1521/**
1522 * Result returned by server request handler instrumentation.
1523 */
1524type InstrumentationServerHandlerResult = InstrumentationHandlerResult & {
1525 statusCode: number;
1526 meta: InstrumentationResultMeta | undefined;
1527};
1528type InstrumentFunction<T, TInnerResult = InstrumentationHandlerResult> = (handler: () => Promise<TInnerResult>, info: T) => Promise<void>;
1529type ReadonlyRequest = {
1530 method: string;
1531 url: string;
1532 headers: Pick<Headers, "get">;
1533};
1534type ReadonlyContext = Pick<RouterContextProvider, "get">;
1535type InstrumentableRoute = {
1536 id: string;
1537 index: boolean | undefined;
1538 path: string | undefined;
1539 instrument(instrumentations: RouteInstrumentations): void;
1540};
1541type RouteInstrumentations = {
1542 lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>;
1543 "lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
1544 "lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
1545 "lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
1546 middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
1547 loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
1548 action?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
1549};
1550type RouteLazyInstrumentationInfo = undefined;
1551type RouteHandlerInstrumentationInfo = Readonly<Omit<LoaderFunctionArgs, "request" | "context"> & {
1552 request: ReadonlyRequest;
1553 context: ReadonlyContext;
1554}>;
1555type InstrumentableRouter = {
1556 instrument(instrumentations: RouterInstrumentations): void;
1557};
1558type RouterInstrumentations = {
1559 navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo, InstrumentationClientRouterResult>;
1560 fetch?: InstrumentFunction<RouterFetchInstrumentationInfo, InstrumentationClientRouterResult>;
1561};
1562type RouterNavigationInstrumentationInfo = Readonly<{
1563 to: string | number;
1564 currentUrl: string;
1565 formMethod?: HTMLFormMethod;
1566 formEncType?: FormEncType;
1567 formData?: FormData;
1568 body?: any;
1569}>;
1570type RouterFetchInstrumentationInfo = Readonly<{
1571 href: string;
1572 currentUrl: string;
1573 fetcherKey: string;
1574 formMethod?: HTMLFormMethod;
1575 formEncType?: FormEncType;
1576 formData?: FormData;
1577 body?: any;
1578}>;
1579type InstrumentableRequestHandler = {
1580 instrument(instrumentations: RequestHandlerInstrumentations): void;
1581};
1582type RequestHandlerInstrumentations = {
1583 request?: InstrumentFunction<RequestHandlerInstrumentationInfo, InstrumentationServerHandlerResult>;
1584};
1585type RequestHandlerInstrumentationInfo = Readonly<{
1586 request: ReadonlyRequest;
1587 context: ReadonlyContext | undefined;
1588}>;
1589//#endregion
1590//#region lib/router/router.d.ts
1591/**
1592 * A Router instance manages all navigation and data loading/mutations
1593 */
1594interface Router$1 {
1595 /**
1596 * @private
1597 * PRIVATE - DO NOT USE
1598 *
1599 * Return the basename for the router
1600 */
1601 get basename(): RouterInit["basename"];
1602 /**
1603 * @private
1604 * PRIVATE - DO NOT USE
1605 *
1606 * Return the future config for the router
1607 */
1608 get future(): FutureConfig;
1609 /**
1610 * @private
1611 * PRIVATE - DO NOT USE
1612 *
1613 * Return the current state of the router
1614 */
1615 get state(): RouterState;
1616 /**
1617 * @private
1618 * PRIVATE - DO NOT USE
1619 *
1620 * Return the routes for this router instance
1621 */
1622 get routes(): DataRouteObject[];
1623 /**
1624 * @private
1625 * PRIVATE - DO NOT USE
1626 *
1627 * Match routes against a location using the router's configured route
1628 * matching implementation.
1629 */
1630 match(locationArg: Partial<Location$1> | string): DataRouteMatch[] | null;
1631 /**
1632 * @private
1633 * PRIVATE - DO NOT USE
1634 *
1635 * Return the manifest for this router instance
1636 */
1637 get manifest(): RouteManifest;
1638 /**
1639 * @private
1640 * PRIVATE - DO NOT USE
1641 *
1642 * Return the window associated with the router
1643 */
1644 get window(): RouterInit["window"];
1645 /**
1646 * @private
1647 * PRIVATE - DO NOT USE
1648 *
1649 * Initialize the router, including adding history listeners and kicking off
1650 * initial data fetches. Returns a function to cleanup listeners and abort
1651 * any in-progress loads
1652 */
1653 initialize(): Router$1;
1654 /**
1655 * @private
1656 * PRIVATE - DO NOT USE
1657 *
1658 * Subscribe to router.state updates
1659 *
1660 * @param fn function to call with the new state
1661 */
1662 subscribe(fn: RouterSubscriber): () => void;
1663 /**
1664 * @private
1665 * PRIVATE - DO NOT USE
1666 *
1667 * Enable scroll restoration behavior in the router
1668 *
1669 * @param savedScrollPositions Object that will manage positions, in case
1670 * it's being restored from sessionStorage
1671 * @param getScrollPosition Function to get the active Y scroll position
1672 * @param getKey Function to get the key to use for restoration
1673 */
1674 enableScrollRestoration(savedScrollPositions: Record<string, number>, getScrollPosition: GetScrollPositionFunction, getKey?: GetScrollRestorationKeyFunction): () => void;
1675 /**
1676 * @private
1677 * PRIVATE - DO NOT USE
1678 *
1679 * Navigate forward/backward in the history stack
1680 * @param to Delta to move in the history stack
1681 */
1682 navigate(to: number): Promise<void>;
1683 /**
1684 * Navigate to the given path
1685 * @param to Path to navigate to
1686 * @param opts Navigation options (method, submission, etc.)
1687 */
1688 navigate(to: To | null, opts?: RouterNavigateOptions): Promise<void>;
1689 /**
1690 * @private
1691 * PRIVATE - DO NOT USE
1692 *
1693 * Trigger a fetcher load/submission
1694 *
1695 * @param key Fetcher key
1696 * @param routeId Route that owns the fetcher
1697 * @param href href to fetch
1698 * @param opts Fetcher options, (method, submission, etc.)
1699 */
1700 fetch(key: string, routeId: string, href: string | null, opts?: RouterFetchOptions): Promise<void>;
1701 /**
1702 * @private
1703 * PRIVATE - DO NOT USE
1704 *
1705 * Trigger a revalidation of all current route loaders and fetcher loads
1706 */
1707 revalidate(): Promise<void>;
1708 /**
1709 * @private
1710 * PRIVATE - DO NOT USE
1711 *
1712 * Utility function to create an href for the given location
1713 * @param location
1714 */
1715 createHref(location: Location$1 | URL): string;
1716 /**
1717 * @private
1718 * PRIVATE - DO NOT USE
1719 *
1720 * Utility function to create a URL for the given location
1721 * @param location
1722 */
1723 createURL?(to: To): URL;
1724 /**
1725 * @private
1726 * PRIVATE - DO NOT USE
1727 *
1728 * Utility function to URL encode a destination path according to the internal
1729 * history implementation
1730 * @param to
1731 */
1732 encodeLocation(to: To): Path;
1733 /**
1734 * @private
1735 * PRIVATE - DO NOT USE
1736 *
1737 * Get/create a fetcher for the given key
1738 * @param key
1739 */
1740 getFetcher<TData = any>(key: string): Fetcher<TData>;
1741 /**
1742 * @internal
1743 * PRIVATE - DO NOT USE
1744 *
1745 * Reset the fetcher for a given key
1746 * @param key
1747 */
1748 resetFetcher(key: string, opts?: {
1749 reason?: unknown;
1750 }): void;
1751 /**
1752 * @private
1753 * PRIVATE - DO NOT USE
1754 *
1755 * Delete the fetcher for a given key
1756 * @param key
1757 */
1758 deleteFetcher(key: string): void;
1759 /**
1760 * @private
1761 * PRIVATE - DO NOT USE
1762 *
1763 * Cleanup listeners and abort any in-progress loads
1764 */
1765 dispose(): void;
1766 /**
1767 * @private
1768 * PRIVATE - DO NOT USE
1769 *
1770 * Get a navigation blocker
1771 * @param key The identifier for the blocker
1772 * @param fn The blocker function implementation
1773 */
1774 getBlocker(key: string, fn: BlockerFunction): Blocker;
1775 /**
1776 * @private
1777 * PRIVATE - DO NOT USE
1778 *
1779 * Delete a navigation blocker
1780 * @param key The identifier for the blocker
1781 */
1782 deleteBlocker(key: string): void;
1783 /**
1784 * @private
1785 * PRIVATE DO NOT USE
1786 *
1787 * Patch additional children routes into an existing parent route
1788 * @param routeId The parent route id or a callback function accepting `patch`
1789 * to perform batch patching
1790 * @param children The additional children routes
1791 * @param unstable_allowElementMutations Allow mutation or route elements on
1792 * existing routes. Intended for RSC-usage
1793 * only.
1794 */
1795 patchRoutes(routeId: string | null, children: RouteObject[], unstable_allowElementMutations?: boolean): void;
1796 /**
1797 * @private
1798 * PRIVATE - DO NOT USE
1799 *
1800 * HMR needs to pass in-flight route updates to React Router
1801 * TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute)
1802 */
1803 _internalSetRoutes(routes: RouteObject[]): void;
1804 /**
1805 * @private
1806 * PRIVATE - DO NOT USE
1807 *
1808 * Cause subscribers to re-render. This is used to force a re-render.
1809 */
1810 _internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void;
1811 /**
1812 * @private
1813 * PRIVATE - DO NOT USE
1814 *
1815 * Internal fetch AbortControllers accessed by unit tests
1816 */
1817 _internalFetchControllers: Map<string, AbortController>;
1818}
1819/**
1820 * State maintained internally by the router. During a navigation, all states
1821 * reflect the "old" location unless otherwise noted.
1822 */
1823interface RouterState {
1824 /**
1825 * The action of the most recent navigation
1826 */
1827 historyAction: Action;
1828 /**
1829 * The current location reflected by the router
1830 */
1831 location: Location$1;
1832 /**
1833 * The current set of route matches
1834 */
1835 matches: DataRouteMatch[];
1836 /**
1837 * Tracks whether we've completed our initial data load
1838 */
1839 initialized: boolean;
1840 /**
1841 * Tracks whether we should be rendering a HydrateFallback during hydration
1842 */
1843 renderFallback: boolean;
1844 /**
1845 * Current scroll position we should start at for a new view
1846 * - number -> scroll position to restore to
1847 * - false -> do not restore scroll at all (used during submissions/revalidations)
1848 * - null -> don't have a saved position, scroll to hash or top of page
1849 */
1850 restoreScrollPosition: number | false | null;
1851 /**
1852 * Indicate whether this navigation should skip resetting the scroll position
1853 * if we are unable to restore the scroll position
1854 */
1855 preventScrollReset: boolean;
1856 /**
1857 * Tracks the state of the current navigation
1858 */
1859 navigation: Navigation;
1860 /**
1861 * Tracks any in-progress revalidations
1862 */
1863 revalidation: RevalidationState;
1864 /**
1865 * Data from the loaders for the current matches
1866 */
1867 loaderData: RouteData;
1868 /**
1869 * Data from the action for the current matches
1870 */
1871 actionData: RouteData | null;
1872 /**
1873 * Errors caught from loaders for the current matches
1874 */
1875 errors: RouteData | null;
1876 /**
1877 * Map of current fetchers
1878 */
1879 fetchers: Map<string, Fetcher>;
1880 /**
1881 * Map of current blockers
1882 */
1883 blockers: Map<string, Blocker>;
1884}
1885/**
1886 * Data that can be passed into hydrate a Router from SSR
1887 */
1888type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "errors">>;
1889/**
1890 * Future flags to toggle new feature behavior
1891 */
1892interface FutureConfig {
1893 /** @internal Enables application-controlled Framework route discovery. */
1894 unstable_customRouteDiscovery?: boolean;
1895 /** Enables route-pattern matching after calling `unstable_preloadRoutePattern()`. */
1896 unstable_routePatternMatching?: boolean;
1897}
1898/**
1899 * Initialization options for createRouter
1900 */
1901interface RouterInit {
1902 routes: RouteObject[];
1903 history: History;
1904 basename?: string;
1905 getContext?: () => MaybePromise<RouterContextProvider>;
1906 instrumentations?: ClientInstrumentation[];
1907 mapRouteProperties?: MapRoutePropertiesFunction;
1908 future?: Partial<FutureConfig>;
1909 hydrationRouteProperties?: string[];
1910 hydrationData?: HydrationState;
1911 window?: Window;
1912 dataStrategy?: DataStrategyFunction;
1913 patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
1914}
1915/**
1916 * State returned from a server-side query() call
1917 */
1918interface StaticHandlerContext {
1919 basename: Router$1["basename"];
1920 location: RouterState["location"];
1921 matches: RouterState["matches"];
1922 loaderData: RouterState["loaderData"];
1923 actionData: RouterState["actionData"];
1924 errors: RouterState["errors"];
1925 statusCode: number;
1926 loaderHeaders: Record<string, Headers>;
1927 actionHeaders: Record<string, Headers>;
1928 _deepestRenderedBoundaryId?: string | null;
1929 /** @private */
1930 _match: StaticHandler["match"];
1931}
1932/**
1933 * A StaticHandler instance manages a singular SSR navigation/fetch event
1934 */
1935interface StaticHandler {
1936 /**
1937 * The set of data routes managed by this handler
1938 */
1939 dataRoutes: DataRouteObject[];
1940 /**
1941 * @private
1942 * PRIVATE - DO NOT USE
1943 *
1944 * Match routes against a location using the handler's configured route
1945 * matching implementation.
1946 */
1947 match(locationArg: Partial<Location$1> | string): DataRouteMatch[] | null;
1948 /**
1949 * Perform a query for a given request - executing all matched route
1950 * loaders/actions. Used for document requests.
1951 *
1952 * @param request The request to query
1953 * @param opts Optional query options
1954 * @param opts.dataStrategy Alternate dataStrategy implementation
1955 * @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded
1956 * @param opts.generateMiddlewareResponse To enable middleware, provide a function
1957 * to generate a response to bubble back up the middleware chain
1958 * @param opts.requestContext Context object to pass to loaders/actions
1959 * @param opts.skipLoaderErrorBubbling Skip loader error bubbling
1960 * @param opts.skipRevalidation Skip revalidation after action submission
1961 * @param opts.normalizePath Normalize the request path
1962 */
1963 query(request: Request, opts?: {
1964 requestContext?: unknown;
1965 filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
1966 skipLoaderErrorBubbling?: boolean;
1967 skipRevalidation?: boolean;
1968 dataStrategy?: DataStrategyFunction<unknown>;
1969 generateMiddlewareResponse?: (query: (r: Request, args?: {
1970 filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
1971 }) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
1972 normalizePath?: (request: Request) => Path;
1973 }): Promise<StaticHandlerContext | Response>;
1974 /**
1975 * Perform a query for a specific route. Used for resource requests.
1976 *
1977 * @param request The request to query
1978 * @param opts Optional queryRoute options
1979 * @param opts.dataStrategy Alternate dataStrategy implementation
1980 * @param opts.generateMiddlewareResponse To enable middleware, provide a function
1981 * to generate a response to bubble back up the middleware chain
1982 * @param opts.requestContext Context object to pass to loaders/actions
1983 * @param opts.routeId The ID of the route to query
1984 * @param opts.normalizePath Normalize the request path
1985 */
1986 queryRoute(request: Request, opts?: {
1987 routeId?: string;
1988 requestContext?: unknown;
1989 dataStrategy?: DataStrategyFunction<unknown>;
1990 generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
1991 normalizePath?: (request: Request) => Path;
1992 }): Promise<any>;
1993}
1994type ViewTransitionOpts = {
1995 currentLocation: Location$1;
1996 nextLocation: Location$1;
1997};
1998/**
1999 * Subscriber function signature for changes to router state
2000 */
2001interface RouterSubscriber {
2002 (state: RouterState, opts: {
2003 deletedFetchers: string[];
2004 newErrors: RouteData | null;
2005 viewTransitionOpts?: ViewTransitionOpts;
2006 flushSync: boolean;
2007 }): void;
2008}
2009/**
2010 * Function signature for determining the key to be used in scroll restoration
2011 * for a given location
2012 */
2013interface GetScrollRestorationKeyFunction {
2014 (location: Location$1, matches: UIMatch[]): string | null;
2015}
2016/**
2017 * Function signature for determining the current scroll position
2018 */
2019interface GetScrollPositionFunction {
2020 (): number;
2021}
2022/**
2023 * - "route": relative to the route hierarchy so `..` means remove all segments
2024 * of the current route even if it has many. For example, a `route("posts/:id")`
2025 * would have both `:id` and `posts` removed from the url.
2026 * - "path": relative to the pathname so `..` means remove one segment of the
2027 * pathname. For example, a `route("posts/:id")` would have only `:id` removed
2028 * from the url.
2029 */
2030type RelativeRoutingType = "route" | "path";
2031type BaseNavigateOrFetchOptions = {
2032 preventScrollReset?: boolean;
2033 relative?: RelativeRoutingType;
2034 flushSync?: boolean;
2035 defaultShouldRevalidate?: boolean;
2036};
2037type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
2038 replace?: boolean;
2039 state?: any;
2040 fromRouteId?: string;
2041 /**
2042 * @deprecated Use React's `<ViewTransition>` component instead. See the
2043 * [migration guide](https://reactrouter.com/how-to/view-transitions).
2044 */
2045 viewTransition?: boolean;
2046 mask?: To;
2047};
2048type BaseSubmissionOptions = {
2049 formMethod?: HTMLFormMethod;
2050 formEncType?: FormEncType;
2051} & ({
2052 formData: FormData;
2053 body?: undefined;
2054} | {
2055 formData?: undefined;
2056 body: any;
2057});
2058/**
2059 * Options for a navigate() call for a normal (non-submission) navigation
2060 */
2061type LinkNavigateOptions = BaseNavigateOptions;
2062/**
2063 * Options for a navigate() call for a submission navigation
2064 */
2065type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions;
2066/**
2067 * Options to pass to navigate() for a navigation
2068 */
2069type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions;
2070/**
2071 * Options for a fetch() load
2072 */
2073type LoadFetchOptions = BaseNavigateOrFetchOptions;
2074/**
2075 * Options for a fetch() submission
2076 */
2077type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions;
2078/**
2079 * Options to pass to fetch()
2080 */
2081type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions;
2082/**
2083 * Potential states for state.navigation
2084 */
2085type NavigationStates = {
2086 Idle: {
2087 state: "idle";
2088 location: undefined;
2089 matches: undefined;
2090 historyAction: undefined;
2091 formMethod: undefined;
2092 formAction: undefined;
2093 formEncType: undefined;
2094 formData: undefined;
2095 json: undefined;
2096 text: undefined;
2097 };
2098 Loading: {
2099 state: "loading";
2100 location: Location$1;
2101 matches: DataRouteMatch[];
2102 historyAction: Action;
2103 formMethod: Submission["formMethod"] | undefined;
2104 formAction: Submission["formAction"] | undefined;
2105 formEncType: Submission["formEncType"] | undefined;
2106 formData: Submission["formData"] | undefined;
2107 json: Submission["json"] | undefined;
2108 text: Submission["text"] | undefined;
2109 };
2110 Submitting: {
2111 state: "submitting";
2112 location: Location$1;
2113 matches: DataRouteMatch[];
2114 historyAction: Action;
2115 formMethod: Submission["formMethod"];
2116 formAction: Submission["formAction"];
2117 formEncType: Submission["formEncType"];
2118 formData: Submission["formData"];
2119 json: Submission["json"];
2120 text: Submission["text"];
2121 };
2122};
2123type Navigation = NavigationStates[keyof NavigationStates];
2124type RevalidationState = "idle" | "loading";
2125/**
2126 * Potential states for fetchers
2127 */
2128type FetcherStates<TData = any> = {
2129 /**
2130 * The fetcher is not calling a loader or action
2131 *
2132 * ```tsx
2133 * fetcher.state === "idle"
2134 * ```
2135 */
2136 Idle: {
2137 state: "idle";
2138 formMethod: undefined;
2139 formAction: undefined;
2140 formEncType: undefined;
2141 text: undefined;
2142 formData: undefined;
2143 json: undefined;
2144 /**
2145 * If the fetcher has never been called, this will be undefined.
2146 */
2147 data: TData | undefined;
2148 };
2149 /**
2150 * The fetcher is loading data from a {@link LoaderFunction | loader} from a
2151 * call to {@link FetcherWithComponents.load | `fetcher.load`}.
2152 *
2153 * ```tsx
2154 * // somewhere
2155 * <button onClick={() => fetcher.load("/some/route") }>Load</button>
2156 *
2157 * // the state will update
2158 * fetcher.state === "loading"
2159 * ```
2160 */
2161 Loading: {
2162 state: "loading";
2163 formMethod: Submission["formMethod"] | undefined;
2164 formAction: Submission["formAction"] | undefined;
2165 formEncType: Submission["formEncType"] | undefined;
2166 text: Submission["text"] | undefined;
2167 formData: Submission["formData"] | undefined;
2168 json: Submission["json"] | undefined;
2169 data: TData | undefined;
2170 };
2171 /**
2172 The fetcher is submitting to a {@link LoaderFunction} (GET) or {@link ActionFunction} (POST) from a {@link FetcherWithComponents.Form | `fetcher.Form`} or {@link FetcherWithComponents.submit | `fetcher.submit`}.
2173 ```tsx
2174 // somewhere
2175 <input
2176 onChange={e => {
2177 fetcher.submit(event.currentTarget.form, { method: "post" });
2178 }}
2179 />
2180 // the state will update
2181 fetcher.state === "submitting"
2182 // and formData will be available
2183 fetcher.formData
2184 ```
2185 */
2186 Submitting: {
2187 state: "submitting";
2188 formMethod: Submission["formMethod"];
2189 formAction: Submission["formAction"];
2190 formEncType: Submission["formEncType"];
2191 text: Submission["text"];
2192 formData: Submission["formData"];
2193 json: Submission["json"];
2194 data: TData | undefined;
2195 };
2196};
2197type Fetcher<TData = any> = FetcherStates<TData>[keyof FetcherStates<TData>];
2198interface BlockerBlocked {
2199 state: "blocked";
2200 reset: () => void;
2201 proceed: () => void;
2202 location: Location$1;
2203}
2204interface BlockerUnblocked {
2205 state: "unblocked";
2206 reset: undefined;
2207 proceed: undefined;
2208 location: undefined;
2209}
2210interface BlockerProceeding {
2211 state: "proceeding";
2212 reset: undefined;
2213 proceed: undefined;
2214 location: Location$1;
2215}
2216type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding;
2217type BlockerFunction = (args: {
2218 currentLocation: Location$1;
2219 nextLocation: Location$1;
2220 historyAction: Action;
2221}) => boolean;
2222interface CreateStaticHandlerOptions {
2223 basename?: string;
2224 mapRouteProperties?: MapRoutePropertiesFunction;
2225 instrumentations?: Pick<ServerInstrumentation, "route">[];
2226 future?: Partial<FutureConfig>;
2227}
2228/**
2229 * Create a static handler to perform server-side data loading
2230 *
2231 * @example
2232 * export async function handleRequest(request: Request) {
2233 * let { query, dataRoutes } = createStaticHandler(routes);
2234 * let context = await query(request);
2235 *
2236 * if (context instanceof Response) {
2237 * return context;
2238 * }
2239 *
2240 * let router = createStaticRouter(dataRoutes, context);
2241 * return new Response(
2242 * ReactDOMServer.renderToString(<StaticRouterProvider ... />),
2243 * { headers: { "Content-Type": "text/html" } }
2244 * );
2245 * }
2246 *
2247 * @public
2248 * @category Data Routers
2249 * @mode data
2250 * @param routes The {@link RouteObject | route objects} to create a static
2251 * handler for
2252 * @param opts Options
2253 * @param opts.basename The base URL for the static handler (default: `/`)
2254 * @param opts.future Future flags for the static handler
2255 * @returns A static handler that can be used to query data for the provided
2256 * routes
2257 */
2258declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;
2259//#endregion
2260//#region lib/dom/ssr/routes.d.ts
2261interface Route$1 {
2262 index?: boolean;
2263 caseSensitive?: boolean;
2264 id: string;
2265 parentId?: string;
2266 path?: string;
2267}
2268interface EntryRoute extends Route$1 {
2269 hasAction: boolean;
2270 hasLoader: boolean;
2271 hasClientAction: boolean;
2272 hasClientLoader: boolean;
2273 hasClientMiddleware: boolean;
2274 hasErrorBoundary: boolean;
2275 imports?: string[];
2276 css?: string[];
2277 module: string;
2278 clientActionModule: string | undefined;
2279 clientLoaderModule: string | undefined;
2280 clientMiddlewareModule: string | undefined;
2281 hydrateFallbackModule: string | undefined;
2282 parentId?: string;
2283}
2284//#endregion
2285//#region lib/router/links.d.ts
2286type Primitive = null | undefined | string | number | boolean | symbol | bigint;
2287type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
2288interface HtmlLinkProps {
2289 /**
2290 * Address of the hyperlink
2291 */
2292 href?: string;
2293 /**
2294 * How the element handles crossorigin requests
2295 */
2296 crossOrigin?: "anonymous" | "use-credentials";
2297 /**
2298 * Relationship between the document containing the hyperlink and the destination resource
2299 */
2300 rel: LiteralUnion<"alternate" | "dns-prefetch" | "icon" | "manifest" | "modulepreload" | "next" | "pingback" | "preconnect" | "prefetch" | "preload" | "prerender" | "search" | "stylesheet", string>;
2301 /**
2302 * Applicable media: "screen", "print", "(max-width: 764px)"
2303 */
2304 media?: string;
2305 /**
2306 * Integrity metadata used in Subresource Integrity checks
2307 */
2308 integrity?: string;
2309 /**
2310 * Language of the linked resource
2311 */
2312 hrefLang?: string;
2313 /**
2314 * Hint for the type of the referenced resource
2315 */
2316 type?: string;
2317 /**
2318 * Referrer policy for fetches initiated by the element
2319 */
2320 referrerPolicy?: "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
2321 /**
2322 * Sizes of the icons (for rel="icon")
2323 */
2324 sizes?: string;
2325 /**
2326 * Potential destination for a preload request (for rel="preload" and rel="modulepreload")
2327 */
2328 as?: LiteralUnion<"audio" | "audioworklet" | "document" | "embed" | "fetch" | "font" | "frame" | "iframe" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "serviceworker" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt", string>;
2329 /**
2330 * Color to use when customizing a site's icon (for rel="mask-icon")
2331 */
2332 color?: string;
2333 /**
2334 * Whether the link is disabled
2335 */
2336 disabled?: boolean;
2337 /**
2338 * The title attribute has special semantics on this element: Title of the link; CSS style sheet set name.
2339 */
2340 title?: string;
2341 /**
2342 * Images to use in different situations, e.g., high-resolution displays,
2343 * small monitors, etc. (for rel="preload")
2344 */
2345 imageSrcSet?: string;
2346 /**
2347 * Image sizes for different page layouts (for rel="preload")
2348 */
2349 imageSizes?: string;
2350}
2351interface HtmlLinkPreloadImage extends HtmlLinkProps {
2352 /**
2353 * Relationship between the document containing the hyperlink and the destination resource
2354 */
2355 rel: "preload";
2356 /**
2357 * Potential destination for a preload request (for rel="preload" and rel="modulepreload")
2358 */
2359 as: "image";
2360 /**
2361 * Address of the hyperlink
2362 */
2363 href?: string;
2364 /**
2365 * Images to use in different situations, e.g., high-resolution displays,
2366 * small monitors, etc. (for rel="preload")
2367 */
2368 imageSrcSet: string;
2369 /**
2370 * Image sizes for different page layouts (for rel="preload")
2371 */
2372 imageSizes?: string;
2373}
2374/**
2375 * Represents a `<link>` element.
2376 *
2377 * WHATWG Specification: https://html.spec.whatwg.org/multipage/semantics.html#the-link-element
2378 */
2379type HtmlLinkDescriptor = (HtmlLinkProps & Pick<Required<HtmlLinkProps>, "href">) | (HtmlLinkPreloadImage & Pick<Required<HtmlLinkPreloadImage>, "imageSizes">) | (HtmlLinkPreloadImage & Pick<Required<HtmlLinkPreloadImage>, "href"> & {
2380 imageSizes?: never;
2381});
2382interface PageLinkDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "type" | "sizes" | "imageSrcSet" | "imageSizes" | "as" | "color" | "title"> {
2383 /**
2384 * A [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
2385 * attribute to render on the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
2386 * element. If not provided in Framework Mode, it will default to any
2387 * {@link ServerRouter | `<ServerRouter nonce>`} prop.
2388 */
2389 nonce?: string | undefined;
2390 /**
2391 * The absolute path of the page to prefetch, e.g. `/absolute/path`.
2392 */
2393 page: string;
2394}
2395type LinkDescriptor = HtmlLinkDescriptor | PageLinkDescriptor;
2396//#endregion
2397//#region lib/server-runtime/single-fetch.d.ts
2398type Serializable = undefined | null | boolean | string | symbol | number | Array<Serializable> | {
2399 [key: PropertyKey]: Serializable;
2400} | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>;
2401//#endregion
2402//#region lib/types/utils.d.ts
2403type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
2404type IsAny<T> = 0 extends 1 & T ? true : false;
2405type Func = (...args: any[]) => unknown;
2406//#endregion
2407//#region lib/types/serializes-to.d.ts
2408/**
2409 * A brand that can be applied to a type to indicate that it will serialize
2410 * to a specific type when transported to the client from a loader.
2411 * Only use this if you have additional serialization/deserialization logic
2412 * in your application.
2413 */
2414type unstable_SerializesTo<T> = {
2415 unstable__ReactRouter_SerializesTo: [T];
2416};
2417//#endregion
2418//#region lib/types/route-data.d.ts
2419type Serialize<T> = T extends unstable_SerializesTo<infer To> ? To : T extends Serializable ? T : T extends ((...args: any[]) => unknown) ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? { [K in keyof T]: Serialize<T[K]> } : undefined;
2420type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
2421type DataFrom<T> = IsAny<T> extends true ? undefined : T extends Func ? VoidToUndefined<Awaited<ReturnType<T>>> : undefined;
2422type ClientData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? U : T;
2423type ServerData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? Serialize<U> : Serialize<T>;
2424type ServerDataFrom<T> = ServerData<DataFrom<T>>;
2425type ClientDataFrom<T> = ClientData<DataFrom<T>>;
2426type ClientDataFunctionArgs<Params> = {
2427 /**
2428 * A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the URL, the method, the "content-type" header, and the request body from the request.
2429 *
2430 * @note Because client data functions are called before a network request is made, the Request object does not include the headers which the browser automatically adds. React Router infers the "content-type" header from the enc-type of the form that performed the submission.
2431 **/
2432 request: Request;
2433 /**
2434 * A URL instance representing the application location being navigated to or
2435 * fetched.
2436 *
2437 * In Framework mode, this is a normalized URL with React-Router-specific
2438 * implementation details removed (`.data` suffixes, `index`/`_routes` search
2439 * params). For the raw incoming URL, use `request.url`.
2440 */
2441 url: URL;
2442 /**
2443 * {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
2444 * @example
2445 * // app/routes.ts
2446 * route("teams/:teamId", "./team.tsx"),
2447 *
2448 * // app/team.tsx
2449 * export function clientLoader({
2450 * params,
2451 * }: Route.ClientLoaderArgs) {
2452 * params.teamId;
2453 * // ^ string
2454 * }
2455 **/
2456 params: Params;
2457 /**
2458 * Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
2459 * Mostly useful as a identifier to aggregate on for logging/tracing/etc.
2460 */
2461 pattern: string;
2462 /**
2463 * An instance of `RouterContextProvider` that can be used to access context
2464 * values from your route middlewares. You may pass in initial context values
2465 * in your `<HydratedRouter getContext>` prop.
2466 */
2467 context: Readonly<RouterContextProvider>;
2468};
2469type SerializeFrom<T> = T extends ((...args: infer Args) => unknown) ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs | ClientDataFunctionArgs<unknown>] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
2470//#endregion
2471//#region lib/dom/ssr/routeModules.d.ts
2472interface RouteModules {
2473 [routeId: string]: RouteModule | undefined;
2474}
2475/**
2476 * The shape of a route module shipped to the client
2477 */
2478interface RouteModule {
2479 clientAction?: ClientActionFunction;
2480 clientLoader?: ClientLoaderFunction;
2481 clientMiddleware?: MiddlewareFunction<Record<string, DataStrategyResult>>[];
2482 ErrorBoundary?: ErrorBoundaryComponent;
2483 HydrateFallback?: HydrateFallbackComponent;
2484 Layout?: LayoutComponent;
2485 default: RouteComponent;
2486 handle?: RouteHandle;
2487 links?: LinksFunction;
2488 meta?: MetaFunction;
2489 shouldRevalidate?: ShouldRevalidateFunction;
2490}
2491/**
2492 * The shape of a route module on the server
2493 */
2494interface ServerRouteModule extends RouteModule {
2495 action?: ActionFunction;
2496 headers?: HeadersFunction | {
2497 [name: string]: string;
2498 };
2499 loader?: LoaderFunction;
2500 middleware?: MiddlewareFunction<Response>[];
2501}
2502/**
2503 * A function that handles data mutations for a route on the client
2504 */
2505type ClientActionFunction = (args: ClientActionFunctionArgs) => ReturnType<ActionFunction>;
2506/**
2507 * Arguments passed to a route `clientAction` function
2508 */
2509type ClientActionFunctionArgs = ActionFunctionArgs & {
2510 serverAction: <T = unknown>() => Promise<SerializeFrom<T>>;
2511};
2512/**
2513 * A function that loads data for a route on the client
2514 */
2515type ClientLoaderFunction = ((args: ClientLoaderFunctionArgs) => ReturnType<LoaderFunction>) & {
2516 hydrate?: boolean;
2517};
2518/**
2519 * Arguments passed to a route `clientLoader` function
2520 */
2521type ClientLoaderFunctionArgs = LoaderFunctionArgs & {
2522 serverLoader: <T = unknown>() => Promise<SerializeFrom<T>>;
2523};
2524/**
2525 * ErrorBoundary to display for this route
2526 */
2527type ErrorBoundaryComponent = ComponentType;
2528type HeadersArgs = {
2529 loaderHeaders: Headers;
2530 parentHeaders: Headers;
2531 actionHeaders: Headers;
2532 errorHeaders: Headers | undefined;
2533};
2534/**
2535 * A function that returns HTTP headers to be used for a route. These headers
2536 * will be merged with (and take precedence over) headers from parent routes.
2537 */
2538interface HeadersFunction {
2539 (args: HeadersArgs): Headers | HeadersInit;
2540}
2541/**
2542 * `<Route HydrateFallback>` component to render on initial loads
2543 * when client loaders are present
2544 */
2545type HydrateFallbackComponent = ComponentType;
2546/**
2547 * Optional, root-only `<Route Layout>` component to wrap the root content in.
2548 * Useful for defining the <html>/<head>/<body> document shell shared by the
2549 * Component, HydrateFallback, and ErrorBoundary
2550 */
2551type LayoutComponent = ComponentType<{
2552 children: ReactElement<unknown, ErrorBoundaryComponent | HydrateFallbackComponent | RouteComponent>;
2553}>;
2554/**
2555 * A function that defines `<link>` tags to be inserted into the `<head>` of
2556 * the document on route transitions.
2557 *
2558 * @see https://reactrouter.com/start/framework/route-module#meta
2559 */
2560interface LinksFunction {
2561 (): LinkDescriptor[];
2562}
2563interface MetaMatch<RouteId extends string = string, Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown> {
2564 id: RouteId;
2565 pathname: DataRouteMatch["pathname"];
2566 loaderData: Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown;
2567 handle?: RouteHandle;
2568 params: DataRouteMatch["params"];
2569 meta: MetaDescriptor[];
2570 error?: unknown;
2571}
2572type MetaMatches<MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> = Array<{ [K in keyof MatchLoaders]: MetaMatch<Exclude<K, number | symbol>, MatchLoaders[K]> }[keyof MatchLoaders]>;
2573interface MetaArgs<Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown, MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> {
2574 loaderData: (Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown) | undefined;
2575 params: Params;
2576 location: Location$1;
2577 matches: MetaMatches<MatchLoaders>;
2578 error?: unknown;
2579}
2580/**
2581 * A function that returns an array of data objects to use for rendering
2582 * metadata HTML tags in a route. These tags are not rendered on descendant
2583 * routes in the route hierarchy. In other words, they will only be rendered on
2584 * the route in which they are exported.
2585 *
2586 * @param Loader - The type of the current route's loader function
2587 * @param MatchLoaders - Mapping from a parent route's filepath to its loader
2588 * function type
2589 *
2590 * Note that parent route filepaths are relative to the `app/` directory.
2591 *
2592 * For example, if this meta function is for `/sales/customers/$customerId`:
2593 *
2594 * ```ts
2595 * // app/root.tsx
2596 * const loader = () => ({ hello: "world" })
2597 * export type Loader = typeof loader
2598 *
2599 * // app/routes/sales.tsx
2600 * const loader = () => ({ salesCount: 1074 })
2601 * export type Loader = typeof loader
2602 *
2603 * // app/routes/sales/customers.tsx
2604 * const loader = () => ({ customerCount: 74 })
2605 * export type Loader = typeof loader
2606 *
2607 * // app/routes/sales/customers/$customersId.tsx
2608 * import type { Loader as RootLoader } from "../../../root"
2609 * import type { Loader as SalesLoader } from "../../sales"
2610 * import type { Loader as CustomersLoader } from "../../sales/customers"
2611 *
2612 * const loader = () => ({ name: "Customer name" })
2613 *
2614 * const meta: MetaFunction<typeof loader, {
2615 * "root": RootLoader,
2616 * "routes/sales": SalesLoader,
2617 * "routes/sales/customers": CustomersLoader,
2618 * }> = ({ loaderData, matches }) => {
2619 * const { name } = loaderData
2620 * // ^? string
2621 * const { customerCount } = matches.find((match) => match.id === "routes/sales/customers").loaderData
2622 * // ^? number
2623 * const { salesCount } = matches.find((match) => match.id === "routes/sales").loaderData
2624 * // ^? number
2625 * const { hello } = matches.find((match) => match.id === "root").loaderData
2626 * // ^? "world"
2627 * }
2628 * ```
2629 */
2630interface MetaFunction<Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown, MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> {
2631 (args: MetaArgs<Loader, MatchLoaders>): MetaDescriptor[] | undefined;
2632}
2633type MetaDescriptor = {
2634 charSet: "utf-8";
2635} | {
2636 title: string;
2637} | {
2638 name: string;
2639 content: string;
2640} | {
2641 property: string;
2642 content: string;
2643} | {
2644 httpEquiv: string;
2645 content: string;
2646} | {
2647 "script:ld+json": LdJsonObject | LdJsonObject[];
2648} | {
2649 tagName: "meta" | "link";
2650 [name: string]: string;
2651} | {
2652 [name: string]: unknown;
2653};
2654type LdJsonObject = { [Key in string]: LdJsonValue } & { [Key in string]?: LdJsonValue | undefined };
2655type LdJsonArray = LdJsonValue[] | readonly LdJsonValue[];
2656type LdJsonPrimitive = string | number | boolean | null;
2657type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray;
2658/**
2659 * A React component that is rendered for a route.
2660 */
2661type RouteComponent = ComponentType<{}>;
2662/**
2663 * An arbitrary object that is associated with a route.
2664 *
2665 * @see https://reactrouter.com/how-to/using-handle
2666 */
2667type RouteHandle = unknown;
2668//#endregion
2669//#region lib/rsc/server.rsc.d.ts
2670declare function getRequest(): Request;
2671declare const redirect: typeof redirect$1;
2672declare const redirectDocument: typeof redirectDocument$1;
2673declare const replace$1: typeof replace$2;
2674declare const Await: typeof Await$1;
2675type RSCRouteConfigEntryBase = {
2676 action?: ActionFunction;
2677 clientAction?: ClientActionFunction;
2678 clientLoader?: ClientLoaderFunction;
2679 ErrorBoundary?: React.ComponentType<any>;
2680 handle?: any;
2681 headers?: HeadersFunction;
2682 HydrateFallback?: React.ComponentType<any>;
2683 Layout?: React.ComponentType<any>;
2684 links?: LinksFunction;
2685 loader?: LoaderFunction;
2686 meta?: MetaFunction;
2687 middleware?: MiddlewareFunction<any>[];
2688 shouldRevalidate?: ShouldRevalidateFunction;
2689};
2690type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
2691 id: string;
2692 path?: string;
2693 Component?: React.ComponentType<any>;
2694 lazy?: () => Promise<RSCRouteConfigEntryBase & ({
2695 default?: React.ComponentType<any>;
2696 Component?: never;
2697 } | {
2698 default?: never;
2699 Component?: React.ComponentType<any>;
2700 })>;
2701} & ({
2702 index: true;
2703} | {
2704 children?: RSCRouteConfigEntry[];
2705});
2706type RSCRouteConfig = Array<RSCRouteConfigEntry>;
2707type RSCRouteManifest = {
2708 clientAction?: ClientActionFunction;
2709 clientLoader?: ClientLoaderFunction;
2710 element?: React.ReactElement | false;
2711 errorElement?: React.ReactElement;
2712 handle?: any;
2713 hasAction: boolean;
2714 hasComponent: boolean;
2715 hasLoader: boolean;
2716 hydrateFallbackElement?: React.ReactElement;
2717 id: string;
2718 index?: boolean;
2719 links?: LinksFunction;
2720 meta?: MetaFunction;
2721 parentId?: string;
2722 path?: string;
2723 shouldRevalidate?: ShouldRevalidateFunction;
2724};
2725type RSCRouteMatch = RSCRouteManifest & {
2726 params: Params;
2727 pathname: string;
2728 pathnameBase: string;
2729};
2730type RSCRenderPayload = {
2731 type: "render";
2732 actionData: Record<string, any> | null;
2733 basename: string | undefined;
2734 clientVersion?: string;
2735 errors: Record<string, any> | null;
2736 loaderData: Record<string, any>;
2737 location: Location$1;
2738 routeDiscovery: RouteDiscovery;
2739 matches: RSCRouteMatch[];
2740 patches?: Promise<RSCRouteManifest[]>;
2741 formState?: ReactFormState;
2742};
2743type RSCManifestPayload = {
2744 type: "manifest";
2745 patches: Promise<RSCRouteManifest[]>;
2746};
2747type RSCActionPayload = {
2748 type: "action";
2749 actionResult: Promise<unknown>;
2750 rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
2751};
2752type RSCRedirectPayload = {
2753 type: "redirect";
2754 status: number;
2755 location: string;
2756 replace: boolean;
2757 reload: boolean;
2758 actionResult?: Promise<unknown>;
2759};
2760type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
2761type RSCMatch = {
2762 statusCode: number;
2763 headers: Headers;
2764 payload: RSCPayload;
2765};
2766type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
2767type DecodeFormStateFunction = (result: unknown, formData: FormData) => Promise<ReactFormState | undefined>;
2768type DecodeReplyFunction = (reply: FormData | string, options: {
2769 temporaryReferences: unknown;
2770}) => Promise<unknown[]>;
2771type LoadServerActionFunction = (id: string) => Promise<Function>;
2772type RouteDiscovery = {
2773 mode: "lazy";
2774 manifestPath?: string | undefined;
2775} | {
2776 mode: "initial";
2777};
2778/**
2779 * Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
2780 * and returns an [RSC](https://react.dev/reference/rsc/server-components)
2781 * [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
2782 * encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components)
2783 * enabled client router.
2784 *
2785 * Treat every React Server Function as a public endpoint. Server Functions are
2786 * not inherently associated with a route. Any route middleware that runs is
2787 * selected from the URL used to call a Server Function, but the client controls
2788 * both the Server Function identifier and the URL. Perform all access control
2789 * checks within each Server Function, or use a route action for
2790 * middleware-driven access control.
2791 *
2792 * @example
2793 * import {
2794 * createTemporaryReferenceSet,
2795 * decodeAction,
2796 * decodeReply,
2797 * loadServerAction,
2798 * renderToReadableStream,
2799 * } from "@vitejs/plugin-rsc/rsc";
2800 * import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
2801 *
2802 * matchRSCServerRequest({
2803 * createTemporaryReferenceSet,
2804 * decodeAction,
2805 * decodeFormState,
2806 * decodeReply,
2807 * loadServerAction,
2808 * request,
2809 * routes: routes(),
2810 * generateResponse(match) {
2811 * return new Response(
2812 * renderToReadableStream(match.payload),
2813 * {
2814 * status: match.statusCode,
2815 * headers: match.headers,
2816 * }
2817 * );
2818 * },
2819 * });
2820 *
2821 * @name unstable_matchRSCServerRequest
2822 * @public
2823 * @category RSC
2824 * @mode data
2825 * @param opts Options
2826 * @param opts.allowedActionOrigins Origin patterns that are allowed to execute actions.
2827 * @param opts.basename The basename to use when matching the request.
2828 * @param opts.createTemporaryReferenceSet A function that returns a temporary
2829 * reference set for the request, used to track temporary references in the [RSC](https://react.dev/reference/rsc/server-components)
2830 * stream.
2831 * @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
2832 * function, responsible for loading a server action.
2833 * @param opts.decodeFormState A function responsible for decoding form state for
2834 * progressively enhanceable forms with React's [`useActionState`](https://react.dev/reference/react/useActionState)
2835 * using your `react-server-dom-xyz/server`'s `decodeFormState`.
2836 * @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
2837 * function, used to decode the server function's arguments and bind them to the
2838 * implementation for invocation by the router.
2839 * @param opts.generateResponse A function responsible for using your
2840 * `renderToReadableStream` to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
2841 * encoding the {@link unstable_RSCPayload}.
2842 * @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
2843 * `loadServerAction` function, used to load a server action by ID.
2844 * @param opts.clientVersion A version derived from the client build output used
2845 * to detect stale clients during lazy route discovery.
2846 * @param opts.onError An optional error handler that will be called with any
2847 * errors that occur during the request processing.
2848 * @param opts.request The [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
2849 * to match against.
2850 * @param opts.requestContext An instance of {@link RouterContextProvider}
2851 * that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s,
2852 * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
2853 * @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations.
2854 * @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}.
2855 * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
2856 * that contains the [RSC](https://react.dev/reference/rsc/server-components)
2857 * data for hydration.
2858 */
2859declare function matchRSCServerRequest({
2860 allowedActionOrigins,
2861 createTemporaryReferenceSet,
2862 basename,
2863 decodeReply,
2864 requestContext,
2865 routeDiscovery,
2866 loadServerAction,
2867 decodeAction,
2868 decodeFormState,
2869 clientVersion,
2870 onError,
2871 request,
2872 routes,
2873 generateResponse: encodeResponse
2874}: {
2875 allowedActionOrigins?: string[];
2876 createTemporaryReferenceSet: () => unknown;
2877 basename?: string;
2878 decodeReply?: DecodeReplyFunction;
2879 decodeAction?: DecodeActionFunction;
2880 decodeFormState?: DecodeFormStateFunction;
2881 requestContext?: RouterContextProvider;
2882 loadServerAction?: LoadServerActionFunction;
2883 clientVersion?: string;
2884 onError?: (error: unknown) => void;
2885 request: Request;
2886 routes: RSCRouteConfigEntry[];
2887 routeDiscovery?: RouteDiscovery;
2888 generateResponse: (match: RSCMatch, {
2889 onError,
2890 temporaryReferences
2891 }: {
2892 onError(error: unknown): string | undefined;
2893 temporaryReferences: unknown;
2894 }) => Response;
2895}): Promise<Response>;
2896//#endregion
2897//#region lib/types/register.d.ts
2898/**
2899 * Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
2900 * React Router should handle this for you via type generation.
2901 *
2902 * For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
2903 */
2904interface Register {}
2905type AnyParams = Record<string, string | undefined>;
2906type AnyPages = Record<string, {
2907 params: AnyParams;
2908}>;
2909type Pages = Register extends {
2910 pages: infer Registered extends AnyPages;
2911} ? Registered : AnyPages;
2912//#endregion
2913//#region lib/href.d.ts
2914type Args = { [K in keyof Pages]: ToArgs<Pages[K]["params"]> };
2915type ToArgs<Params extends Record<string, string | undefined>> = Equal<Params, {}> extends true ? [] : Partial<Params> extends Params ? [Params] | [] : [Params];
2916/**
2917 * Returns a resolved URL path for the specified route.
2918 *
2919 * Param values are percent-encoded for use in a path segment: characters that
2920 * would change the URL structure (`/`, `?`, `#`, `%`, whitespace, non-ASCII)
2921 * are escaped, while characters that RFC 3986 allows literally in a path
2922 * segment (`$ & + , ; = : @`) are kept as-is. Note this differs from query-string
2923 * encoding (`encodeURIComponent`/`URLSearchParams`), where those characters are
2924 * delimiters and must be escaped. Splat (`*`) values are encoded per segment,
2925 * preserving `/` separators.
2926 *
2927 * See [RFC 3986 §3.3](https://datatracker.ietf.org/doc/html/rfc3986#section-3.3)
2928 *
2929 * @example
2930 * const h = href("/:lang?/about", { lang: "en" })
2931 * // -> `/en/about`
2932 *
2933 * <Link to={href("/products/:id", { id: "abc123" })} />
2934 *
2935 * @public
2936 * @category Utils
2937 * @mode framework
2938 * @param path The route path to resolve
2939 * @param args The route params to use when resolving the path
2940 * @returns The resolved URL path
2941 */
2942declare function href<Path extends keyof Args>(path: Path, ...args: Args[Path]): string;
2943//#endregion
2944//#region lib/server-runtime/cookies.d.ts
2945interface CookieSignatureOptions {
2946 /**
2947 * An array of secrets that may be used to sign/unsign the value of a cookie.
2948 *
2949 * The array makes it easy to rotate secrets. New secrets should be added to
2950 * the beginning of the array. `cookie.serialize()` will always use the first
2951 * value in the array, but `cookie.parse()` may use any of them so that
2952 * cookies that were signed with older secrets still work.
2953 */
2954 secrets?: string[];
2955}
2956type CookieOptions = CookieParseOptions & CookieSerializeOptions & CookieSignatureOptions;
2957/**
2958 * A HTTP cookie.
2959 *
2960 * A Cookie is a logical container for metadata about a HTTP cookie; its name
2961 * and options. But it doesn't contain a value. Instead, it has `parse()` and
2962 * `serialize()` methods that allow a single instance to be reused for
2963 * parsing/encoding multiple different values.
2964 *
2965 * @see https://remix.run/utils/cookies#cookie-api
2966 */
2967interface Cookie {
2968 /**
2969 * The name of the cookie, used in the `Cookie` and `Set-Cookie` headers.
2970 */
2971 readonly name: string;
2972 /**
2973 * True if this cookie uses one or more secrets for verification.
2974 */
2975 readonly isSigned: boolean;
2976 /**
2977 * The Date this cookie expires.
2978 *
2979 * Note: This is calculated at access time using `maxAge` when no `expires`
2980 * option is provided to `createCookie()`.
2981 */
2982 readonly expires?: Date;
2983 /**
2984 * Parses a raw `Cookie` header and returns the value of this cookie or
2985 * `null` if it's not present.
2986 */
2987 parse(cookieHeader: string | null, options?: CookieParseOptions): Promise<any>;
2988 /**
2989 * Serializes the given value to a string and returns the `Set-Cookie`
2990 * header.
2991 */
2992 serialize(value: any, options?: CookieSerializeOptions): Promise<string>;
2993}
2994/**
2995 * Creates a logical container for managing a browser cookie from the server.
2996 *
2997 * @public
2998 * @category Utils
2999 * @mode framework
3000 * @mode data
3001 * @param name The name of the cookie.
3002 * @param cookieOptions Options for parsing and serializing the cookie.
3003 * @returns A {@link Cookie} object for parsing and serializing the cookie.
3004 */
3005declare const createCookie: (name: string, cookieOptions?: CookieOptions) => Cookie;
3006/**
3007 * A function that determines whether a value is a React Router {@link Cookie}
3008 * object.
3009 *
3010 * @public
3011 * @category Utils
3012 * @mode framework
3013 * @mode data
3014 * @param object The value to check.
3015 * @returns `true` if the value is a React Router {@link Cookie} object;
3016 * otherwise, `false`.
3017 */
3018type IsCookieFunction = (object: any) => object is Cookie;
3019/**
3020 * Returns `true` if a value is a React Router {@link Cookie} object.
3021 *
3022 * @public
3023 * @category Utils
3024 * @mode framework
3025 * @mode data
3026 * @param object The value to check.
3027 * @returns `true` if the value is a React Router {@link Cookie} object;
3028 * otherwise, `false`.
3029 */
3030declare const isCookie: IsCookieFunction;
3031//#endregion
3032//#region lib/server-runtime/sessions.d.ts
3033/**
3034 * An object of name/value pairs to be used in the session.
3035 */
3036interface SessionData {
3037 [name: string]: any;
3038}
3039/**
3040 * Session persists data across HTTP requests.
3041 *
3042 * @see https://reactrouter.com/explanation/sessions-and-cookies#sessions
3043 */
3044interface Session<Data = SessionData, FlashData = Data> {
3045 /**
3046 * A unique identifier for this session.
3047 *
3048 * Note: This will be the empty string for newly created sessions and
3049 * sessions that are not backed by a database (i.e. cookie-based sessions).
3050 */
3051 readonly id: string;
3052 /**
3053 * The raw data contained in this session.
3054 *
3055 * This is useful mostly for SessionStorage internally to access the raw
3056 * session data to persist.
3057 */
3058 readonly data: FlashSessionData<Data, FlashData>;
3059 /**
3060 * Returns `true` if the session has a value for the given `name`, `false`
3061 * otherwise.
3062 */
3063 has(name: (keyof Data | keyof FlashData) & string): boolean;
3064 /**
3065 * Returns the value for the given `name` in this session.
3066 */
3067 get<Key extends (keyof Data | keyof FlashData) & string>(name: Key): (Key extends keyof Data ? Data[Key] : undefined) | (Key extends keyof FlashData ? FlashData[Key] : undefined) | undefined;
3068 /**
3069 * Sets a value in the session for the given `name`.
3070 */
3071 set<Key extends keyof Data & string>(name: Key, value: Data[Key]): void;
3072 /**
3073 * Sets a value in the session that is only valid until the next `get()`.
3074 * This can be useful for temporary values, like error messages.
3075 */
3076 flash<Key extends keyof FlashData & string>(name: Key, value: FlashData[Key]): void;
3077 /**
3078 * Removes a value from the session.
3079 */
3080 unset(name: keyof Data & string): void;
3081}
3082type FlashSessionData<Data, FlashData> = Partial<Data & { [Key in keyof FlashData as FlashDataKey<Key & string>]: FlashData[Key] }>;
3083type FlashDataKey<Key extends string> = `__flash_${Key}__`;
3084type CreateSessionFunction = <Data = SessionData, FlashData = Data>(initialData?: Data, id?: string) => Session<Data, FlashData>;
3085/**
3086 * Creates a new Session object.
3087 *
3088 * Note: This function is typically not invoked directly by application code.
3089 * Instead, use a `SessionStorage` object's `getSession` method.
3090 *
3091 * @category Utils
3092 * @param initialData The initial data for the session.
3093 * @param id The identifier for the session. Defaults to an empty string for a
3094 * new session.
3095 * @returns A new {@link Session} object.
3096 */
3097declare const createSession: CreateSessionFunction;
3098/**
3099 * A function that determines whether a value is a React Router {@link Session}
3100 * object.
3101 *
3102 * @public
3103 * @category Utils
3104 * @mode framework
3105 * @mode data
3106 * @param object The value to check.
3107 * @returns `true` if the value is a React Router {@link Session} object;
3108 * otherwise, `false`.
3109 */
3110type IsSessionFunction = (object: any) => object is Session;
3111/**
3112 * Returns `true` if a value is a React Router {@link Session} object.
3113 *
3114 * @public
3115 * @category Utils
3116 * @mode framework
3117 * @mode data
3118 * @param object The value to check.
3119 * @returns `true` if the value is a React Router {@link Session} object;
3120 * otherwise, `false`.
3121 */
3122declare const isSession: IsSessionFunction;
3123/**
3124 * SessionStorage stores session data between HTTP requests and knows how to
3125 * parse and create cookies.
3126 *
3127 * A SessionStorage creates Session objects using a `Cookie` header as input.
3128 * Then, later it generates the `Set-Cookie` header to be used in the response.
3129 */
3130interface SessionStorage<Data = SessionData, FlashData = Data> {
3131 /**
3132 * Parses a Cookie header from a HTTP request and returns the associated
3133 * Session. If there is no session associated with the cookie, this will
3134 * return a new Session with no data.
3135 */
3136 getSession: (cookieHeader?: string | null, options?: CookieParseOptions$1) => Promise<Session<Data, FlashData>>;
3137 /**
3138 * Stores all data in the Session and returns the Set-Cookie header to be
3139 * used in the HTTP response.
3140 */
3141 commitSession: (session: Session<Data, FlashData>, options?: CookieSerializeOptions$1) => Promise<string>;
3142 /**
3143 * Deletes all data associated with the Session and returns the Set-Cookie
3144 * header to be used in the HTTP response.
3145 */
3146 destroySession: (session: Session<Data, FlashData>, options?: CookieSerializeOptions$1) => Promise<string>;
3147}
3148/**
3149 * SessionIdStorageStrategy is designed to allow anyone to easily build their
3150 * own SessionStorage using `createSessionStorage(strategy)`.
3151 *
3152 * This strategy describes a common scenario where the session id is stored in
3153 * a cookie but the actual session data is stored elsewhere, usually in a
3154 * database or on disk. A set of create, read, update, and delete operations
3155 * are provided for managing the session data.
3156 */
3157interface SessionIdStorageStrategy<Data = SessionData, FlashData = Data> {
3158 /**
3159 * The Cookie used to store the session id, or options used to automatically
3160 * create one.
3161 */
3162 cookie?: Cookie | (CookieOptions & {
3163 name?: string;
3164 });
3165 /**
3166 * Creates a new record with the given data and returns the session id.
3167 */
3168 createData: (data: FlashSessionData<Data, FlashData>, expires?: Date) => Promise<string>;
3169 /**
3170 * Returns data for a given session id, or `null` if there isn't any.
3171 */
3172 readData: (id: string) => Promise<FlashSessionData<Data, FlashData> | null>;
3173 /**
3174 * Updates data for the given session id.
3175 */
3176 updateData: (id: string, data: FlashSessionData<Data, FlashData>, expires?: Date) => Promise<void>;
3177 /**
3178 * Deletes data for a given session id from the data store.
3179 */
3180 deleteData: (id: string) => Promise<void>;
3181}
3182/**
3183 * Creates a SessionStorage object using a SessionIdStorageStrategy.
3184 *
3185 * Note: This is a low-level API that should only be used if none of the
3186 * existing session storage options meet your requirements.
3187 *
3188 * @category Utils
3189 * @param strategy The strategy used to store session identifiers and data.
3190 * @returns A {@link SessionStorage} object that persists session data using the
3191 * provided strategy.
3192 */
3193declare function createSessionStorage<Data = SessionData, FlashData = Data>({
3194 cookie: cookieArg,
3195 createData,
3196 readData,
3197 updateData,
3198 deleteData
3199}: SessionIdStorageStrategy<Data, FlashData>): SessionStorage<Data, FlashData>;
3200//#endregion
3201//#region lib/server-runtime/sessions/cookieStorage.d.ts
3202interface CookieSessionStorageOptions {
3203 /**
3204 * The Cookie used to store the session data on the client, or options used
3205 * to automatically create one.
3206 */
3207 cookie?: SessionIdStorageStrategy["cookie"];
3208}
3209/**
3210 * Creates and returns a SessionStorage object that stores all session data
3211 * directly in the session cookie itself.
3212 *
3213 * This has the advantage that no database or other backend services are
3214 * needed, and can help to simplify some load-balanced scenarios. However, it
3215 * also has the limitation that serialized session data may not exceed the
3216 * browser's maximum cookie size. Trade-offs!
3217 *
3218 * @public
3219 * @category Utils
3220 * @mode framework
3221 * @mode data
3222 * @param options Options for creating the cookie-backed session storage.
3223 * @returns A {@link SessionStorage} object that stores all session data in its
3224 * cookie.
3225 */
3226declare function createCookieSessionStorage<Data = SessionData, FlashData = Data>({
3227 cookie: cookieArg
3228}?: CookieSessionStorageOptions): SessionStorage<Data, FlashData>;
3229//#endregion
3230//#region lib/server-runtime/sessions/memoryStorage.d.ts
3231interface MemorySessionStorageOptions {
3232 /**
3233 * The Cookie used to store the session id on the client, or options used
3234 * to automatically create one.
3235 */
3236 cookie?: SessionIdStorageStrategy["cookie"];
3237}
3238/**
3239 * Creates and returns a simple in-memory SessionStorage object.
3240 *
3241 * Intended for local development and testing. It does not scale beyond a single
3242 * process, and all session data is lost when the server process stops/restarts.
3243 *
3244 * @public
3245 * @category Utils
3246 * @mode framework
3247 * @mode data
3248 * @param options Options for creating the in-memory session storage.
3249 * @returns A {@link SessionStorage} object that stores session data in memory.
3250 */
3251declare function createMemorySessionStorage<Data = SessionData, FlashData = Data>({
3252 cookie
3253}?: MemorySessionStorageOptions): SessionStorage<Data, FlashData>;
3254//#endregion
3255export { Await, BrowserRouter, type Cookie, type CookieOptions, type CookieParseOptions, type CookieSerializeOptions, type CookieSignatureOptions, type FlashSessionData, Form, HashRouter, type IsCookieFunction, type IsSessionFunction, Link, Links, MemoryRouter, Meta, type MiddlewareFunction, type MiddlewareNextFunction, NavLink, Navigate, Outlet, Route, Router, type RouterContext, RouterContextProvider, RouterProvider, Routes, ScrollRestoration, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, StaticRouter, StaticRouterProvider, createContext, createCookie, createCookieSessionStorage, createMemorySessionStorage, createSession, createSessionStorage, createStaticHandler, data, href, isCookie, isRouteErrorResponse, isSession, matchRoutes, redirect, redirectDocument, replace$1 as replace, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, unstable_HistoryRouter, type LoadServerActionFunction as unstable_LoadServerActionFunction, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCMatch as unstable_RSCMatch, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RSCRouteConfig as unstable_RSCRouteConfig, type RSCRouteConfigEntry as unstable_RSCRouteConfigEntry, type RSCRouteManifest as unstable_RSCRouteManifest, type RSCRouteMatch as unstable_RSCRouteMatch, getRequest as unstable_getRequest, matchRSCServerRequest as unstable_matchRSCServerRequest };
\No newline at end of file