react-router 7.0.0-pre.2 → 7.0.0-pre.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/chunk-3AAHPOYG.mjs +9617 -0
  3. package/dist/dom-export.d.mts +13 -0
  4. package/dist/dom-export.d.ts +13 -3
  5. package/dist/dom-export.js +5502 -0
  6. package/dist/dom-export.mjs +112 -126
  7. package/dist/{lib/dom/lib.d.ts → fog-of-war-BijhfqFM.d.ts} +699 -45
  8. package/dist/fog-of-war-Bz_EDtxF.d.mts +1595 -0
  9. package/dist/index.d.mts +839 -0
  10. package/dist/index.d.ts +839 -73
  11. package/dist/index.js +9763 -0
  12. package/dist/index.mjs +225 -12689
  13. package/dist/lib/types.d.mts +2 -0
  14. package/dist/lib/types.d.ts +2 -83
  15. package/dist/lib/types.js +28 -0
  16. package/dist/lib/types.mjs +1 -1
  17. package/dist/types-BlYP8xpH.d.mts +1620 -0
  18. package/dist/types-BlYP8xpH.d.ts +1620 -0
  19. package/package.json +52 -12
  20. package/dist/dom-export.mjs.map +0 -1
  21. package/dist/index.mjs.map +0 -1
  22. package/dist/lib/components.d.ts +0 -372
  23. package/dist/lib/context.d.ts +0 -115
  24. package/dist/lib/dom/dom.d.ts +0 -123
  25. package/dist/lib/dom/global.d.ts +0 -40
  26. package/dist/lib/dom/server.d.ts +0 -41
  27. package/dist/lib/dom/ssr/components.d.ts +0 -122
  28. package/dist/lib/dom/ssr/data.d.ts +0 -2
  29. package/dist/lib/dom/ssr/entry.d.ts +0 -48
  30. package/dist/lib/dom/ssr/errorBoundaries.d.ts +0 -36
  31. package/dist/lib/dom/ssr/errors.d.ts +0 -2
  32. package/dist/lib/dom/ssr/fallback.d.ts +0 -2
  33. package/dist/lib/dom/ssr/fog-of-war.d.ts +0 -28
  34. package/dist/lib/dom/ssr/invariant.d.ts +0 -2
  35. package/dist/lib/dom/ssr/links.d.ts +0 -25
  36. package/dist/lib/dom/ssr/markup.d.ts +0 -5
  37. package/dist/lib/dom/ssr/routeModules.d.ts +0 -183
  38. package/dist/lib/dom/ssr/routes-test-stub.d.ts +0 -59
  39. package/dist/lib/dom/ssr/routes.d.ts +0 -29
  40. package/dist/lib/dom/ssr/server.d.ts +0 -16
  41. package/dist/lib/dom/ssr/single-fetch.d.ts +0 -37
  42. package/dist/lib/dom-export/dom-router-provider.d.ts +0 -5
  43. package/dist/lib/dom-export/hydrated-router.d.ts +0 -5
  44. package/dist/lib/dom-export.d.ts +0 -3
  45. package/dist/lib/hooks.d.ts +0 -411
  46. package/dist/lib/router/history.d.ts +0 -253
  47. package/dist/lib/router/links.d.ts +0 -104
  48. package/dist/lib/router/router.d.ts +0 -544
  49. package/dist/lib/router/utils.d.ts +0 -497
  50. package/dist/lib/server-runtime/build.d.ts +0 -38
  51. package/dist/lib/server-runtime/cookies.d.ts +0 -62
  52. package/dist/lib/server-runtime/crypto.d.ts +0 -2
  53. package/dist/lib/server-runtime/data.d.ts +0 -11
  54. package/dist/lib/server-runtime/dev.d.ts +0 -8
  55. package/dist/lib/server-runtime/entry.d.ts +0 -3
  56. package/dist/lib/server-runtime/errors.d.ts +0 -51
  57. package/dist/lib/server-runtime/headers.d.ts +0 -3
  58. package/dist/lib/server-runtime/invariant.d.ts +0 -2
  59. package/dist/lib/server-runtime/markup.d.ts +0 -1
  60. package/dist/lib/server-runtime/mode.d.ts +0 -9
  61. package/dist/lib/server-runtime/routeMatching.d.ts +0 -8
  62. package/dist/lib/server-runtime/routeModules.d.ts +0 -40
  63. package/dist/lib/server-runtime/routes.d.ts +0 -11
  64. package/dist/lib/server-runtime/server.d.ts +0 -5
  65. package/dist/lib/server-runtime/serverHandoff.d.ts +0 -11
  66. package/dist/lib/server-runtime/sessions/cookieStorage.d.ts +0 -19
  67. package/dist/lib/server-runtime/sessions/memoryStorage.d.ts +0 -17
  68. package/dist/lib/server-runtime/sessions.d.ts +0 -140
  69. package/dist/lib/server-runtime/single-fetch.d.ts +0 -30
  70. package/dist/lib/server-runtime/typecheck.d.ts +0 -4
  71. package/dist/lib/server-runtime/warnings.d.ts +0 -1
  72. package/dist/main-dom-export.js +0 -19
  73. package/dist/main.js +0 -19
  74. package/dist/react-router-dom.development.js +0 -199
  75. package/dist/react-router-dom.development.js.map +0 -1
  76. package/dist/react-router-dom.production.min.js +0 -12
  77. package/dist/react-router-dom.production.min.js.map +0 -1
  78. package/dist/react-router.development.js +0 -12528
  79. package/dist/react-router.development.js.map +0 -1
  80. package/dist/react-router.production.min.js +0 -12
  81. package/dist/react-router.production.min.js.map +0 -1
  82. package/dist/umd/react-router-dom.development.js +0 -241
  83. package/dist/umd/react-router-dom.development.js.map +0 -1
  84. package/dist/umd/react-router-dom.production.min.js +0 -12
  85. package/dist/umd/react-router-dom.production.min.js.map +0 -1
  86. package/dist/umd/react-router.development.js +0 -12834
  87. package/dist/umd/react-router.development.js.map +0 -1
  88. package/dist/umd/react-router.production.min.js +0 -12
  89. package/dist/umd/react-router.production.min.js.map +0 -1
@@ -1,122 +0,0 @@
1
- import type { FocusEventHandler, MouseEventHandler, TouchEventHandler } from "react";
2
- import * as React from "react";
3
- import type { FrameworkContextObject } from "./entry";
4
- import type { PageLinkDescriptor } from "../../router/links";
5
- export declare const FrameworkContext: React.Context<FrameworkContextObject | undefined>;
6
- export declare function useFrameworkContext(): FrameworkContextObject;
7
- /**
8
- * Defines the discovery behavior of the link:
9
- *
10
- * - "render" - default, discover the route when the link renders
11
- * - "none" - don't eagerly discover, only discover if the link is clicked
12
- */
13
- export type DiscoverBehavior = "render" | "none";
14
- /**
15
- * Defines the prefetching behavior of the link:
16
- *
17
- * - "none": Never fetched
18
- * - "intent": Fetched when the user focuses or hovers the link
19
- * - "render": Fetched when the link is rendered
20
- * - "viewport": Fetched when the link is in the viewport
21
- */
22
- export type PrefetchBehavior = "intent" | "render" | "none" | "viewport";
23
- interface PrefetchHandlers {
24
- onFocus?: FocusEventHandler;
25
- onBlur?: FocusEventHandler;
26
- onMouseEnter?: MouseEventHandler;
27
- onMouseLeave?: MouseEventHandler;
28
- onTouchStart?: TouchEventHandler;
29
- }
30
- export declare function usePrefetchBehavior<T extends HTMLAnchorElement>(prefetch: PrefetchBehavior, theirElementProps: PrefetchHandlers): [boolean, React.RefObject<T>, PrefetchHandlers];
31
- export declare function composeEventHandlers<EventType extends React.SyntheticEvent | Event>(theirHandler: ((event: EventType) => any) | undefined, ourHandler: (event: EventType) => any): (event: EventType) => any;
32
- /**
33
- Renders all of the `<link>` tags created by route module {@link LinksFunction} export. You should render it inside the `<head>` of your document.
34
-
35
- ```tsx
36
- import { Links } from "react-router";
37
-
38
- export default function Root() {
39
- return (
40
- <html>
41
- <head>
42
- <Links />
43
- </head>
44
- <body></body>
45
- </html>
46
- );
47
- }
48
- ```
49
-
50
- @category Components
51
- */
52
- export declare function Links(): React.JSX.Element;
53
- /**
54
- Renders `<link rel=prefetch|modulepreload>` tags for modules and data of another page to enable an instant navigation to that page. {@link LinkProps.prefetch | `<Link prefetch>`} uses this internally, but you can render it to prefetch a page for any other reason.
55
-
56
- ```tsx
57
- import { PrefetchPageLinks } from "react-router"
58
-
59
- <PrefetchPageLinks page="/absolute/path" />
60
- ```
61
-
62
- For example, you may render one of this as the user types into a search field to prefetch search results before they click through to their selection.
63
-
64
- @category Components
65
- */
66
- export declare function PrefetchPageLinks({ page, ...dataLinkProps }: PageLinkDescriptor): React.JSX.Element | null;
67
- /**
68
- Renders all the `<meta>` tags created by route module {@link MetaFunction} exports. You should render it inside the `<head>` of your HTML.
69
-
70
- ```tsx
71
- import { Meta } from "react-router";
72
-
73
- export default function Root() {
74
- return (
75
- <html>
76
- <head>
77
- <Meta />
78
- </head>
79
- </html>
80
- );
81
- }
82
- ```
83
-
84
- @category Components
85
- */
86
- export declare function Meta(): React.JSX.Element;
87
- /**
88
- A couple common attributes:
89
-
90
- - `<Scripts crossOrigin>` for hosting your static assets on a different server than your app.
91
- - `<Scripts nonce>` to support a [content security policy for scripts](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src) with [nonce-sources](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#sources) for your `<script>` tags.
92
-
93
- You cannot pass through attributes such as `async`, `defer`, `src`, `type`, `noModule` because they are managed by React Router internally.
94
-
95
- @category Types
96
- */
97
- export type ScriptsProps = Omit<React.HTMLProps<HTMLScriptElement>, "children" | "async" | "defer" | "src" | "type" | "noModule" | "dangerouslySetInnerHTML" | "suppressHydrationWarning">;
98
- /**
99
- Renders the client runtime of your app. It should be rendered inside the `<body>` of the document.
100
-
101
- ```tsx
102
- import { Scripts } from "react-router";
103
-
104
- export default function Root() {
105
- return (
106
- <html>
107
- <head />
108
- <body>
109
- <Scripts />
110
- </body>
111
- </html>
112
- );
113
- }
114
- ```
115
-
116
- If server rendering, you can omit `<Scripts/>` and the app will work as a traditional web app without JavaScript, relying solely on HTML and browser behaviors.
117
-
118
- @category Components
119
- */
120
- export declare function Scripts(props: ScriptsProps): React.JSX.Element | null;
121
- export declare function mergeRefs<T = any>(...refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>): React.RefCallback<T>;
122
- export {};
@@ -1,2 +0,0 @@
1
- import "../global";
2
- export declare function createRequestInit(request: Request): Promise<RequestInit>;
@@ -1,48 +0,0 @@
1
- import type { StaticHandlerContext } from "../../router/router";
2
- import type { EntryRoute } from "./routes";
3
- import type { RouteModules } from "./routeModules";
4
- import type { RouteManifest } from "../../router/utils";
5
- type SerializedError = {
6
- message: string;
7
- stack?: string;
8
- };
9
- export interface FrameworkContextObject {
10
- manifest: AssetsManifest;
11
- routeModules: RouteModules;
12
- criticalCss?: string;
13
- serverHandoffString?: string;
14
- future: FutureConfig;
15
- isSpaMode: boolean;
16
- abortDelay?: number;
17
- serializeError?(error: Error): SerializedError;
18
- renderMeta?: {
19
- didRenderScripts?: boolean;
20
- streamCache?: Record<number, Promise<void> & {
21
- result?: {
22
- done: boolean;
23
- value: string;
24
- };
25
- error?: unknown;
26
- }>;
27
- };
28
- }
29
- export interface EntryContext extends FrameworkContextObject {
30
- staticHandlerContext: StaticHandlerContext;
31
- serverHandoffStream?: ReadableStream<Uint8Array>;
32
- }
33
- export interface FutureConfig {
34
- }
35
- export interface AssetsManifest {
36
- entry: {
37
- imports: string[];
38
- module: string;
39
- };
40
- routes: RouteManifest<EntryRoute>;
41
- url: string;
42
- version: string;
43
- hmr?: {
44
- timestamp?: number;
45
- runtime: string;
46
- };
47
- }
48
- export {};
@@ -1,36 +0,0 @@
1
- import * as React from "react";
2
- import type { Location } from "../../router/history";
3
- type RemixErrorBoundaryProps = React.PropsWithChildren<{
4
- location: Location;
5
- isOutsideRemixApp?: boolean;
6
- error?: Error;
7
- }>;
8
- type RemixErrorBoundaryState = {
9
- error: null | Error;
10
- location: Location;
11
- };
12
- export declare class RemixErrorBoundary extends React.Component<RemixErrorBoundaryProps, RemixErrorBoundaryState> {
13
- constructor(props: RemixErrorBoundaryProps);
14
- static getDerivedStateFromError(error: Error): {
15
- error: Error;
16
- };
17
- static getDerivedStateFromProps(props: RemixErrorBoundaryProps, state: RemixErrorBoundaryState): {
18
- error: Error | null;
19
- location: Location<any>;
20
- };
21
- render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
22
- }
23
- /**
24
- * When app's don't provide a root level ErrorBoundary, we default to this.
25
- */
26
- export declare function RemixRootDefaultErrorBoundary({ error, isOutsideRemixApp, }: {
27
- error: unknown;
28
- isOutsideRemixApp?: boolean;
29
- }): React.JSX.Element;
30
- export declare function BoundaryShell({ title, renderScripts, isOutsideRemixApp, children, }: {
31
- title: string;
32
- renderScripts?: boolean;
33
- isOutsideRemixApp?: boolean;
34
- children: React.ReactNode | React.ReactNode[];
35
- }): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
36
- export {};
@@ -1,2 +0,0 @@
1
- import type { RouterState } from "../../router/router";
2
- export declare function deserializeErrors(errors: RouterState["errors"]): RouterState["errors"];
@@ -1,2 +0,0 @@
1
- import * as React from "react";
2
- export declare function RemixRootDefaultHydrateFallback(): React.JSX.Element;
@@ -1,28 +0,0 @@
1
- import type { PatchRoutesOnNavigationFunction } from "../../context";
2
- import type { Router as DataRouter } from "../../router/router";
3
- import type { AssetsManifest } from "./entry";
4
- import type { RouteModules } from "./routeModules";
5
- declare global {
6
- interface Navigator {
7
- connection?: {
8
- saveData: boolean;
9
- };
10
- }
11
- }
12
- export declare function isFogOfWarEnabled(isSpaMode: boolean): boolean;
13
- export declare function getPartialManifest(manifest: AssetsManifest, router: DataRouter): {
14
- routes: {};
15
- entry: {
16
- imports: string[];
17
- module: string;
18
- };
19
- url: string;
20
- version: string;
21
- hmr?: {
22
- timestamp?: number | undefined;
23
- runtime: string;
24
- } | undefined;
25
- };
26
- export declare function getPatchRoutesOnNavigationFunction(manifest: AssetsManifest, routeModules: RouteModules, isSpaMode: boolean, basename: string | undefined): PatchRoutesOnNavigationFunction | undefined;
27
- export declare function useFogOFWarDiscovery(router: DataRouter, manifest: AssetsManifest, routeModules: RouteModules, isSpaMode: boolean): void;
28
- export declare function fetchAndApplyManifestPatches(paths: string[], manifest: AssetsManifest, routeModules: RouteModules, isSpaMode: boolean, basename: string | undefined, patchRoutes: DataRouter["patchRoutes"]): Promise<void>;
@@ -1,2 +0,0 @@
1
- export default function invariant(value: boolean, message?: string): asserts value;
2
- export default function invariant<T>(value: T | null | undefined, message?: string): asserts value is T;
@@ -1,25 +0,0 @@
1
- import type { Location } from "../../router/history";
2
- import type { AgnosticDataRouteMatch } from "../../router/utils";
3
- import type { AssetsManifest } from "./entry";
4
- import type { RouteModules, RouteModule } from "./routeModules";
5
- import type { EntryRoute } from "./routes";
6
- import type { HtmlLinkDescriptor, LinkDescriptor, PageLinkDescriptor } from "../../router/links";
7
- /**
8
- * Gets all the links for a set of matches. The modules are assumed to have been
9
- * loaded already.
10
- */
11
- export declare function getKeyedLinksForMatches(matches: AgnosticDataRouteMatch[], routeModules: RouteModules, manifest: AssetsManifest): KeyedLinkDescriptor[];
12
- export declare function prefetchStyleLinks(route: EntryRoute, routeModule: RouteModule): Promise<void>;
13
- export declare function isPageLinkDescriptor(object: any): object is PageLinkDescriptor;
14
- export type KeyedHtmlLinkDescriptor = {
15
- key: string;
16
- link: HtmlLinkDescriptor;
17
- };
18
- export declare function getKeyedPrefetchLinks(matches: AgnosticDataRouteMatch[], manifest: AssetsManifest, routeModules: RouteModules): Promise<KeyedHtmlLinkDescriptor[]>;
19
- export declare function getNewMatchesForLinks(page: string, nextMatches: AgnosticDataRouteMatch[], currentMatches: AgnosticDataRouteMatch[], manifest: AssetsManifest, location: Location, mode: "data" | "assets"): AgnosticDataRouteMatch[];
20
- export declare function getModuleLinkHrefs(matches: AgnosticDataRouteMatch[], manifestPatch: AssetsManifest): string[];
21
- type KeyedLinkDescriptor<Descriptor extends LinkDescriptor = LinkDescriptor> = {
22
- key: string;
23
- link: Descriptor;
24
- };
25
- export {};
@@ -1,5 +0,0 @@
1
- export declare function escapeHtml(html: string): string;
2
- export interface SafeHtml {
3
- __html: string;
4
- }
5
- export declare function createHtml(html: string): SafeHtml;
@@ -1,183 +0,0 @@
1
- import type { ComponentType, ReactElement } from "react";
2
- import type { Location } from "../../router/history";
3
- import type { ActionFunction, ActionFunctionArgs, LoaderFunction, LoaderFunctionArgs, Params, ShouldRevalidateFunction } from "../../router/utils";
4
- import type { EntryRoute } from "./routes";
5
- import type { DataRouteMatch } from "../../context";
6
- import type { LinkDescriptor } from "../../router/links";
7
- import type { SerializeFrom } from "../../types";
8
- export interface RouteModules {
9
- [routeId: string]: RouteModule | undefined;
10
- }
11
- export interface RouteModule {
12
- clientAction?: ClientActionFunction;
13
- clientLoader?: ClientLoaderFunction;
14
- ErrorBoundary?: ErrorBoundaryComponent;
15
- HydrateFallback?: HydrateFallbackComponent;
16
- Layout?: LayoutComponent;
17
- default: RouteComponent;
18
- handle?: RouteHandle;
19
- links?: LinksFunction;
20
- meta?: MetaFunction;
21
- shouldRevalidate?: ShouldRevalidateFunction;
22
- }
23
- /**
24
- * A function that handles data mutations for a route on the client
25
- */
26
- export type ClientActionFunction = (args: ClientActionFunctionArgs) => ReturnType<ActionFunction>;
27
- /**
28
- * Arguments passed to a route `clientAction` function
29
- */
30
- export type ClientActionFunctionArgs = ActionFunctionArgs<undefined> & {
31
- serverAction: <T = unknown>() => Promise<SerializeFrom<T>>;
32
- };
33
- /**
34
- * A function that loads data for a route on the client
35
- */
36
- export type ClientLoaderFunction = ((args: ClientLoaderFunctionArgs) => ReturnType<LoaderFunction>) & {
37
- hydrate?: boolean;
38
- };
39
- /**
40
- * Arguments passed to a route `clientLoader` function
41
- */
42
- export type ClientLoaderFunctionArgs = LoaderFunctionArgs<undefined> & {
43
- serverLoader: <T = unknown>() => Promise<SerializeFrom<T>>;
44
- };
45
- /**
46
- * ErrorBoundary to display for this route
47
- */
48
- export type ErrorBoundaryComponent = ComponentType;
49
- /**
50
- * `<Route HydrateFallback>` component to render on initial loads
51
- * when client loaders are present
52
- */
53
- export type HydrateFallbackComponent = ComponentType;
54
- /**
55
- * Optional, root-only `<Route Layout>` component to wrap the root content in.
56
- * Useful for defining the <html>/<head>/<body> document shell shared by the
57
- * Component, HydrateFallback, and ErrorBoundary
58
- */
59
- export type LayoutComponent = ComponentType<{
60
- children: ReactElement<unknown, ErrorBoundaryComponent | HydrateFallbackComponent | RouteComponent>;
61
- }>;
62
- /**
63
- * A function that defines `<link>` tags to be inserted into the `<head>` of
64
- * the document on route transitions.
65
- *
66
- * @see https://remix.run/route/meta
67
- */
68
- export interface LinksFunction {
69
- (): LinkDescriptor[];
70
- }
71
- export interface MetaMatch<RouteId extends string = string, Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown> {
72
- id: RouteId;
73
- pathname: DataRouteMatch["pathname"];
74
- data: Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown;
75
- handle?: RouteHandle;
76
- params: DataRouteMatch["params"];
77
- meta: MetaDescriptor[];
78
- error?: unknown;
79
- }
80
- export type MetaMatches<MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> = Array<{
81
- [K in keyof MatchLoaders]: MetaMatch<Exclude<K, number | symbol>, MatchLoaders[K]>;
82
- }[keyof MatchLoaders]>;
83
- export interface MetaArgs<Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown, MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> {
84
- data: (Loader extends LoaderFunction | ClientLoaderFunction ? SerializeFrom<Loader> : unknown) | undefined;
85
- params: Params;
86
- location: Location;
87
- matches: MetaMatches<MatchLoaders>;
88
- error?: unknown;
89
- }
90
- /**
91
- * A function that returns an array of data objects to use for rendering
92
- * metadata HTML tags in a route. These tags are not rendered on descendant
93
- * routes in the route hierarchy. In other words, they will only be rendered on
94
- * the route in which they are exported.
95
- *
96
- * @param Loader - The type of the current route's loader function
97
- * @param MatchLoaders - Mapping from a parent route's filepath to its loader
98
- * function type
99
- *
100
- * Note that parent route filepaths are relative to the `app/` directory.
101
- *
102
- * For example, if this meta function is for `/sales/customers/$customerId`:
103
- *
104
- * ```ts
105
- * // app/root.tsx
106
- * const loader = () => ({ hello: "world" })
107
- * export type Loader = typeof loader
108
- *
109
- * // app/routes/sales.tsx
110
- * const loader = () => ({ salesCount: 1074 })
111
- * export type Loader = typeof loader
112
- *
113
- * // app/routes/sales/customers.tsx
114
- * const loader = () => ({ customerCount: 74 })
115
- * export type Loader = typeof loader
116
- *
117
- * // app/routes/sales/customers/$customersId.tsx
118
- * import type { Loader as RootLoader } from "../../../root"
119
- * import type { Loader as SalesLoader } from "../../sales"
120
- * import type { Loader as CustomersLoader } from "../../sales/customers"
121
- *
122
- * const loader = () => ({ name: "Customer name" })
123
- *
124
- * const meta: MetaFunction<typeof loader, {
125
- * "root": RootLoader,
126
- * "routes/sales": SalesLoader,
127
- * "routes/sales/customers": CustomersLoader,
128
- * }> = ({ data, matches }) => {
129
- * const { name } = data
130
- * // ^? string
131
- * const { customerCount } = matches.find((match) => match.id === "routes/sales/customers").data
132
- * // ^? number
133
- * const { salesCount } = matches.find((match) => match.id === "routes/sales").data
134
- * // ^? number
135
- * const { hello } = matches.find((match) => match.id === "root").data
136
- * // ^? "world"
137
- * }
138
- * ```
139
- */
140
- export interface MetaFunction<Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown, MatchLoaders extends Record<string, LoaderFunction | ClientLoaderFunction | unknown> = Record<string, unknown>> {
141
- (args: MetaArgs<Loader, MatchLoaders>): MetaDescriptor[] | undefined;
142
- }
143
- export type MetaDescriptor = {
144
- charSet: "utf-8";
145
- } | {
146
- title: string;
147
- } | {
148
- name: string;
149
- content: string;
150
- } | {
151
- property: string;
152
- content: string;
153
- } | {
154
- httpEquiv: string;
155
- content: string;
156
- } | {
157
- "script:ld+json": LdJsonObject;
158
- } | {
159
- tagName: "meta" | "link";
160
- [name: string]: string;
161
- } | {
162
- [name: string]: unknown;
163
- };
164
- type LdJsonObject = {
165
- [Key in string]: LdJsonValue;
166
- } & {
167
- [Key in string]?: LdJsonValue | undefined;
168
- };
169
- type LdJsonArray = LdJsonValue[] | readonly LdJsonValue[];
170
- type LdJsonPrimitive = string | number | boolean | null;
171
- type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray;
172
- /**
173
- * A React component that is rendered for a route.
174
- */
175
- export type RouteComponent = ComponentType<{}>;
176
- /**
177
- * An arbitrary object that is associated with a route.
178
- *
179
- * @see https://remix.run/route/handle
180
- */
181
- export type RouteHandle = unknown;
182
- export declare function loadRouteModule(route: EntryRoute, routeModulesCache: RouteModules): Promise<RouteModule>;
183
- export {};
@@ -1,59 +0,0 @@
1
- import * as React from "react";
2
- import type { ActionFunction, LoaderFunction } from "../../router/utils";
3
- import type { IndexRouteObject, NonIndexRouteObject } from "../../context";
4
- import type { LinksFunction, MetaFunction } from "./routeModules";
5
- import type { InitialEntry } from "../../router/history";
6
- import type { HydrationState } from "../../router/router";
7
- import type { FutureConfig } from "./entry";
8
- interface StubIndexRouteObject extends Omit<IndexRouteObject, "loader" | "action" | "element" | "errorElement" | "children"> {
9
- loader?: LoaderFunction;
10
- action?: ActionFunction;
11
- children?: StubRouteObject[];
12
- meta?: MetaFunction;
13
- links?: LinksFunction;
14
- }
15
- interface StubNonIndexRouteObject extends Omit<NonIndexRouteObject, "loader" | "action" | "element" | "errorElement" | "children"> {
16
- loader?: LoaderFunction;
17
- action?: ActionFunction;
18
- children?: StubRouteObject[];
19
- meta?: MetaFunction;
20
- links?: LinksFunction;
21
- }
22
- type StubRouteObject = StubIndexRouteObject | StubNonIndexRouteObject;
23
- interface AppLoadContext {
24
- [key: string]: unknown;
25
- }
26
- export interface RoutesTestStubProps {
27
- /**
28
- * The initial entries in the history stack. This allows you to start a test with
29
- * multiple locations already in the history stack (for testing a back navigation, etc.)
30
- * The test will default to the last entry in initialEntries if no initialIndex is provided.
31
- * e.g. initialEntries={["/home", "/about", "/contact"]}
32
- */
33
- initialEntries?: InitialEntry[];
34
- /**
35
- * The initial index in the history stack to render. This allows you to start a test at a specific entry.
36
- * It defaults to the last entry in initialEntries.
37
- * e.g.
38
- * initialEntries: ["/", "/events/123"]
39
- * initialIndex: 1 // start at "/events/123"
40
- */
41
- initialIndex?: number;
42
- /**
43
- * Used to set the route's initial loader and action data.
44
- * e.g. hydrationData={{
45
- * loaderData: { "/contact": { locale: "en-US" } },
46
- * actionData: { "/login": { errors: { email: "invalid email" } }}
47
- * }}
48
- */
49
- hydrationData?: HydrationState;
50
- /**
51
- * Future flags mimicking the settings in remix.config.js
52
- */
53
- future?: Partial<FutureConfig>;
54
- }
55
- /**
56
- * @category Utils
57
- */
58
- export declare function createRoutesStub(routes: StubRouteObject[], context?: AppLoadContext): ({ initialEntries, initialIndex, hydrationData, future, }: RoutesTestStubProps) => React.JSX.Element;
59
- export {};
@@ -1,29 +0,0 @@
1
- import type { HydrationState } from "../../router/router";
2
- import type { RouteManifest } from "../../router/utils";
3
- import type { RouteModule, RouteModules } from "./routeModules";
4
- import type { FutureConfig } from "./entry";
5
- import type { DataRouteObject } from "../../context";
6
- export interface Route {
7
- index?: boolean;
8
- caseSensitive?: boolean;
9
- id: string;
10
- parentId?: string;
11
- path?: string;
12
- }
13
- export interface EntryRoute extends Route {
14
- hasAction: boolean;
15
- hasLoader: boolean;
16
- hasClientAction: boolean;
17
- hasClientLoader: boolean;
18
- hasErrorBoundary: boolean;
19
- imports?: string[];
20
- css?: string[];
21
- module: string;
22
- parentId?: string;
23
- }
24
- export declare function createServerRoutes(manifest: RouteManifest<EntryRoute>, routeModules: RouteModules, future: FutureConfig, isSpaMode: boolean, parentId?: string, routesByParentId?: Record<string, Omit<EntryRoute, "children">[]>, spaModeLazyPromise?: Promise<{
25
- Component: () => null;
26
- }>): DataRouteObject[];
27
- export declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, future: FutureConfig, isSpaMode: boolean): DataRouteObject[];
28
- export declare function createClientRoutes(manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState | null, isSpaMode: boolean, parentId?: string, routesByParentId?: Record<string, Omit<EntryRoute, "children">[]>, needsRevalidation?: Set<string>): DataRouteObject[];
29
- export declare function shouldHydrateRouteLoader(route: EntryRoute, routeModule: RouteModule, isSpaMode: boolean): boolean;
@@ -1,16 +0,0 @@
1
- import type { ReactElement } from "react";
2
- import type { EntryContext } from "./entry";
3
- export interface ServerRouterProps {
4
- context: EntryContext;
5
- url: string | URL;
6
- abortDelay?: number;
7
- nonce?: string;
8
- }
9
- /**
10
- * The entry point for a Remix app when it is rendered on the server (in
11
- * `app/entry.server.js`). This component is used to generate the HTML in the
12
- * response from the server.
13
- *
14
- * @category Components
15
- */
16
- export declare function ServerRouter({ context, url, abortDelay, nonce, }: ServerRouterProps): ReactElement;
@@ -1,37 +0,0 @@
1
- import * as React from "react";
2
- import type { Router as DataRouter } from "../../router/router";
3
- import type { DataStrategyFunction } from "../../router/utils";
4
- import type { AssetsManifest, EntryContext } from "./entry";
5
- import type { RouteModules } from "./routeModules";
6
- export declare const SingleFetchRedirectSymbol: unique symbol;
7
- export type SingleFetchRedirectResult = {
8
- redirect: string;
9
- status: number;
10
- revalidate: boolean;
11
- reload: boolean;
12
- replace: boolean;
13
- };
14
- export type SingleFetchResult = {
15
- data: unknown;
16
- } | {
17
- error: unknown;
18
- } | SingleFetchRedirectResult;
19
- export type SingleFetchResults = {
20
- [key: string]: SingleFetchResult;
21
- [SingleFetchRedirectSymbol]?: SingleFetchRedirectResult;
22
- };
23
- interface StreamTransferProps {
24
- context: EntryContext;
25
- identifier: number;
26
- reader: ReadableStreamDefaultReader<Uint8Array>;
27
- textDecoder: TextDecoder;
28
- nonce?: string;
29
- }
30
- export declare function StreamTransfer({ context, identifier, reader, textDecoder, nonce, }: StreamTransferProps): React.JSX.Element | null;
31
- export declare function getSingleFetchDataStrategy(manifest: AssetsManifest, routeModules: RouteModules, getRouter: () => DataRouter): DataStrategyFunction;
32
- export declare function singleFetchUrl(reqUrl: URL | string): URL;
33
- export declare function decodeViaTurboStream(body: ReadableStream<Uint8Array>, global: Window | typeof globalThis): Promise<{
34
- done: Promise<undefined>;
35
- value: unknown;
36
- }>;
37
- export {};
@@ -1,5 +0,0 @@
1
- import * as React from "react";
2
- import type { RouterProviderProps as BaseRouterProviderProps } from "react-router";
3
- export { HydratedRouter } from "./hydrated-router";
4
- export type RouterProviderProps = Omit<BaseRouterProviderProps, "flushSync">;
5
- export declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
@@ -1,5 +0,0 @@
1
- import * as React from "react";
2
- /**
3
- * @category Router Components
4
- */
5
- export declare function HydratedRouter(): React.JSX.Element;
@@ -1,3 +0,0 @@
1
- export type { RouterProviderProps } from "./lib/dom-export/dom-router-provider";
2
- export { RouterProvider } from "./lib/dom-export/dom-router-provider";
3
- export { HydratedRouter } from "./lib/dom-export/hydrated-router";