react-router 7.0.0-pre.5 → 7.0.0

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 (42) hide show
  1. package/CHANGELOG.md +98 -184
  2. package/dist/{chunk-ICGFMBUV.mjs → development/chunk-U6WQEHBI.mjs} +4 -3
  3. package/dist/development/data-CQbyyGzl.d.mts +11 -0
  4. package/dist/development/data-CQbyyGzl.d.ts +11 -0
  5. package/dist/development/dom-export.d.mts +13 -0
  6. package/dist/{dom-export.d.ts → development/dom-export.d.ts} +2 -2
  7. package/dist/{dom-export.js → development/dom-export.js} +1 -1
  8. package/dist/{dom-export.mjs → development/dom-export.mjs} +2 -2
  9. package/dist/development/fog-of-war-BDQTYoRQ.d.mts +1595 -0
  10. package/dist/{fog-of-war-BijhfqFM.d.ts → development/fog-of-war-CbNQuoo8.d.ts} +2 -2
  11. package/dist/development/index.d.mts +840 -0
  12. package/dist/{index.d.ts → development/index.d.ts} +6 -5
  13. package/dist/{index.js → development/index.js} +4 -3
  14. package/dist/{index.mjs → development/index.mjs} +2 -2
  15. package/dist/development/lib/types/route-module.d.mts +102 -0
  16. package/dist/development/lib/types/route-module.d.ts +102 -0
  17. package/dist/{lib/types.js → development/lib/types/route-module.js} +4 -4
  18. package/dist/{lib/types.mjs → development/lib/types/route-module.mjs} +1 -1
  19. package/dist/{types-BlYP8xpH.d.mts → development/route-data-DuV3tXo2.d.mts} +20 -94
  20. package/dist/{types-BlYP8xpH.d.ts → development/route-data-DuV3tXo2.d.ts} +20 -94
  21. package/dist/production/chunk-L6MGG5FJ.mjs +9618 -0
  22. package/dist/production/data-CQbyyGzl.d.mts +11 -0
  23. package/dist/production/data-CQbyyGzl.d.ts +11 -0
  24. package/dist/production/dom-export.d.mts +13 -0
  25. package/dist/{dom-export.d.mts → production/dom-export.d.ts} +2 -2
  26. package/dist/production/dom-export.js +5502 -0
  27. package/dist/production/dom-export.mjs +199 -0
  28. package/dist/production/fog-of-war-BDQTYoRQ.d.mts +1595 -0
  29. package/dist/{fog-of-war-Bz_EDtxF.d.mts → production/fog-of-war-CbNQuoo8.d.ts} +2 -2
  30. package/dist/production/index.d.mts +840 -0
  31. package/dist/{index.d.mts → production/index.d.ts} +6 -5
  32. package/dist/production/index.js +9764 -0
  33. package/dist/production/index.mjs +235 -0
  34. package/dist/production/lib/types/route-module.d.mts +102 -0
  35. package/dist/production/lib/types/route-module.d.ts +102 -0
  36. package/dist/production/lib/types/route-module.js +28 -0
  37. package/dist/production/lib/types/route-module.mjs +10 -0
  38. package/dist/production/route-data-DuV3tXo2.d.mts +1546 -0
  39. package/dist/production/route-data-DuV3tXo2.d.ts +1546 -0
  40. package/package.json +37 -23
  41. package/dist/lib/types.d.mts +0 -2
  42. package/dist/lib/types.d.ts +0 -2
@@ -423,16 +423,13 @@ type AgnosticDataNonIndexRouteObject = AgnosticNonIndexRouteObject & {
423
423
  */
424
424
  type AgnosticDataRouteObject = AgnosticDataIndexRouteObject | AgnosticDataNonIndexRouteObject;
425
425
  type RouteManifest<R = AgnosticDataRouteObject> = Record<string, R | undefined>;
426
- type _PathParam<Path extends string> = Path extends `${infer L}/${infer R}` ? _PathParam<L> | _PathParam<R> : Path extends `:${infer Param}` ? Param extends `${infer Optional}?` ? Optional : Param : never;
427
- /**
428
- * Examples:
429
- * "/a/b/*" -> "*"
430
- * ":a" -> "a"
431
- * "/a/:b" -> "b"
432
- * "/a/blahblahblah:b" -> "b"
433
- * "/:a/:b" -> "a" | "b"
434
- * "/:a/b/:c/*" -> "a" | "c" | "*"
435
- */
426
+ type Regex_az = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
427
+ type Regez_AZ = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z";
428
+ type Regex_09 = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
429
+ type Regex_w = Regex_az | Regez_AZ | Regex_09 | "_";
430
+ type ParamChar = Regex_w | "-";
431
+ type RegexMatchPlus<CharPattern extends string, T extends string> = T extends `${infer First}${infer Rest}` ? First extends CharPattern ? RegexMatchPlus<CharPattern, Rest> extends never ? First : `${First}${RegexMatchPlus<CharPattern, Rest>}` : never : never;
432
+ type _PathParam<Path extends string> = Path extends `${infer L}/${infer R}` ? _PathParam<L> | _PathParam<R> : Path extends `:${infer Param}` ? Param extends `${infer Optional}?${string}` ? RegexMatchPlus<ParamChar, Optional> : RegexMatchPlus<ParamChar, Param> : never;
436
433
  type PathParam<Path extends string> = Path extends "*" | "/*" ? "*" : Path extends `${infer Rest}/*` ? "*" | _PathParam<Rest> : _PathParam<Path>;
437
434
  type ParamParseKey<Segment extends string> = [
438
435
  PathParam<Segment>
@@ -1350,9 +1347,9 @@ interface PageLinkDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "
1350
1347
  type LinkDescriptor = HtmlLinkDescriptor | PageLinkDescriptor;
1351
1348
 
1352
1349
  interface RouteModules {
1353
- [routeId: string]: RouteModule$1 | undefined;
1350
+ [routeId: string]: RouteModule | undefined;
1354
1351
  }
1355
- interface RouteModule$1 {
1352
+ interface RouteModule {
1356
1353
  clientAction?: ClientActionFunction;
1357
1354
  clientLoader?: ClientLoaderFunction;
1358
1355
  ErrorBoundary?: ErrorBoundaryComponent;
@@ -1524,97 +1521,26 @@ type RouteComponent = ComponentType<{}>;
1524
1521
  */
1525
1522
  type RouteHandle = unknown;
1526
1523
 
1527
- /**
1528
- * An object of unknown type for route loaders and actions provided by the
1529
- * server's `getLoadContext()` function. This is defined as an empty interface
1530
- * specifically so apps can leverage declaration merging to augment this type
1531
- * globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
1532
- */
1533
- interface AppLoadContext {
1534
- [key: string]: unknown;
1535
- }
1536
-
1537
1524
  type Serializable = undefined | null | boolean | string | symbol | number | Array<Serializable> | {
1538
1525
  [key: PropertyKey]: Serializable;
1539
1526
  } | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>;
1540
1527
 
1541
- type Expect<T extends true> = T;
1542
1528
  type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
1543
1529
  type IsAny<T> = 0 extends 1 & T ? true : false;
1544
- type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
1545
- type Fn = (...args: any[]) => unknown;
1546
- type RouteModule = {
1547
- loader?: Fn;
1548
- clientLoader?: Fn;
1549
- action?: Fn;
1550
- clientAction?: Fn;
1551
- HydrateFallback?: unknown;
1552
- default?: unknown;
1553
- ErrorBoundary?: unknown;
1554
- };
1530
+ type Func = (...args: any[]) => unknown;
1531
+ type Pretty<T> = {
1532
+ [K in keyof T]: T[K];
1533
+ } & {};
1534
+
1535
+ type Serialize<T> = T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
1536
+ [K in keyof T]: Serialize<T[K]>;
1537
+ } : undefined;
1555
1538
  type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
1556
- type DataFrom<T> = IsAny<T> extends true ? undefined : T extends Fn ? VoidToUndefined<Awaited<ReturnType<T>>> : undefined;
1539
+ type DataFrom<T> = IsAny<T> extends true ? undefined : T extends Func ? VoidToUndefined<Awaited<ReturnType<T>>> : undefined;
1557
1540
  type ClientData<T> = T extends DataWithResponseInit<infer U> ? U : T;
1558
1541
  type ServerData<T> = T extends DataWithResponseInit<infer U> ? Serialize<U> : Serialize<T>;
1559
1542
  type ServerDataFrom<T> = ServerData<DataFrom<T>>;
1560
1543
  type ClientDataFrom<T> = ClientData<DataFrom<T>>;
1561
- type IsHydrate<ClientLoader> = ClientLoader extends {
1562
- hydrate: true;
1563
- } ? true : ClientLoader extends {
1564
- hydrate: false;
1565
- } ? false : false;
1566
- type CreateLoaderData<T extends RouteModule> = _CreateLoaderData<ServerDataFrom<T["loader"]>, ClientDataFrom<T["clientLoader"]>, IsHydrate<T["clientLoader"]>, T extends {
1567
- HydrateFallback: Fn;
1568
- } ? true : false>;
1569
- type _CreateLoaderData<ServerLoaderData, ClientLoaderData, ClientLoaderHydrate extends boolean, HasHydrateFallback> = [
1570
- HasHydrateFallback,
1571
- ClientLoaderHydrate
1572
- ] extends [true, true] ? IsDefined<ClientLoaderData> extends true ? ClientLoaderData : undefined : [
1573
- IsDefined<ClientLoaderData>,
1574
- IsDefined<ServerLoaderData>
1575
- ] extends [true, true] ? ServerLoaderData | ClientLoaderData : IsDefined<ClientLoaderData> extends true ? ClientLoaderData : IsDefined<ServerLoaderData> extends true ? ServerLoaderData : undefined;
1576
- type CreateActionData<T extends RouteModule> = _CreateActionData<ServerDataFrom<T["action"]>, ClientDataFrom<T["clientAction"]>>;
1577
- type _CreateActionData<ServerActionData, ClientActionData> = Awaited<[
1578
- IsDefined<ServerActionData>,
1579
- IsDefined<ClientActionData>
1580
- ] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
1581
- type ClientDataFunctionArgs<Params> = {
1582
- request: Request;
1583
- params: Params;
1584
- };
1585
- type ServerDataFunctionArgs<Params> = ClientDataFunctionArgs<Params> & {
1586
- context: AppLoadContext;
1587
- };
1588
- type Serialize<T> = T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
1589
- [K in keyof T]: Serialize<T[K]>;
1590
- } : undefined;
1591
- /**
1592
- * @deprecated Generics on data APIs such as `useLoaderData`, `useActionData`,
1593
- * `meta`, etc. are deprecated in favor of the `Route.*` types generated via
1594
- * `react-router typegen`
1595
- */
1596
- type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientData<DataFrom<T>> : ServerData<DataFrom<T>> : T;
1597
- type CreateServerLoaderArgs<Params> = ServerDataFunctionArgs<Params>;
1598
- type CreateClientLoaderArgs<Params, T extends RouteModule> = ClientDataFunctionArgs<Params> & {
1599
- serverLoader: () => Promise<ServerDataFrom<T["loader"]>>;
1600
- };
1601
- type CreateServerActionArgs<Params> = ServerDataFunctionArgs<Params>;
1602
- type CreateClientActionArgs<Params, T extends RouteModule> = ClientDataFunctionArgs<Params> & {
1603
- serverAction: () => Promise<ServerDataFrom<T["action"]>>;
1604
- };
1605
- type CreateHydrateFallbackProps<Params> = {
1606
- params: Params;
1607
- };
1608
- type CreateComponentProps<Params, LoaderData, ActionData> = {
1609
- params: Params;
1610
- loaderData: LoaderData;
1611
- actionData?: ActionData;
1612
- };
1613
- type CreateErrorBoundaryProps<Params, LoaderData, ActionData> = {
1614
- params: Params;
1615
- error: unknown;
1616
- loaderData?: LoaderData;
1617
- actionData?: ActionData;
1618
- };
1544
+ type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
1619
1545
 
1620
- export { type FormMethod as $, type ActionFunction as A, type BlockerFunction as B, type ClientActionFunction as C, type DataStrategyFunction as D, type NavigationStates as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterInit as J, type RouterSubscriber as K, type LoaderFunction as L, type MetaFunction as M, type NavigateOptions as N, type RouterNavigateOptions as O, type ParamParseKey as P, type RouterFetchOptions as Q, type RouteModules as R, type SerializeFrom as S, type To as T, type UIMatch as U, type DataStrategyFunctionArgs as V, type DataStrategyMatch as W, type DataStrategyResult as X, DataWithResponseInit as Y, type ErrorResponse as Z, type FormEncType as _, type Router as a, type HTMLFormMethod as a0, type LazyRouteFunction as a1, type PathParam as a2, type RedirectFunction as a3, type ShouldRevalidateFunction as a4, type ShouldRevalidateFunctionArgs as a5, createPath as a6, parsePath as a7, IDLE_NAVIGATION as a8, IDLE_FETCHER as a9, ErrorResponseImpl as aA, DataRouterContext as aB, DataRouterStateContext as aC, FetchersContext as aD, LocationContext as aE, NavigationContext as aF, RouteContext as aG, ViewTransitionContext as aH, type RouteModule$1 as aI, type History as aJ, type Expect as aK, type CreateLoaderData as aL, type CreateActionData as aM, type CreateServerLoaderArgs as aN, type CreateClientLoaderArgs as aO, type CreateServerActionArgs as aP, type CreateClientActionArgs as aQ, type CreateHydrateFallbackProps as aR, type CreateComponentProps as aS, type CreateErrorBoundaryProps as aT, IDLE_BLOCKER as aa, data as ab, generatePath as ac, isRouteErrorResponse as ad, matchPath as ae, matchRoutes as af, redirect as ag, redirectDocument as ah, replace as ai, resolvePath as aj, type DataRouteMatch as ak, type DataRouteObject as al, type Navigator as am, type PatchRoutesOnNavigationFunction as an, type PatchRoutesOnNavigationFunctionArgs as ao, type RouteMatch as ap, type ClientActionFunctionArgs as aq, type ClientLoaderFunctionArgs as ar, type MetaArgs as as, type MetaDescriptor as at, type PageLinkDescriptor as au, type HtmlLinkDescriptor as av, type LinkDescriptor as aw, createBrowserHistory as ax, invariant as ay, createRouter as az, type ClientLoaderFunction as b, type LinksFunction as c, type RouteManifest as d, type AppLoadContext as e, type LoaderFunctionArgs as f, type ActionFunctionArgs as g, type RelativeRoutingType as h, type Location as i, Action as j, type Path as k, type PathPattern as l, type PathMatch as m, type Params as n, type RouteObject as o, type Navigation as p, type RevalidationState as q, type Blocker as r, type StaticHandlerContext as s, type StaticHandler as t, type CreateStaticHandlerOptions as u, type IndexRouteObject as v, type NonIndexRouteObject as w, type RouterState as x, type GetScrollRestorationKeyFunction as y, type Fetcher as z };
1546
+ export { type HTMLFormMethod as $, type ActionFunction as A, type BlockerFunction as B, type ClientActionFunction as C, type DataStrategyFunction as D, type RouterInit as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterSubscriber as J, type RouterNavigateOptions as K, type LoaderFunction as L, type MetaFunction as M, type NavigateOptions as N, type RouterFetchOptions as O, type ParamParseKey as P, type DataStrategyFunctionArgs as Q, type RouteModules as R, type SerializeFrom as S, type To as T, type UIMatch as U, type DataStrategyMatch as V, type DataStrategyResult as W, DataWithResponseInit as X, type ErrorResponse as Y, type FormEncType as Z, type FormMethod as _, type Router as a, type LazyRouteFunction as a0, type PathParam as a1, type RedirectFunction as a2, type ShouldRevalidateFunction as a3, type ShouldRevalidateFunctionArgs as a4, createPath as a5, parsePath as a6, IDLE_NAVIGATION as a7, IDLE_FETCHER as a8, IDLE_BLOCKER as a9, DataRouterContext as aA, DataRouterStateContext as aB, FetchersContext as aC, LocationContext as aD, NavigationContext as aE, RouteContext as aF, ViewTransitionContext as aG, type RouteModule as aH, type History as aI, type ServerDataFrom as aJ, type ClientDataFrom as aK, type Func as aL, type Equal as aM, type Pretty as aN, data as aa, generatePath as ab, isRouteErrorResponse as ac, matchPath as ad, matchRoutes as ae, redirect as af, redirectDocument as ag, replace as ah, resolvePath as ai, type DataRouteMatch as aj, type DataRouteObject as ak, type Navigator as al, type PatchRoutesOnNavigationFunction as am, type PatchRoutesOnNavigationFunctionArgs as an, type RouteMatch as ao, type ClientActionFunctionArgs as ap, type ClientLoaderFunctionArgs as aq, type MetaArgs as ar, type MetaDescriptor as as, type PageLinkDescriptor as at, type HtmlLinkDescriptor as au, type LinkDescriptor as av, createBrowserHistory as aw, invariant as ax, createRouter as ay, ErrorResponseImpl as az, type ClientLoaderFunction as b, type LinksFunction as c, type RouteManifest as d, type LoaderFunctionArgs as e, type ActionFunctionArgs as f, type RelativeRoutingType as g, type Location as h, Action as i, type Path as j, type PathPattern as k, type PathMatch as l, type Params as m, type RouteObject as n, type Navigation as o, type RevalidationState as p, type Blocker as q, type StaticHandlerContext as r, type StaticHandler as s, type CreateStaticHandlerOptions as t, type IndexRouteObject as u, type NonIndexRouteObject as v, type RouterState as w, type GetScrollRestorationKeyFunction as x, type Fetcher as y, type NavigationStates as z };