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.
- package/CHANGELOG.md +98 -184
- package/dist/{chunk-ICGFMBUV.mjs → development/chunk-U6WQEHBI.mjs} +4 -3
- package/dist/development/data-CQbyyGzl.d.mts +11 -0
- package/dist/development/data-CQbyyGzl.d.ts +11 -0
- package/dist/development/dom-export.d.mts +13 -0
- package/dist/{dom-export.d.ts → development/dom-export.d.ts} +2 -2
- package/dist/{dom-export.js → development/dom-export.js} +1 -1
- package/dist/{dom-export.mjs → development/dom-export.mjs} +2 -2
- package/dist/development/fog-of-war-BDQTYoRQ.d.mts +1595 -0
- package/dist/{fog-of-war-BijhfqFM.d.ts → development/fog-of-war-CbNQuoo8.d.ts} +2 -2
- package/dist/development/index.d.mts +840 -0
- package/dist/{index.d.ts → development/index.d.ts} +6 -5
- package/dist/{index.js → development/index.js} +4 -3
- package/dist/{index.mjs → development/index.mjs} +2 -2
- package/dist/development/lib/types/route-module.d.mts +102 -0
- package/dist/development/lib/types/route-module.d.ts +102 -0
- package/dist/{lib/types.js → development/lib/types/route-module.js} +4 -4
- package/dist/{lib/types.mjs → development/lib/types/route-module.mjs} +1 -1
- package/dist/{types-BlYP8xpH.d.mts → development/route-data-DuV3tXo2.d.mts} +20 -94
- package/dist/{types-BlYP8xpH.d.ts → development/route-data-DuV3tXo2.d.ts} +20 -94
- package/dist/production/chunk-L6MGG5FJ.mjs +9618 -0
- package/dist/production/data-CQbyyGzl.d.mts +11 -0
- package/dist/production/data-CQbyyGzl.d.ts +11 -0
- package/dist/production/dom-export.d.mts +13 -0
- package/dist/{dom-export.d.mts → production/dom-export.d.ts} +2 -2
- package/dist/production/dom-export.js +5502 -0
- package/dist/production/dom-export.mjs +199 -0
- package/dist/production/fog-of-war-BDQTYoRQ.d.mts +1595 -0
- package/dist/{fog-of-war-Bz_EDtxF.d.mts → production/fog-of-war-CbNQuoo8.d.ts} +2 -2
- package/dist/production/index.d.mts +840 -0
- package/dist/{index.d.mts → production/index.d.ts} +6 -5
- package/dist/production/index.js +9764 -0
- package/dist/production/index.mjs +235 -0
- package/dist/production/lib/types/route-module.d.mts +102 -0
- package/dist/production/lib/types/route-module.d.ts +102 -0
- package/dist/production/lib/types/route-module.js +28 -0
- package/dist/production/lib/types/route-module.mjs +10 -0
- package/dist/production/route-data-DuV3tXo2.d.mts +1546 -0
- package/dist/production/route-data-DuV3tXo2.d.ts +1546 -0
- package/package.json +37 -23
- package/dist/lib/types.d.mts +0 -2
- 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
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
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
|
|
1350
|
+
[routeId: string]: RouteModule | undefined;
|
|
1354
1351
|
}
|
|
1355
|
-
interface RouteModule
|
|
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
|
|
1545
|
-
type
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
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
|
|
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
|
|
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
|
|
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 };
|