Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-router

Package Overview
Dependencies
Maintainers
3
Versions
587
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-router - npm Package Compare versions

Comparing version 0.0.0-nightly-a9e1d47b6-20240619 to 0.0.0-nightly-ac199f437-20241014

dist/dom-export.d.ts

61

CHANGELOG.md
# `react-router`
## 6.26.1
### Patch Changes
- Rename `unstable_patchRoutesOnMiss` to `unstable_patchRoutesOnNavigation` to match new behavior ([#11888](https://github.com/remix-run/react-router/pull/11888))
- Updated dependencies:
- `@remix-run/router@1.19.1`
## 6.26.0
### Minor Changes
- Add a new `replace(url, init?)` alternative to `redirect(url, init?)` that performs a `history.replaceState` instead of a `history.pushState` on client-side navigation redirects ([#11811](https://github.com/remix-run/react-router/pull/11811))
### Patch Changes
- Fix initial hydration behavior when using `future.v7_partialHydration` along with `unstable_patchRoutesOnMiss` ([#11838](https://github.com/remix-run/react-router/pull/11838))
- During initial hydration, `router.state.matches` will now include any partial matches so that we can render ancestor `HydrateFallback` components
- Updated dependencies:
- `@remix-run/router@1.19.0`
## 6.25.1
No significant changes to this package were made in this release. [See the repo `CHANGELOG.md`](https://github.com/remix-run/react-router/blob/main/CHANGELOG.md) for an overview of all changes in v6.25.1.
## 6.25.0
### Minor Changes
- Stabilize `future.unstable_skipActionErrorRevalidation` as `future.v7_skipActionErrorRevalidation` ([#11769](https://github.com/remix-run/react-router/pull/11769))
- When this flag is enabled, actions will not automatically trigger a revalidation if they return/throw a `Response` with a `4xx`/`5xx` status code
- You may still opt-into revalidation via `shouldRevalidate`
- This also changes `shouldRevalidate`'s `unstable_actionStatus` parameter to `actionStatus`
### Patch Changes
- Fix regression and properly decode paths inside `useMatch` so matches/params reflect decoded params ([#11789](https://github.com/remix-run/react-router/pull/11789))
- Updated dependencies:
- `@remix-run/router@1.18.0`
## 6.24.1
### Patch Changes
- When using `future.v7_relativeSplatPath`, properly resolve relative paths in splat routes that are children of pathless routes ([#11633](https://github.com/remix-run/react-router/pull/11633))
- Updated dependencies:
- `@remix-run/router@1.17.1`
## 6.24.0
### Minor Changes
- Add support for Lazy Route Discovery (a.k.a. Fog of War) ([#11626](https://github.com/remix-run/react-router/pull/11626))
- RFC: <https://github.com/remix-run/react-router/discussions/11113>
- `unstable_patchRoutesOnMiss` docs: <https://reactrouter.com/en/main/routers/create-browser-router>
### Patch Changes
- Updated dependencies:
- `@remix-run/router@1.17.0`
## 6.23.1

@@ -4,0 +65,0 @@

88

dist/index.d.ts

@@ -1,44 +0,74 @@

import type { ActionFunction, ActionFunctionArgs, Blocker, BlockerFunction, unstable_DataStrategyFunction, unstable_DataStrategyFunctionArgs, unstable_DataStrategyMatch, ErrorResponse, Fetcher, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, Navigation, NavigationStates, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, RedirectFunction, RelativeRoutingType, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, unstable_HandlerResult } from "./lib/router";
import { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, resolvePath, UNSAFE_ErrorResponseImpl } from "./lib/router";
import type { AwaitProps, FutureConfig, IndexRouteProps, LayoutRouteProps, MemoryRouterProps, NavigateProps, OutletProps, PathRouteProps, RouteProps, RouterProps, RouterProviderProps, RoutesProps } from "./lib/components";
import { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, createRoutesFromChildren, renderMatches, createMemoryRouter, mapRouteProperties } from "./lib/components";
import type { DataRouteMatch, DataRouteObject, IndexRouteObject, NavigateOptions, Navigator, NonIndexRouteObject, RouteMatch, RouteObject } from "./lib/context";
import { DataRouterContext, DataRouterStateContext, LocationContext, NavigationContext, RouteContext } from "./lib/context";
import type { NavigateFunction } from "./lib/hooks";
import { useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteId, useRouteLoaderData, useRoutes, useRoutesImpl } from "./lib/hooks";
type Hash = string;
type Pathname = string;
type Search = string;
export type { ActionFunction, ActionFunctionArgs, AwaitProps, DataRouteMatch, DataRouteObject, unstable_DataStrategyFunction, unstable_DataStrategyFunctionArgs, unstable_DataStrategyMatch, ErrorResponse, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, NavigationStates, Navigator, NonIndexRouteObject, OutletProps, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, PathRouteProps, Pathname, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, Blocker, BlockerFunction, unstable_HandlerResult, };
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, useBlocker, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, };
export type { AgnosticDataIndexRouteObject, AgnosticDataNonIndexRouteObject, AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, AgnosticRouteObject, HydrationState, InitialEntry, LowerCaseFormMethod, StaticHandler, TrackedPromise, FetcherStates, UpperCaseFormMethod, UNSAFE_DeferredData, } from "./lib/router";
export { getStaticContextFromError, stripBasename, UNSAFE_DEFERRED_SYMBOL, UNSAFE_convertRoutesToDataRoutes, } from "./lib/router";
export type { FormEncType, FormMethod, GetScrollRestorationKeyFunction, StaticHandlerContext, Submission, V7_FormMethod, } from "./lib/router";
export type { InitialEntry, Location, Path, To } from "./lib/router/history";
export type { HydrationState, StaticHandler, GetScrollPositionFunction, GetScrollRestorationKeyFunction, StaticHandlerContext, Fetcher, Navigation, NavigationStates, RelativeRoutingType, Blocker, BlockerFunction, Router as DataRouter, RouterState, RouterInit, RouterSubscriber, RouterNavigateOptions, RouterFetchOptions, RevalidationState, } from "./lib/router/router";
export type { ActionFunction, ActionFunctionArgs, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, DataWithResponseInit as UNSAFE_DataWithResponseInit, ErrorResponse, FormEncType, FormMethod, HTMLFormMethod, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, UIMatch, } from "./lib/router/utils";
export { Action as NavigationType, createPath, parsePath, } from "./lib/router/history";
export { IDLE_NAVIGATION, IDLE_FETCHER, IDLE_BLOCKER, } from "./lib/router/router";
export { data, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath, } from "./lib/router/utils";
export type { DataRouteMatch, DataRouteObject, IndexRouteObject, NavigateOptions, Navigator, NonIndexRouteObject, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, RouteMatch, RouteObject, } from "./lib/context";
export type { AwaitProps, IndexRouteProps, LayoutRouteProps, MemoryRouterProps, NavigateProps, OutletProps, PathRouteProps, RouteProps, RouterProps, RouterProviderProps, RoutesProps, } from "./lib/components";
export type { NavigateFunction } from "./lib/hooks";
export { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, createMemoryRouter, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, renderMatches, } from "./lib/components";
export { useBlocker, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, } from "./lib/hooks";
export type { BrowserRouterProps, HashRouterProps, HistoryRouterProps, LinkProps, NavLinkProps, NavLinkRenderProps, FetcherFormProps, FormProps, ScrollRestorationProps, SetURLSearchParams, SubmitFunction, FetcherSubmitFunction, FetcherWithComponents, } from "./lib/dom/lib";
export { createBrowserRouter, createHashRouter, BrowserRouter, HashRouter, Link, UNSAFE_ViewTransitionContext, UNSAFE_FetchersContext, unstable_HistoryRouter, NavLink, Form, ScrollRestoration, useLinkClickHandler, useSearchParams, useSubmit, useFormAction, useFetcher, useFetchers, UNSAFE_useScrollRestoration, useBeforeUnload, unstable_usePrompt, unstable_useViewTransitionState, } from "./lib/dom/lib";
export type { ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, SubmitTarget, } from "./lib/dom/dom";
export { createBrowserRouter, createHashRouter, BrowserRouter, HashRouter, Link, HistoryRouter as unstable_HistoryRouter, NavLink, Form, ScrollRestoration, useLinkClickHandler, useSearchParams, useSubmit, useFormAction, useFetcher, useFetchers, useBeforeUnload, usePrompt as unstable_usePrompt, useViewTransitionState, } from "./lib/dom/lib";
export type { FetcherSubmitOptions, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, SubmitTarget, } from "./lib/dom/dom";
export { createSearchParams } from "./lib/dom/dom";
export type { StaticRouterProps, StaticRouterProviderProps, } from "./lib/dom/server";
export { createStaticHandler, createStaticRouter, StaticRouter, StaticRouterProvider, } from "./lib/dom/server";
export { HydratedRouter } from "./lib/dom/ssr/browser";
export { Meta, Links, Scripts, PrefetchPageLinks, } from "./lib/dom/ssr/components";
export type { ScriptsProps } from "./lib/dom/ssr/components";
export type { HtmlLinkDescriptor, LinkDescriptor, PrefetchPageDescriptor, } from "./lib/dom/ssr/links";
export type { EntryContext } from "./lib/dom/ssr/entry";
export type { ClientActionFunction, ClientActionFunctionArgs, ClientLoaderFunction, ClientLoaderFunctionArgs, MetaArgs, MetaDescriptor, MetaFunction, LinksFunction, } from "./lib/dom/ssr/routeModules";
export type { RemixServerProps } from "./lib/dom/ssr/server";
export { RemixServer } from "./lib/dom/ssr/server";
export type { RemixStubProps } from "./lib/dom/ssr/create-remix-stub";
export { createRemixStub } from "./lib/dom/ssr/create-remix-stub";
export type { ServerRouterProps } from "./lib/dom/ssr/server";
export { ServerRouter } from "./lib/dom/ssr/server";
export type { RoutesTestStubProps } from "./lib/dom/ssr/routes-test-stub";
export { createRoutesStub } from "./lib/dom/ssr/routes-test-stub";
export { createCookie, isCookie } from "./lib/server-runtime/cookies";
export { createRequestHandler } from "./lib/server-runtime/server";
export { createSession, createSessionStorage, isSession, } from "./lib/server-runtime/sessions";
export { createCookieSessionStorage } from "./lib/server-runtime/sessions/cookieStorage";
export { createMemorySessionStorage } from "./lib/server-runtime/sessions/memoryStorage";
export { setDevServerHooks as unstable_setDevServerHooks } from "./lib/server-runtime/dev";
export type { IsCookieFunction } from "./lib/server-runtime/cookies";
export type { CreateRequestHandlerFunction } from "./lib/server-runtime/server";
export type { IsSessionFunction } from "./lib/server-runtime/sessions";
export type { HandleDataRequestFunction, HandleDocumentRequestFunction, HandleErrorFunction, ServerBuild, ServerEntryModule, } from "./lib/server-runtime/build";
export type { Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, } from "./lib/server-runtime/cookies";
export type { AppLoadContext } from "./lib/server-runtime/data";
export type { PageLinkDescriptor, HtmlLinkDescriptor, LinkDescriptor, } from "./lib/router/links";
export type { TypedResponse, JsonFunction, } from "./lib/server-runtime/responses";
export type { DataFunctionArgs, HeadersArgs, HeadersFunction, } from "./lib/server-runtime/routeModules";
export type { RequestHandler } from "./lib/server-runtime/server";
export type { Session, SessionData, SessionIdStorageStrategy, SessionStorage, FlashSessionData, } from "./lib/server-runtime/sessions";
/** @internal */
export { DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, mapRouteProperties as UNSAFE_mapRouteProperties, useRouteId as UNSAFE_useRouteId, useRoutesImpl as UNSAFE_useRoutesImpl, UNSAFE_ErrorResponseImpl, };
export { createBrowserHistory as UNSAFE_createBrowserHistory, invariant as UNSAFE_invariant, } from "./lib/router/history";
/** @internal */
export { RemixContext as UNSAFE_RemixContext } from "./lib/dom/ssr/components";
export { createRouter as UNSAFE_createRouter } from "./lib/router/router";
/** @internal */
export { ErrorResponseImpl as UNSAFE_ErrorResponseImpl } from "./lib/router/utils";
/** @internal */
export { DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, FetchersContext as UNSAFE_FetchersContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, ViewTransitionContext as UNSAFE_ViewTransitionContext, } from "./lib/context";
/** @internal */
export { mapRouteProperties as UNSAFE_mapRouteProperties } from "./lib/components";
/** @internal */
export { FrameworkContext as UNSAFE_FrameworkContext } from "./lib/dom/ssr/components";
/** @internal */
export type { AssetsManifest as UNSAFE_AssetsManifest } from "./lib/dom/ssr/entry";
/** @internal */
export { deserializeErrors as UNSAFE_deserializeErrors } from "./lib/dom/ssr/errors";
/** @internal */
export { RemixErrorBoundary as UNSAFE_RemixErrorBoundary } from "./lib/dom/ssr/errorBoundaries";
/** @internal */
export { getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, } from "./lib/dom/ssr/fog-of-war";
/** @internal */
export type { RouteModules as UNSAFE_RouteModules } from "./lib/dom/ssr/routeModules";
/** @internal */
export type { FutureConfig as UNSAFE_FutureConfig, AssetsManifest as UNSAFE_AssetsManifest, RemixContextObject as UNSAFE_RemixContextObject, } from "./lib/dom/ssr/entry";
export { createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, } from "./lib/dom/ssr/routes";
/** @internal */
export type { EntryRoute as UNSAFE_EntryRoute, RouteManifest as UNSAFE_RouteManifest, } from "./lib/dom/ssr/routes";
export { getSingleFetchDataStrategy as UNSAFE_getSingleFetchDataStrategy } from "./lib/dom/ssr/single-fetch";
/** @internal */
export type { SingleFetchRedirectResult as UNSAFE_SingleFetchRedirectResult, SingleFetchResult as UNSAFE_SingleFetchResult, SingleFetchResults as UNSAFE_SingleFetchResults, } from "./lib/dom/ssr/single-fetch";
export { decodeViaTurboStream as UNSAFE_decodeViaTurboStream, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, } from "./lib/dom/ssr/single-fetch";
/** @internal */
export { ServerMode as UNSAFE_ServerMode } from "./lib/server-runtime/mode";
/** @internal */
export { useScrollRestoration as UNSAFE_useScrollRestoration } from "./lib/dom/lib";

@@ -1,9 +0,7 @@

import type { FutureConfig as RouterFutureConfig, HydrationState, InitialEntry, LazyRouteFunction, Location, RelativeRoutingType, Router as RemixRouter, To, TrackedPromise, unstable_DataStrategyFunction } from "./router";
import { Action as NavigationType } from "./router";
import * as React from "react";
import type { IndexRouteObject, Navigator, NonIndexRouteObject, RouteMatch, RouteObject } from "./context";
export interface FutureConfig {
v7_relativeSplatPath: boolean;
v7_startTransition: boolean;
}
import type { InitialEntry, Location, To } from "./router/history";
import { Action as NavigationType } from "./router/history";
import type { FutureConfig, HydrationState, RelativeRoutingType, Router as DataRouter } from "./router/router";
import type { DataStrategyFunction, LazyRouteFunction, TrackedPromise } from "./router/utils";
import type { IndexRouteObject, Navigator, NonIndexRouteObject, PatchRoutesOnNavigationFunction, RouteMatch, RouteObject } from "./context";
/**

@@ -20,22 +18,17 @@ * @private

basename?: string;
future?: Partial<Omit<RouterFutureConfig, "v7_prependBasename">>;
future?: Partial<FutureConfig>;
hydrationData?: HydrationState;
initialEntries?: InitialEntry[];
initialIndex?: number;
unstable_dataStrategy?: unstable_DataStrategyFunction;
}): RemixRouter;
/**
* @category Types
*/
dataStrategy?: DataStrategyFunction;
patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
}): DataRouter;
export interface RouterProviderProps {
fallbackElement?: React.ReactNode;
router: RemixRouter;
future?: Partial<Pick<FutureConfig, "v7_startTransition">>;
router: DataRouter;
flushSync?: (fn: () => unknown) => undefined;
}
/**
* Given a Remix Router instance, render the appropriate UI
*
* @category Router Components
*/
export declare function RouterProvider({ fallbackElement, router, future, }: RouterProviderProps): React.ReactElement;
export declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, }: RouterProviderProps): React.ReactElement;
/**

@@ -49,3 +42,2 @@ * @category Types

initialIndex?: number;
future?: Partial<FutureConfig>;
}

@@ -57,3 +49,3 @@ /**

*/
export declare function MemoryRouter({ basename, children, initialEntries, initialIndex, future, }: MemoryRouterProps): React.ReactElement;
export declare function MemoryRouter({ basename, children, initialEntries, initialIndex, }: MemoryRouterProps): React.ReactElement;
/**

@@ -108,3 +100,3 @@ * @category Types

```
@category Components

@@ -182,3 +174,2 @@ */

static?: boolean;
future?: Partial<Pick<FutureConfig, "v7_relativeSplatPath">>;
}

@@ -194,3 +185,3 @@ /**

*/
export declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, future, }: RouterProps): React.ReactElement | null;
export declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, }: RouterProps): React.ReactElement | null;
/**

@@ -197,0 +188,0 @@ * @category Types

import * as React from "react";
import type { AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, History, LazyRouteFunction, Location, Action as NavigationType, RelativeRoutingType, Router, StaticHandlerContext, To, TrackedPromise } from "./router";
import type { History, Action as NavigationType, Location, To } from "./router/history";
import type { RelativeRoutingType, Router, StaticHandlerContext } from "./router/router";
import type { AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticPatchRoutesOnNavigationFunction, AgnosticPatchRoutesOnNavigationFunctionArgs, AgnosticRouteMatch, LazyRouteFunction, TrackedPromise } from "./router/utils";
export interface IndexRouteObject {

@@ -50,2 +52,4 @@ caseSensitive?: AgnosticIndexRouteObject["caseSensitive"];

}
export type PatchRoutesOnNavigationFunctionArgs = AgnosticPatchRoutesOnNavigationFunctionArgs<RouteObject, RouteMatch>;
export type PatchRoutesOnNavigationFunction = AgnosticPatchRoutesOnNavigationFunction<RouteObject, RouteMatch>;
export interface DataRouterContextObject extends Omit<NavigationContextObject, "future"> {

@@ -56,3 +60,14 @@ router: Router;

export declare const DataRouterContext: React.Context<DataRouterContextObject | null>;
export declare const DataRouterStateContext: React.Context<import("./router").RouterState | null>;
export declare const DataRouterStateContext: React.Context<import("./router/router").RouterState | null>;
export type ViewTransitionContextObject = {
isTransitioning: false;
} | {
isTransitioning: true;
flushSync: boolean;
currentLocation: Location;
nextLocation: Location;
};
export declare const ViewTransitionContext: React.Context<ViewTransitionContextObject>;
export type FetchersContextObject = Map<string, any>;
export declare const FetchersContext: React.Context<FetchersContextObject>;
export declare const AwaitContext: React.Context<TrackedPromise | null>;

@@ -64,4 +79,4 @@ export interface NavigateOptions {

relative?: RelativeRoutingType;
unstable_flushSync?: boolean;
unstable_viewTransition?: boolean;
flushSync?: boolean;
viewTransition?: boolean;
}

@@ -88,5 +103,3 @@ /**

static: boolean;
future: {
v7_relativeSplatPath: boolean;
};
future: {};
}

@@ -93,0 +106,0 @@ export declare const NavigationContext: React.Context<NavigationContextObject>;

@@ -1,2 +0,3 @@

import type { FormEncType, HTMLFormMethod, RelativeRoutingType } from "../router";
import type { RelativeRoutingType } from "../router/router";
import type { FormEncType, HTMLFormMethod } from "../router/utils";
export declare const defaultMethod: HTMLFormMethod;

@@ -18,5 +19,5 @@ export declare function isHtmlElement(object: any): object is HTMLElement;

values for a given key, but don't want to use an array initializer.
For example, instead of:
```tsx

@@ -49,3 +50,6 @@ let searchParams = new URLSearchParams([

export type SubmitTarget = HTMLFormElement | HTMLButtonElement | HTMLInputElement | FormData | URLSearchParams | JsonValue | null;
export interface SubmitOptions {
/**
* Submit options shared by both navigations and fetchers
*/
interface SharedSubmitOptions {
/**

@@ -67,10 +71,27 @@ * The HTTP method used to submit the form. Overrides `<form method>`.

/**
* Indicate a specific fetcherKey to use when using navigate=false
* Determines whether the form action is relative to the route hierarchy or
* the pathname. Use this if you want to opt out of navigating the route
* hierarchy and want to instead route based on /-delimited URL segments
*/
fetcherKey?: string;
relative?: RelativeRoutingType;
/**
* navigate=false will use a fetcher instead of a navigation
* In browser-based environments, prevent resetting scroll after this
* navigation when using the <ScrollRestoration> component
*/
navigate?: boolean;
preventScrollReset?: boolean;
/**
* Enable flushSync for this submission's state updates
*/
flushSync?: boolean;
}
/**
* Submit options available to fetchers
*/
export interface FetcherSubmitOptions extends SharedSubmitOptions {
}
/**
* Submit options available to navigations
*/
export interface SubmitOptions extends FetcherSubmitOptions {
/**
* Set `true` to replace the current entry in the browser's history stack

@@ -86,20 +107,13 @@ * instead of creating a new one (i.e. stay on "the same page"). Defaults

/**
* Determines whether the form action is relative to the route hierarchy or
* the pathname. Use this if you want to opt out of navigating the route
* hierarchy and want to instead route based on /-delimited URL segments
* Indicate a specific fetcherKey to use when using navigate=false
*/
relative?: RelativeRoutingType;
fetcherKey?: string;
/**
* In browser-based environments, prevent resetting scroll after this
* navigation when using the <ScrollRestoration> component
* navigate=false will use a fetcher instead of a navigation
*/
preventScrollReset?: boolean;
navigate?: boolean;
/**
* Enable flushSync for this navigation's state updates
*/
unstable_flushSync?: boolean;
/**
* Enable view transitions on this submission navigation
*/
unstable_viewTransition?: boolean;
viewTransition?: boolean;
}

@@ -106,0 +120,0 @@ export declare function getFormSubmissionInfo(target: SubmitTarget, basename: string): {

@@ -1,11 +0,9 @@

import type { HydrationState, Router as RemixRouter } from "../router";
import type { ViewTransition } from "./lib";
import type { AssetsManifest, FutureConfig as RemixFutureConfig } from "./ssr/entry";
import type { HydrationState, Router as DataRouter } from "../router/router";
import type { AssetsManifest, FutureConfig } from "./ssr/entry";
import type { RouteModules } from "./ssr/routeModules";
export type WindowRemixContext = {
url: string;
export type WindowReactRouterContext = {
basename?: string;
state: HydrationState;
criticalCss?: string;
future: RemixFutureConfig;
future: FutureConfig;
isSpaMode: boolean;

@@ -20,2 +18,8 @@ stream: ReadableStream<Uint8Array> | undefined;

};
export interface ViewTransition {
finished: Promise<void>;
ready: Promise<void>;
updateCallbackDone: Promise<void>;
skipTransition(): void;
}
declare global {

@@ -27,8 +31,8 @@ var __staticRouterHydrationData: HydrationState | undefined;

}
var __remixContext: WindowRemixContext | undefined;
var __remixManifest: AssetsManifest | undefined;
var __remixRouteModules: RouteModules | undefined;
var __remixRouter: RemixRouter | undefined;
var __remixRevalidation: number | undefined;
var __remixClearCriticalCss: (() => void) | undefined;
var __reactRouterContext: WindowReactRouterContext | undefined;
var __reactRouterManifest: AssetsManifest | undefined;
var __reactRouterRouteModules: RouteModules | undefined;
var __reactRouterDataRouter: DataRouter | undefined;
var __reactRouterHdrActive: boolean;
var __reactRouterClearCriticalCss: (() => void) | undefined;
var $RefreshRuntime$: {

@@ -35,0 +39,0 @@ performReactRefresh: () => void;

import * as React from "react";
import type { unstable_DataStrategyFunction, Fetcher, FutureConfig as RouterFutureConfig, GetScrollRestorationKeyFunction, History, HTMLFormMethod, HydrationState, Router as RemixRouter, BlockerFunction, Location, RelativeRoutingType, To } from "../router";
import type { History, To } from "../router/history";
import type { BlockerFunction, Fetcher, FutureConfig, GetScrollRestorationKeyFunction, HydrationState, RelativeRoutingType, Router as DataRouter } from "../router/router";
import type { DataStrategyFunction, HTMLFormMethod } from "../router/utils";
import "./global";
import type { SubmitOptions, URLSearchParamsInit, SubmitTarget } from "./dom";
import type { PrefetchBehavior, ScriptsProps } from "./ssr/components";
import type { RouterProviderProps, FutureConfig as RenderFutureConfig } from "../components";
import type { RouteObject, NavigateOptions } from "../context";
import type { SubmitOptions, URLSearchParamsInit, SubmitTarget, FetcherSubmitOptions } from "./dom";
import type { DiscoverBehavior, PrefetchBehavior, ScriptsProps } from "./ssr/components";
import type { RouteObject, NavigateOptions, PatchRoutesOnNavigationFunction } from "../context";
interface DOMRouterOpts {
basename?: string;
future?: Partial<Omit<RouterFutureConfig, "v7_prependBasename">>;
future?: Partial<FutureConfig>;
hydrationData?: HydrationState;
unstable_dataStrategy?: unstable_DataStrategyFunction;
dataStrategy?: DataStrategyFunction;
patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
window?: Window;

@@ -18,31 +20,8 @@ }

*/
export declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts): RemixRouter;
export declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts): DataRouter;
/**
* @category Routers
*/
export declare function createHashRouter(routes: RouteObject[], opts?: DOMRouterOpts): RemixRouter;
type ViewTransitionContextObject = {
isTransitioning: false;
} | {
isTransitioning: true;
flushSync: boolean;
currentLocation: Location;
nextLocation: Location;
};
declare const ViewTransitionContext: React.Context<ViewTransitionContextObject>;
export { ViewTransitionContext as UNSAFE_ViewTransitionContext };
type FetchersContextObject = Map<string, any>;
declare const FetchersContext: React.Context<FetchersContextObject>;
export { FetchersContext as UNSAFE_FetchersContext };
export interface ViewTransition {
finished: Promise<void>;
ready: Promise<void>;
updateCallbackDone: Promise<void>;
skipTransition(): void;
}
export declare function createHashRouter(routes: RouteObject[], opts?: DOMRouterOpts): DataRouter;
/**
* Given a Remix Router instance, render the appropriate UI
*/
export declare function RouterProvider({ fallbackElement, router, future, }: RouterProviderProps): React.ReactElement;
/**
* @category Types

@@ -53,3 +32,2 @@ */

children?: React.ReactNode;
future?: Partial<RenderFutureConfig>;
window?: Window;

@@ -62,3 +40,3 @@ }

*/
export declare function BrowserRouter({ basename, children, future, window, }: BrowserRouterProps): React.JSX.Element;
export declare function BrowserRouter({ basename, children, window, }: BrowserRouterProps): React.JSX.Element;
/**

@@ -70,3 +48,2 @@ * @category Types

children?: React.ReactNode;
future?: Partial<RenderFutureConfig>;
window?: Window;

@@ -80,3 +57,3 @@ }

*/
export declare function HashRouter({ basename, children, future, window, }: HashRouterProps): React.JSX.Element;
export declare function HashRouter({ basename, children, window }: HashRouterProps): React.JSX.Element;
/**

@@ -88,3 +65,2 @@ * @category Types

children?: React.ReactNode;
future?: RenderFutureConfig;
history: History;

@@ -98,9 +74,9 @@ }

*
* @name unstable_HistoryRouter
* @category Router Components
*/
declare function HistoryRouter({ basename, children, future, history, }: HistoryRouterProps): React.JSX.Element;
declare namespace HistoryRouter {
export declare function HistoryRouter({ basename, children, history, }: HistoryRouterProps): React.JSX.Element;
export declare namespace HistoryRouter {
var displayName: string;
}
export { HistoryRouter as unstable_HistoryRouter };
/**

@@ -111,2 +87,15 @@ * @category Types

/**
Defines the link discovery behavior
```tsx
<Link /> // default ("render")
<Link discover="render" />
<Link discover="none" />
```
- **render** - default, discover the route when the link renders
- **none** - don't eagerly discover, only discover if the link is clicked
*/
discover?: DiscoverBehavior;
/**
Defines the data and module prefetching behavior for the link.

@@ -227,3 +216,3 @@

```jsx
<Link to={to} unstable_viewTransition>
<Link to={to} viewTransition>
Click me

@@ -235,3 +224,3 @@ </Link>

*/
unstable_viewTransition?: boolean;
viewTransition?: boolean;
}

@@ -360,3 +349,3 @@ /**

Wraps {@link Link | `<Link>`} with additional props for styling active and pending states.
- Automatically applies classes to the link based on its active and pending states, see {@link NavLinkProps.className}.

@@ -386,3 +375,6 @@ - Automatically applies `aria-current="page"` to the link when the link is active. See [`aria-current`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current) on MDN.

export declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
export interface FetcherFormProps extends React.FormHTMLAttributes<HTMLFormElement> {
/**
* Form props shared by navigations and fetchers
*/
interface SharedFormProps extends React.FormHTMLAttributes<HTMLFormElement> {
/**

@@ -422,5 +414,13 @@ * The HTTP verb to use when the form is submitted. Supports "get", "post",

/**
* Form props available to fetchers
* @category Types
*/
export interface FormProps extends FetcherFormProps {
export interface FetcherFormProps extends SharedFormProps {
}
/**
* Form props available to navigations
* @category Types
*/
export interface FormProps extends SharedFormProps {
discover?: DiscoverBehavior;
/**

@@ -458,5 +458,5 @@ * Indicates a specific fetcherKey to use when using `navigate={false}` so you

* for this navigation. To apply specific styles during the transition see
* {@link unstable_useViewTransitionState}.
* {@link useViewTransitionState}.
*/
unstable_viewTransition?: boolean;
viewTransition?: boolean;
}

@@ -540,3 +540,3 @@ /**

*/
export declare function useLinkClickHandler<E extends Element = HTMLAnchorElement>(to: To, { target, replace: replaceProp, state, preventScrollReset, relative, unstable_viewTransition, }?: {
export declare function useLinkClickHandler<E extends Element = HTMLAnchorElement>(to: To, { target, replace: replaceProp, state, preventScrollReset, relative, viewTransition, }?: {
target?: React.HTMLAttributeAnchorTarget;

@@ -547,3 +547,3 @@ replace?: boolean;

relative?: RelativeRoutingType;
unstable_viewTransition?: boolean;
viewTransition?: boolean;
}): (event: React.MouseEvent<E, MouseEvent>) => void;

@@ -684,3 +684,3 @@ /**

*/
target: SubmitTarget, options?: Omit<SubmitOptions, "replace" | "state">): Promise<void>;
target: SubmitTarget, options?: FetcherSubmitOptions): Promise<void>;
}

@@ -803,3 +803,3 @@ /**

Loads data from a route. Useful for loading data imperatively inside of user events outside of a normal button or form, like a combobox or search input.
```tsx

@@ -820,3 +820,3 @@ let fetcher = useFetcher()

*/
unstable_flushSync?: boolean;
flushSync?: boolean;
}) => Promise<void>;

@@ -826,3 +826,3 @@ };

Useful for creating complex, dynamic user interfaces that require multiple, concurrent data interactions without causing a navigation.
Fetchers track their own, independent state and can be used to load data, submit forms, and generally interact with loaders and actions.

@@ -899,7 +899,6 @@

*/
declare function useScrollRestoration({ getKey, storageKey, }?: {
export declare function useScrollRestoration({ getKey, storageKey, }?: {
getKey?: GetScrollRestorationKeyFunction;
storageKey?: string;
}): void;
export { useScrollRestoration as UNSAFE_useScrollRestoration };
/**

@@ -947,16 +946,17 @@ * Setup a callback to be fired on the window's `beforeunload` event.

@category Hooks
@name unstable_usePrompt
*/
declare function usePrompt({ when, message, }: {
export declare function usePrompt({ when, message, }: {
when: boolean | BlockerFunction;
message: string;
}): void;
export { usePrompt as unstable_usePrompt };
/**
This hook returns `true` when there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) to the specified location. This can be used to apply finer-grained styles to elements to further customize the view transition. This requires that view transitions have been enabled for the given navigation via {@link LinkProps.unstable_viewTransition} (or the `Form`, `submit`, or `navigate` call)
This hook returns `true` when there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) to the specified location. This can be used to apply finer-grained styles to elements to further customize the view transition. This requires that view transitions have been enabled for the given navigation via {@link LinkProps.viewTransition} (or the `Form`, `submit`, or `navigate` call)
@category Hooks
@name useViewTransitionState
*/
declare function useViewTransitionState(to: To, opts?: {
export declare function useViewTransitionState(to: To, opts?: {
relative?: RelativeRoutingType;
}): boolean;
export { useViewTransitionState as unstable_useViewTransitionState };
export {};
import * as React from "react";
import type { Location, Router as RemixRouter, StaticHandlerContext, CreateStaticHandlerOptions as RouterCreateStaticHandlerOptions, FutureConfig as RouterFutureConfig } from "../router";
import { type FutureConfig } from "../components";
import type { Location } from "../router/history";
import type { FutureConfig, Router as DataRouter, CreateStaticHandlerOptions as RouterCreateStaticHandlerOptions, StaticHandlerContext } from "../router/router";
import type { RouteObject } from "../context";

@@ -9,3 +9,2 @@ export interface StaticRouterProps {

location: Partial<Location> | string;
future?: Partial<FutureConfig>;
}

@@ -18,6 +17,6 @@ /**

*/
export declare function StaticRouter({ basename, children, location: locationProp, future, }: StaticRouterProps): React.JSX.Element;
export declare function StaticRouter({ basename, children, location: locationProp, }: StaticRouterProps): React.JSX.Element;
export interface StaticRouterProviderProps {
context: StaticHandlerContext;
router: RemixRouter;
router: DataRouter;
hydrate?: boolean;

@@ -33,7 +32,7 @@ nonce?: string;

export declare function StaticRouterProvider({ context, router, hydrate, nonce, }: StaticRouterProviderProps): React.JSX.Element;
type CreateStaticHandlerOptions = Omit<RouterCreateStaticHandlerOptions, "detectErrorBoundary" | "mapRouteProperties">;
type CreateStaticHandlerOptions = Omit<RouterCreateStaticHandlerOptions, "mapRouteProperties">;
/**
* @category Utils
*/
export declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): import("../router").StaticHandler;
export declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticHandlerOptions): import("../router/router").StaticHandler;
/**

@@ -43,4 +42,4 @@ * @category Routers

export declare function createStaticRouter(routes: RouteObject[], context: StaticHandlerContext, opts?: {
future?: Partial<Pick<RouterFutureConfig, "v7_partialHydration" | "v7_relativeSplatPath">>;
}): RemixRouter;
future?: Partial<FutureConfig>;
}): DataRouter;
export {};
import type { FocusEventHandler, MouseEventHandler, TouchEventHandler } from "react";
import * as React from "react";
import type { RemixContextObject } from "./entry";
import type { PrefetchPageDescriptor } from "./links";
import type { FrameworkContextObject } from "./entry";
import type { PageLinkDescriptor } from "../../router/links";
export type SerializeFrom<D> = D extends () => {} ? Awaited<ReturnType<D>> : D;
export declare const RemixContext: React.Context<RemixContextObject | undefined>;
export declare function useRemixContext(): RemixContextObject;
export declare const FrameworkContext: React.Context<FrameworkContextObject | undefined>;
export declare function useFrameworkContext(): FrameworkContextObject;
/**
* Defines the discovery behavior of the link:
*
* - "render" - default, discover the route when the link renders
* - "none" - don't eagerly discover, only discover if the link is clicked
*/
export type DiscoverBehavior = "render" | "none";
/**
* Defines the prefetching behavior of the link:

@@ -60,3 +67,3 @@ *

*/
export declare function PrefetchPageLinks({ page, ...dataLinkProps }: PrefetchPageDescriptor): React.JSX.Element | null;
export declare function PrefetchPageLinks({ page, ...dataLinkProps }: PageLinkDescriptor): React.JSX.Element | null;
/**

@@ -63,0 +70,0 @@ Renders all the `<meta>` tags created by route module {@link MetaFunction} exports. You should render it inside the `<head>` of your HTML.

@@ -5,2 +5,3 @@ import * as React from "react";

location: Location;
isOutsideRemixApp?: boolean;
error?: Error;

@@ -26,10 +27,12 @@ }>;

*/
export declare function RemixRootDefaultErrorBoundary({ error }: {
export declare function RemixRootDefaultErrorBoundary({ error, isOutsideRemixApp, }: {
error: unknown;
isOutsideRemixApp?: boolean;
}): React.JSX.Element;
export declare function BoundaryShell({ title, renderScripts, children, }: {
export declare function BoundaryShell({ title, renderScripts, isOutsideRemixApp, children, }: {
title: string;
renderScripts?: boolean;
isOutsideRemixApp?: boolean;
children: React.ReactNode | React.ReactNode[];
}): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
export {};

@@ -1,2 +0,2 @@

import type { Router as RemixRouter } from "../../router";
export declare function deserializeErrors(errors: RemixRouter["state"]["errors"]): RemixRouter["state"]["errors"];
import type { RouterState } from "../../router/router";
export declare function deserializeErrors(errors: RouterState["errors"]): RouterState["errors"];

@@ -1,109 +0,8 @@

import type { AgnosticDataRouteMatch, Location } from "../../router";
import type { Location } from "../../router/history";
import type { AgnosticDataRouteMatch } from "../../router/utils";
import type { AssetsManifest } from "./entry";
import type { RouteModules, RouteModule } from "./routeModules";
import type { EntryRoute } from "./routes";
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
interface HtmlLinkProps {
/**
* Address of the hyperlink
*/
href?: string;
/**
* How the element handles crossorigin requests
*/
crossOrigin?: "anonymous" | "use-credentials";
/**
* Relationship between the document containing the hyperlink and the destination resource
*/
rel: LiteralUnion<"alternate" | "dns-prefetch" | "icon" | "manifest" | "modulepreload" | "next" | "pingback" | "preconnect" | "prefetch" | "preload" | "prerender" | "search" | "stylesheet", string>;
/**
* Applicable media: "screen", "print", "(max-width: 764px)"
*/
media?: string;
/**
* Integrity metadata used in Subresource Integrity checks
*/
integrity?: string;
/**
* Language of the linked resource
*/
hrefLang?: string;
/**
* Hint for the type of the referenced resource
*/
type?: string;
/**
* Referrer policy for fetches initiated by the element
*/
referrerPolicy?: "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
/**
* Sizes of the icons (for rel="icon")
*/
sizes?: string;
/**
* Potential destination for a preload request (for rel="preload" and rel="modulepreload")
*/
as?: LiteralUnion<"audio" | "audioworklet" | "document" | "embed" | "fetch" | "font" | "frame" | "iframe" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "serviceworker" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt", string>;
/**
* Color to use when customizing a site's icon (for rel="mask-icon")
*/
color?: string;
/**
* Whether the link is disabled
*/
disabled?: boolean;
/**
* The title attribute has special semantics on this element: Title of the link; CSS style sheet set name.
*/
title?: string;
/**
* Images to use in different situations, e.g., high-resolution displays,
* small monitors, etc. (for rel="preload")
*/
imageSrcSet?: string;
/**
* Image sizes for different page layouts (for rel="preload")
*/
imageSizes?: string;
}
interface HtmlLinkPreloadImage extends HtmlLinkProps {
/**
* Relationship between the document containing the hyperlink and the destination resource
*/
rel: "preload";
/**
* Potential destination for a preload request (for rel="preload" and rel="modulepreload")
*/
as: "image";
/**
* Address of the hyperlink
*/
href?: string;
/**
* Images to use in different situations, e.g., high-resolution displays,
* small monitors, etc. (for rel="preload")
*/
imageSrcSet: string;
/**
* Image sizes for different page layouts (for rel="preload")
*/
imageSizes?: string;
}
import type { HtmlLinkDescriptor, LinkDescriptor, PageLinkDescriptor } from "../../router/links";
/**
* Represents a `<link>` element.
*
* WHATWG Specification: https://html.spec.whatwg.org/multipage/semantics.html#the-link-element
*/
export type HtmlLinkDescriptor = (HtmlLinkProps & Pick<Required<HtmlLinkProps>, "href">) | (HtmlLinkPreloadImage & Pick<Required<HtmlLinkPreloadImage>, "imageSizes">) | (HtmlLinkPreloadImage & Pick<Required<HtmlLinkPreloadImage>, "href"> & {
imageSizes?: never;
});
export interface PrefetchPageDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "type" | "sizes" | "imageSrcSet" | "imageSizes" | "as" | "color" | "title"> {
/**
* The absolute path of the page to prefetch.
*/
page: string;
}
export type LinkDescriptor = HtmlLinkDescriptor | PrefetchPageDescriptor;
/**
* Gets all the links for a set of matches. The modules are assumed to have been

@@ -114,3 +13,3 @@ * loaded already.

export declare function prefetchStyleLinks(route: EntryRoute, routeModule: RouteModule): Promise<void>;
export declare function isPageLinkDescriptor(object: any): object is PrefetchPageDescriptor;
export declare function isPageLinkDescriptor(object: any): object is PageLinkDescriptor;
export type KeyedHtmlLinkDescriptor = {

@@ -117,0 +16,0 @@ key: string;

@@ -6,5 +6,5 @@ import type { ComponentType, ReactElement } from "react";

import type { AppData } from "./data";
import type { LinkDescriptor } from "./links";
import type { EntryRoute } from "./routes";
import type { DataRouteMatch } from "../../context";
import type { LinkDescriptor } from "../../router/links";
export interface RouteModules {

@@ -11,0 +11,0 @@ [routeId: string]: RouteModule | undefined;

@@ -1,2 +0,2 @@

import type { HydrationState } from "../../router";
import type { HydrationState } from "../../router/router";
import type { RouteModule, RouteModules } from "./routeModules";

@@ -30,4 +30,4 @@ import type { FutureConfig } from "./entry";

export declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, future: FutureConfig, isSpaMode: boolean): DataRouteObject[];
export declare function createClientRoutes(manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, future: FutureConfig, isSpaMode: boolean, parentId?: string, routesByParentId?: Record<string, Omit<EntryRoute, "children">[]>, needsRevalidation?: Set<string>): DataRouteObject[];
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[];
export declare function shouldHydrateRouteLoader(route: EntryRoute, routeModule: RouteModule, isSpaMode: boolean): boolean;
export {};
import type { ReactElement } from "react";
import type { EntryContext } from "./entry";
export interface RemixServerProps {
export interface ServerRouterProps {
context: EntryContext;

@@ -16,2 +16,2 @@ url: string | URL;

*/
export declare function RemixServer({ context, url, abortDelay, nonce, }: RemixServerProps): ReactElement;
export declare function ServerRouter({ context, url, abortDelay, nonce, }: ServerRouterProps): ReactElement;
import * as React from "react";
import type { unstable_DataStrategyFunction as DataStrategyFunction } from "../../router";
import type { Router as DataRouter } from "../../router/router";
import type { DataStrategyFunction } from "../../router/utils";
import type { AssetsManifest, EntryContext } from "./entry";
import type { RouteModules } from "./routeModules";
import type { DataRouteObject } from "../../context";
export declare const SingleFetchRedirectSymbol: unique symbol;

@@ -12,2 +12,3 @@ export type SingleFetchRedirectResult = {

reload: boolean;
replace: boolean;
};

@@ -31,4 +32,3 @@ export type SingleFetchResult = {

export declare function StreamTransfer({ context, identifier, reader, textDecoder, nonce, }: StreamTransferProps): React.JSX.Element | null;
export declare function getSingleFetchDataStrategy(manifest: AssetsManifest, routeModules: RouteModules): DataStrategyFunction;
export declare function addRevalidationParam(manifest: AssetsManifest, routeModules: RouteModules, matchedRoutes: DataRouteObject[], loadRoutes: DataRouteObject[], url: URL): URL;
export declare function getSingleFetchDataStrategy(manifest: AssetsManifest, routeModules: RouteModules, getRouter: () => DataRouter): DataStrategyFunction;
export declare function singleFetchUrl(reqUrl: URL | string): URL;

@@ -35,0 +35,0 @@ export declare function decodeViaTurboStream(body: ReadableStream<Uint8Array>, global: Window | typeof globalThis): Promise<{

import * as React from "react";
import type { Blocker, BlockerFunction, Location, ParamParseKey, Params, Path, PathMatch, PathPattern, RelativeRoutingType, Router as RemixRouter, RevalidationState, To, UIMatch } from "./router";
import { Action as NavigationType } from "./router";
import type { NavigateOptions, RouteContextObject, RouteMatch, RouteObject } from "./context";
import type { Location, Path, To } from "./router/history";
import { Action as NavigationType } from "./router/history";
import type { Blocker, BlockerFunction, RelativeRoutingType, Router as DataRouter, RevalidationState } from "./router/router";
import type { ParamParseKey, Params, PathMatch, PathPattern, UIMatch } from "./router/utils";
/**

@@ -188,3 +190,3 @@ Resolves a URL against the current location.

*/
export declare function useRoutesImpl(routes: RouteObject[], locationArg?: Partial<Location> | string, dataRouterState?: RemixRouter["state"], future?: RemixRouter["future"]): React.ReactElement | null;
export declare function useRoutesImpl(routes: RouteObject[], locationArg?: Partial<Location> | string, dataRouterState?: DataRouter["state"], future?: DataRouter["future"]): React.ReactElement | null;
type RenderErrorBoundaryProps = React.PropsWithChildren<{

@@ -215,3 +217,3 @@ location: Location;

}
export declare function _renderMatches(matches: RouteMatch[] | null, parentMatches?: RouteMatch[], dataRouterState?: RemixRouter["state"] | null, future?: RemixRouter["future"] | null): React.ReactElement | null;
export declare function _renderMatches(matches: RouteMatch[] | null, parentMatches?: RouteMatch[], dataRouterState?: DataRouter["state"] | null, future?: DataRouter["future"] | null): React.ReactElement | null;
/**

@@ -234,6 +236,6 @@ * Returns the ID for the nearest contextual route

```
@category Hooks
*/
export declare function useNavigation(): import("./router").Navigation;
export declare function useNavigation(): import("./router/router").Navigation;
/**

@@ -375,3 +377,3 @@ Revalidate the data on the page for reasons outside of normal data mutations like window focus or polling on an interval.

```
@category Hooks

@@ -385,3 +387,3 @@ */

import { Await, useAsyncError } from "react-router"
function ErrorElement() {

@@ -388,0 +390,0 @@ const error = useAsyncError();

import type { History, Location, Path, To } from "./history";
import { Action as HistoryAction } from "./history";
import type { AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticRouteObject, DataStrategyFunction, DeferredData, DetectErrorBoundaryFunction, FormEncType, HTMLFormMethod, MapRoutePropertiesFunction, RouteData, Submission, UIMatch } from "./utils";
import { Action as NavigationType } from "./history";
import type { AgnosticDataRouteMatch, AgnosticDataRouteObject, AgnosticRouteObject, DataStrategyFunction, FormEncType, HTMLFormMethod, MapRoutePropertiesFunction, RouteData, Submission, UIMatch, AgnosticPatchRoutesOnNavigationFunction, DataWithResponseInit } from "./utils";
/**

@@ -165,2 +165,12 @@ * A Router instance manages all navigation and data loading/mutations

* @private
* PRIVATE DO NOT USE
*
* Patch additional children routes into an existing parent route
* @param routeId The parent route id or a callback function accepting `patch`
* to perform batch patching
* @param children The additional children routes
*/
patchRoutes(routeId: string | null, children: AgnosticRouteObject[]): void;
/**
* @private
* PRIVATE - DO NOT USE

@@ -179,9 +189,2 @@ *

_internalFetchControllers: Map<string, AbortController>;
/**
* @private
* PRIVATE - DO NOT USE
*
* Internal pending DeferredData instances accessed by unit tests
*/
_internalActiveDeferreds: Map<string, DeferredData>;
}

@@ -196,3 +199,3 @@ /**

*/
historyAction: HistoryAction;
historyAction: NavigationType;
/**

@@ -259,8 +262,2 @@ * The current location reflected by the router

export interface FutureConfig {
v7_fetcherPersist: boolean;
v7_normalizeFormMethod: boolean;
v7_partialHydration: boolean;
v7_prependBasename: boolean;
v7_relativeSplatPath: boolean;
unstable_skipActionErrorRevalidation: boolean;
}

@@ -274,6 +271,2 @@ /**

basename?: string;
/**
* @deprecated Use `mapRouteProperties` instead
*/
detectErrorBoundary?: DetectErrorBoundaryFunction;
mapRouteProperties?: MapRoutePropertiesFunction;

@@ -283,3 +276,4 @@ future?: Partial<FutureConfig>;

window?: Window;
unstable_dataStrategy?: DataStrategyFunction;
dataStrategy?: DataStrategyFunction;
patchRoutesOnNavigation?: AgnosticPatchRoutesOnNavigationFunction;
}

@@ -299,3 +293,2 @@ /**

actionHeaders: Record<string, Headers>;
activeDeferreds: Record<string, DeferredData> | null;
_deepestRenderedBoundaryId?: string | null;

@@ -311,3 +304,3 @@ }

skipLoaderErrorBubbling?: boolean;
unstable_dataStrategy?: DataStrategyFunction;
dataStrategy?: DataStrategyFunction;
}): Promise<StaticHandlerContext | Response>;

@@ -317,3 +310,3 @@ queryRoute(request: Request, opts?: {

requestContext?: unknown;
unstable_dataStrategy?: DataStrategyFunction;
dataStrategy?: DataStrategyFunction;
}): Promise<any>;

@@ -331,4 +324,4 @@ }

deletedFetchers: string[];
unstable_viewTransitionOpts?: ViewTransitionOpts;
unstable_flushSync: boolean;
viewTransitionOpts?: ViewTransitionOpts;
flushSync: boolean;
}): void;

@@ -357,3 +350,3 @@ }

relative?: RelativeRoutingType;
unstable_flushSync?: boolean;
flushSync?: boolean;
};

@@ -364,3 +357,3 @@ type BaseNavigateOptions = BaseNavigateOrFetchOptions & {

fromRouteId?: string;
unstable_viewTransition?: boolean;
viewTransition?: boolean;
};

@@ -536,3 +529,3 @@ type BaseSubmissionOptions = {

nextLocation: Location;
historyAction: HistoryAction;
historyAction: NavigationType;
}) => boolean;

@@ -546,18 +539,6 @@ export declare const IDLE_NAVIGATION: NavigationStates["Idle"];

export declare function createRouter(init: RouterInit): Router;
export declare const UNSAFE_DEFERRED_SYMBOL: unique symbol;
/**
* Future flags to toggle new feature behavior
*/
export interface StaticHandlerFutureConfig {
v7_relativeSplatPath: boolean;
v7_throwAbortReason: boolean;
}
export interface CreateStaticHandlerOptions {
basename?: string;
/**
* @deprecated Use `mapRouteProperties` instead
*/
detectErrorBoundary?: DetectErrorBoundaryFunction;
mapRouteProperties?: MapRoutePropertiesFunction;
future?: Partial<StaticHandlerFutureConfig>;
future?: {};
}

@@ -572,8 +553,3 @@ export declare function createStaticHandler(routes: AgnosticRouteObject[], opts?: CreateStaticHandlerOptions): StaticHandler;

export declare function getStaticContextFromError(routes: AgnosticDataRouteObject[], context: StaticHandlerContext, error: any): StaticHandlerContext;
export declare function isDeferredData(value: any): value is DeferredData;
export declare function createDeferred<T = unknown>(): {
promise: Promise<T>;
resolve: (val?: any) => Promise<void>;
reject: (error?: Error) => Promise<void>;
};
export declare function isDataWithResponseInit(value: any): value is DataWithResponseInit<unknown>;
export {};

@@ -0,1 +1,2 @@

import type { JsonFunction } from "../server-runtime/responses";
import type { Location, Path, To } from "./history";

@@ -10,3 +11,2 @@ /**

data = "data",
deferred = "deferred",
redirect = "redirect",

@@ -25,11 +25,2 @@ error = "error"

/**
* Successful defer() result from a loader or action
*/
export interface DeferredResult {
type: ResultType.deferred;
deferredData: DeferredData;
statusCode?: number;
headers?: Headers;
}
/**
* Redirect result from a loader or action

@@ -53,11 +44,3 @@ */

*/
export type DataResult = SuccessResult | DeferredResult | RedirectResult | ErrorResult;
/**
* Result from a loader or action called via dataStrategy
*/
export interface HandlerResult {
type: "data" | "error";
result: unknown;
status?: number;
}
export type DataResult = SuccessResult | RedirectResult | ErrorResult;
export type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete";

@@ -71,13 +54,7 @@ export type UpperCaseFormMethod = Uppercase<LowerCaseFormMethod>;

/**
* Active navigation/fetcher form methods are exposed in lowercase on the
* RouterState
* Active navigation/fetcher form methods are exposed in uppercase on the
* RouterState. This is to align with the normalization done via fetch().
*/
export type FormMethod = LowerCaseFormMethod;
export type MutationFormMethod = Exclude<FormMethod, "get">;
/**
* In v7, active navigation/fetcher form methods are exposed in uppercase on the
* RouterState. This is to align with the normalization done via fetch().
*/
export type V7_FormMethod = UpperCaseFormMethod;
export type V7_MutationFormMethod = Exclude<V7_FormMethod, "GET">;
export type FormMethod = UpperCaseFormMethod;
export type MutationFormMethod = Exclude<FormMethod, "GET">;
export type FormEncType = "application/x-www-form-urlencoded" | "multipart/form-data" | "application/json" | "text/plain";

@@ -98,3 +75,3 @@ type JsonObject = {

export type Submission = {
formMethod: FormMethod | V7_FormMethod;
formMethod: FormMethod;
formAction: string;

@@ -106,3 +83,3 @@ formEncType: FormEncType;

} | {
formMethod: FormMethod | V7_FormMethod;
formMethod: FormMethod;
formAction: string;

@@ -114,3 +91,3 @@ formEncType: FormEncType;

} | {
formMethod: FormMethod | V7_FormMethod;
formMethod: FormMethod;
formAction: string;

@@ -177,3 +154,3 @@ formEncType: FormEncType;

json?: Submission["json"];
unstable_actionStatus?: number;
actionStatus?: number;
actionResult?: any;

@@ -192,21 +169,26 @@ defaultShouldRevalidate: boolean;

}
/**
* Function provided by the framework-aware layers to set `hasErrorBoundary`
* from the framework-aware `errorElement` prop
*
* @deprecated Use `mapRouteProperties` instead
*/
export interface DetectErrorBoundaryFunction {
(route: AgnosticRouteObject): boolean;
}
export interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRouteObject> {
shouldLoad: boolean;
resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => Promise<HandlerResult>) => Promise<HandlerResult>;
resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
}
export interface DataStrategyFunctionArgs<Context = any> extends DataFunctionArgs<Context> {
matches: DataStrategyMatch[];
fetcherKey: string | null;
}
/**
* Result from a loader or action called via dataStrategy
*/
export interface DataStrategyResult {
type: "data" | "error";
result: unknown;
}
export interface DataStrategyFunction {
(args: DataStrategyFunctionArgs): Promise<HandlerResult[]>;
(args: DataStrategyFunctionArgs): Promise<Record<string, DataStrategyResult>>;
}
export type AgnosticPatchRoutesOnNavigationFunctionArgs<O extends AgnosticRouteObject = AgnosticRouteObject, M extends AgnosticRouteMatch = AgnosticRouteMatch> = {
path: string;
matches: M[];
patch: (routeId: string | null, children: O[]) => void;
};
export type AgnosticPatchRoutesOnNavigationFunction<O extends AgnosticRouteObject = AgnosticRouteObject, M extends AgnosticRouteMatch = AgnosticRouteMatch> = (opts: AgnosticPatchRoutesOnNavigationFunctionArgs<O, M>) => void | Promise<void>;
/**

@@ -326,3 +308,3 @@ * Function provided by the framework-aware layers to set any framework-specific

}
export declare function convertRoutesToDataRoutes(routes: AgnosticRouteObject[], mapRouteProperties: MapRoutePropertiesFunction, parentPath?: number[], manifest?: RouteManifest): AgnosticDataRouteObject[];
export declare function convertRoutesToDataRoutes(routes: AgnosticRouteObject[], mapRouteProperties: MapRoutePropertiesFunction, parentPath?: string[], manifest?: RouteManifest): AgnosticDataRouteObject[];
/**

@@ -334,2 +316,3 @@ * Matches the given routes to a location and returns the match data.

export declare function matchRoutes<RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string, basename?: string): AgnosticRouteMatch<string, RouteObjectType>[] | null;
export declare function matchRoutesImpl<RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject>(routes: RouteObjectType[], locationArg: Partial<Location> | string, basename: string, allowPartial: boolean): AgnosticRouteMatch<string, RouteObjectType>[] | null;
export interface UIMatch<Data = unknown, Handle = unknown> {

@@ -399,2 +382,3 @@ id: string;

export declare function matchPath<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamKey> | null;
export declare function decodePath(value: string): string;
/**

@@ -434,3 +418,3 @@ * @private

export declare function getPathContributingMatches<T extends AgnosticRouteMatch = AgnosticRouteMatch>(matches: T[]): T[];
export declare function getResolveToMatches<T extends AgnosticRouteMatch = AgnosticRouteMatch>(matches: T[], v7_relativeSplatPath: boolean): string[];
export declare function getResolveToMatches<T extends AgnosticRouteMatch = AgnosticRouteMatch>(matches: T[]): string[];
/**

@@ -443,6 +427,2 @@ * @private

*/
export declare function getToPathname(to: To): string | undefined;
/**
* @private
*/
export declare const joinPaths: (paths: string[]) => string;

@@ -461,3 +441,2 @@ /**

export declare const normalizeHash: (hash: string) => string;
export type JsonFunction = <Data>(data: Data, init?: number | ResponseInit) => Response;
/**

@@ -470,2 +449,15 @@ * This is a shortcut for creating `application/json` responses. Converts `data`

export declare const json: JsonFunction;
export declare class DataWithResponseInit<D> {
type: string;
data: D;
init: ResponseInit | null;
constructor(data: D, init?: ResponseInit);
}
/**
* Create "responses" that contain `status`/`headers` without forcing
* serialization into an actual `Response` - used by Remix single fetch
*
* @category Utils
*/
export declare function data<D>(data: D, init?: number | ResponseInit): DataWithResponseInit<D>;
export interface TrackedPromise extends Promise<any> {

@@ -476,29 +468,2 @@ _tracked?: boolean;

}
export declare class AbortedDeferredError extends Error {
}
export declare class DeferredData {
private pendingKeysSet;
private controller;
private abortPromise;
private unlistenAbortSignal;
private subscribers;
data: Record<string, unknown>;
init?: ResponseInit;
deferredKeys: string[];
constructor(data: Record<string, unknown>, responseInit?: ResponseInit);
private trackPromise;
private onSettle;
private emit;
subscribe(fn: (aborted: boolean, settledKey?: string) => void): () => boolean;
cancel(): void;
resolveData(signal: AbortSignal): Promise<boolean>;
get done(): boolean;
get unwrappedData(): {};
get pendingKeys(): string[];
}
export type DeferFunction = (data: Record<string, unknown>, init?: number | ResponseInit) => DeferredData;
/**
* @category Utils
*/
export declare const defer: DeferFunction;
export type RedirectFunction = (url: string, init?: number | ResponseInit) => Response;

@@ -520,2 +485,11 @@ /**

export declare const redirectDocument: RedirectFunction;
/**
* A redirect response that will perform a `history.replaceState` instead of a
* `history.pushState` for client-side navigation redirects.
* Sets the status code and the `Location` header.
* Defaults to "302 Found".
*
* @category Utils
*/
export declare const replace: RedirectFunction;
export type ErrorResponse = {

@@ -522,0 +496,0 @@ status: number;

/**
* React Router v0.0.0-nightly-a9e1d47b6-20240619
* React Router v0.0.0-nightly-ac199f437-20241014
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

{
"name": "react-router",
"version": "0.0.0-nightly-a9e1d47b6-20240619",
"version": "0.0.0-nightly-ac199f437-20241014",
"description": "Declarative routing for React",

@@ -23,8 +23,31 @@ "keywords": [

"unpkg": "./dist/umd/react-router.production.min.js",
"module": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/main.js"
},
"./types": {
"types": "./dist/lib/types.d.ts"
},
"./dom": {
"types": "./dist/dom-export.d.ts",
"import": "./dist/dom-export.mjs",
"require": "./dist/main-dom-export.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"turbo-stream": "^2.0.0"
"@types/cookie": "^0.6.0",
"@web3-storage/multipart-parser": "^1.0.0",
"cookie": "^0.6.0",
"set-cookie-parser": "^2.6.0",
"source-map": "^0.7.3",
"turbo-stream": "2.4.0",
"react-router": "0.0.0-nightly-ac199f437-20241014"
},
"devDependencies": {
"@types/set-cookie-parser": "^2.4.1",
"react": "^18.2.0",

@@ -34,4 +57,4 @@ "react-dom": "^18.2.0"

"peerDependencies": {
"react": ">=16.8",
"react-dom": ">=16.8"
"react": ">=18",
"react-dom": ">=18"
},

@@ -50,4 +73,4 @@ "peerDependenciesMeta": {

"engines": {
"node": ">=14.0.0"
"node": ">=18.0.0"
}
}
# React Router
The `react-router` package is the heart of [React Router](https://github.com/remix-run/react-router) and provides all the core functionality.
If you'd like to extend React Router and you know what you're doing, you should
add `react-router` **as a peer dependency, not a regular dependency** in your
package.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc