react-router 0.0.0-experimental-b588f7e → 0.0.0-experimental-23decd7bc
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 +28 -0
- package/dist/development/browser-CmIT056Z.d.mts +154 -0
- package/dist/development/chunk-3E3CD4NY.mjs +2669 -0
- package/dist/development/{chunk-3HOZPCHX.mjs → chunk-GJVCYY62.mjs} +1445 -3021
- package/dist/development/chunk-H2M6MMUH.js +10007 -0
- package/dist/development/chunk-I3MHZ4NU.js +21 -0
- package/dist/development/components-CwtESh53.d.mts +816 -0
- package/dist/development/dom-export.d.mts +4 -2
- package/dist/development/dom-export.js +53 -72
- package/dist/development/dom-export.mjs +7 -4
- package/dist/development/index-react-server-client-CzKQ01cq.d.mts +1360 -0
- package/dist/development/{lib-oW7CoPA6.d.mts → index-react-server-client-unV28389.d.ts} +39 -39
- package/dist/development/index-react-server-client.d.mts +4 -0
- package/dist/development/index-react-server-client.d.ts +3 -0
- package/dist/development/index-react-server-client.js +54 -0
- package/dist/development/index-react-server-client.mjs +53 -0
- package/dist/development/index-react-server.d.mts +1861 -0
- package/dist/development/index-react-server.d.ts +1861 -0
- package/dist/development/index-react-server.js +3137 -0
- package/dist/development/index-react-server.mjs +3025 -0
- package/dist/development/index.d.mts +32 -46
- package/dist/development/index.d.ts +191 -2223
- package/dist/development/index.js +2577 -11464
- package/dist/development/index.mjs +33 -22
- package/dist/development/lib/types/internal.d.mts +8 -72
- package/dist/development/lib/types/internal.d.ts +8 -71
- package/dist/development/lib/types/internal.js +2 -20
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/{production/register-DeIo2iHO.d.mts → development/register-DiOIlEq5.d.mts} +1 -1
- package/dist/development/{register-DeIo2iHO.d.mts → register-DiOIlEq5.d.ts} +1 -1
- package/dist/development/{route-data-ByAYLHuM.d.mts → route-data-Csr8hE3v.d.mts} +80 -3
- package/dist/{production/register-DCE0tH5m.d.ts → development/route-data-x_b_BLCv.d.ts} +90 -36
- package/dist/production/browser-CmIT056Z.d.mts +154 -0
- package/dist/production/chunk-7TUGB72O.js +10007 -0
- package/dist/production/chunk-I3MHZ4NU.js +21 -0
- package/dist/production/chunk-XNTCWHOK.mjs +2669 -0
- package/dist/production/{chunk-UROK22QK.mjs → chunk-YWCG2M57.mjs} +1445 -3021
- package/dist/production/components-CwtESh53.d.mts +816 -0
- package/dist/production/dom-export.d.mts +4 -2
- package/dist/production/dom-export.js +53 -72
- package/dist/production/dom-export.mjs +7 -4
- package/dist/production/index-react-server-client-CzKQ01cq.d.mts +1360 -0
- package/dist/production/{lib-oW7CoPA6.d.mts → index-react-server-client-unV28389.d.ts} +39 -39
- package/dist/production/index-react-server-client.d.mts +4 -0
- package/dist/production/index-react-server-client.d.ts +3 -0
- package/dist/production/index-react-server-client.js +54 -0
- package/dist/production/index-react-server-client.mjs +53 -0
- package/dist/production/index-react-server.d.mts +1861 -0
- package/dist/production/index-react-server.d.ts +1861 -0
- package/dist/production/index-react-server.js +3137 -0
- package/dist/production/index-react-server.mjs +3025 -0
- package/dist/production/index.d.mts +32 -46
- package/dist/production/index.d.ts +191 -2223
- package/dist/production/index.js +2577 -11464
- package/dist/production/index.mjs +33 -22
- package/dist/production/lib/types/internal.d.mts +8 -72
- package/dist/production/lib/types/internal.d.ts +8 -71
- package/dist/production/lib/types/internal.js +2 -20
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/register-DiOIlEq5.d.mts +24 -0
- package/dist/production/register-DiOIlEq5.d.ts +24 -0
- package/dist/{development/register-DCE0tH5m.d.ts → production/route-data-Csr8hE3v.d.mts} +80 -26
- package/dist/production/{route-data-ByAYLHuM.d.mts → route-data-x_b_BLCv.d.ts} +90 -13
- package/package.json +49 -10
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ComponentType, ReactElement } from 'react';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* An augmentable interface users can modify in their app-code to opt into
|
|
6
|
+
* future-flag-specific types
|
|
7
|
+
*/
|
|
8
|
+
interface Future {
|
|
9
|
+
}
|
|
10
|
+
type MiddlewareEnabled = Future extends {
|
|
11
|
+
unstable_middleware: infer T extends boolean;
|
|
12
|
+
} ? T : false;
|
|
13
|
+
|
|
4
14
|
/**
|
|
5
15
|
* Actions represent the type of change to a location value.
|
|
6
16
|
*/
|
|
@@ -206,16 +216,6 @@ type UrlHistoryOptions = {
|
|
|
206
216
|
v5Compat?: boolean;
|
|
207
217
|
};
|
|
208
218
|
|
|
209
|
-
/**
|
|
210
|
-
* An augmentable interface users can modify in their app-code to opt into
|
|
211
|
-
* future-flag-specific types
|
|
212
|
-
*/
|
|
213
|
-
interface Future {
|
|
214
|
-
}
|
|
215
|
-
type MiddlewareEnabled = Future extends {
|
|
216
|
-
unstable_middleware: infer T extends boolean;
|
|
217
|
-
} ? T : false;
|
|
218
|
-
|
|
219
219
|
type MaybePromise<T> = T | Promise<T>;
|
|
220
220
|
/**
|
|
221
221
|
* Map of routeId -> data returned from a loader/action/error
|
|
@@ -912,8 +912,11 @@ interface Router {
|
|
|
912
912
|
* @param routeId The parent route id or a callback function accepting `patch`
|
|
913
913
|
* to perform batch patching
|
|
914
914
|
* @param children The additional children routes
|
|
915
|
+
* @param unstable_allowElementMutations Allow mutation or route elements on
|
|
916
|
+
* existing routes. Intended for RSC-usage
|
|
917
|
+
* only.
|
|
915
918
|
*/
|
|
916
|
-
patchRoutes(routeId: string | null, children: AgnosticRouteObject[]): void;
|
|
919
|
+
patchRoutes(routeId: string | null, children: AgnosticRouteObject[], unstable_allowElementMutations?: boolean): void;
|
|
917
920
|
/**
|
|
918
921
|
* @private
|
|
919
922
|
* PRIVATE - DO NOT USE
|
|
@@ -922,6 +925,13 @@ interface Router {
|
|
|
922
925
|
* TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute)
|
|
923
926
|
*/
|
|
924
927
|
_internalSetRoutes(routes: AgnosticRouteObject[]): void;
|
|
928
|
+
/**
|
|
929
|
+
* @private
|
|
930
|
+
* PRIVATE - DO NOT USE
|
|
931
|
+
*
|
|
932
|
+
* Cause subscribers to re-render. This is used to force a re-render.
|
|
933
|
+
*/
|
|
934
|
+
_internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void;
|
|
925
935
|
/**
|
|
926
936
|
* @private
|
|
927
937
|
* PRIVATE - DO NOT USE
|
|
@@ -1045,6 +1055,7 @@ interface StaticHandler {
|
|
|
1045
1055
|
skipRevalidation?: boolean;
|
|
1046
1056
|
dataStrategy?: DataStrategyFunction<unknown>;
|
|
1047
1057
|
unstable_respond?: (staticContext: StaticHandlerContext) => MaybePromise<Response>;
|
|
1058
|
+
unstable_stream?: (context: unstable_RouterContextProvider, query: (r: Request) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
|
|
1048
1059
|
}): Promise<StaticHandlerContext | Response>;
|
|
1049
1060
|
queryRoute(request: Request, opts?: {
|
|
1050
1061
|
routeId?: string;
|
|
@@ -1767,7 +1778,73 @@ type ClientData<T> = T extends Response ? never : T extends DataWithResponseInit
|
|
|
1767
1778
|
type ServerData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? Serialize<U> : Serialize<T>;
|
|
1768
1779
|
type ServerDataFrom<T> = ServerData<DataFrom<T>>;
|
|
1769
1780
|
type ClientDataFrom<T> = ClientData<DataFrom<T>>;
|
|
1770
|
-
type
|
|
1781
|
+
type ClientDataFunctionArgs<Params> = {
|
|
1782
|
+
/**
|
|
1783
|
+
* A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the URL, the method, the "content-type" header, and the request body from the request.
|
|
1784
|
+
*
|
|
1785
|
+
* @note Because client data functions are called before a network request is made, the Request object does not include the headers which the browser automatically adds. React Router infers the "content-type" header from the enc-type of the form that performed the submission.
|
|
1786
|
+
**/
|
|
1787
|
+
request: Request;
|
|
1788
|
+
/**
|
|
1789
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
1790
|
+
* @example
|
|
1791
|
+
* // app/routes.ts
|
|
1792
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
1793
|
+
*
|
|
1794
|
+
* // app/team.tsx
|
|
1795
|
+
* export function clientLoader({
|
|
1796
|
+
* params,
|
|
1797
|
+
* }: Route.ClientLoaderArgs) {
|
|
1798
|
+
* params.teamId;
|
|
1799
|
+
* // ^ string
|
|
1800
|
+
* }
|
|
1801
|
+
**/
|
|
1802
|
+
params: Params;
|
|
1803
|
+
/**
|
|
1804
|
+
* When `future.unstable_middleware` is not enabled, this is undefined.
|
|
1805
|
+
*
|
|
1806
|
+
* When `future.unstable_middleware` is enabled, this is an instance of
|
|
1807
|
+
* `unstable_RouterContextProvider` and can be used to access context values
|
|
1808
|
+
* from your route middlewares. You may pass in initial context values in your
|
|
1809
|
+
* `<HydratedRouter unstable_getContext>` prop
|
|
1810
|
+
*/
|
|
1811
|
+
context: unstable_RouterContextProvider;
|
|
1812
|
+
};
|
|
1813
|
+
type ServerDataFunctionArgs<Params> = {
|
|
1814
|
+
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the url, method, headers (such as cookies), and request body from the request. */
|
|
1815
|
+
request: Request;
|
|
1816
|
+
/**
|
|
1817
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
1818
|
+
* @example
|
|
1819
|
+
* // app/routes.ts
|
|
1820
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
1821
|
+
*
|
|
1822
|
+
* // app/team.tsx
|
|
1823
|
+
* export function loader({
|
|
1824
|
+
* params,
|
|
1825
|
+
* }: Route.LoaderArgs) {
|
|
1826
|
+
* params.teamId;
|
|
1827
|
+
* // ^ string
|
|
1828
|
+
* }
|
|
1829
|
+
**/
|
|
1830
|
+
params: Params;
|
|
1831
|
+
/**
|
|
1832
|
+
* Without `future.unstable_middleware` enabled, this is the context passed in
|
|
1833
|
+
* to your server adapter's `getLoadContext` function. It's a way to bridge the
|
|
1834
|
+
* gap between the adapter's request/response API with your React Router app.
|
|
1835
|
+
* It is only applicable if you are using a custom server adapter.
|
|
1836
|
+
*
|
|
1837
|
+
* With `future.unstable_middleware` enabled, this is an instance of
|
|
1838
|
+
* `unstable_RouterContextProvider` and can be used for type-safe access to
|
|
1839
|
+
* context value set in your route middlewares. If you are using a custom
|
|
1840
|
+
* server adapter, you may provide an initial set of context values from your
|
|
1841
|
+
* `getLoadContext` function.
|
|
1842
|
+
*/
|
|
1843
|
+
context: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext;
|
|
1844
|
+
};
|
|
1845
|
+
type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [
|
|
1846
|
+
ClientLoaderFunctionArgs | ClientActionFunctionArgs | ClientDataFunctionArgs<unknown>
|
|
1847
|
+
] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
|
|
1771
1848
|
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
|
|
1772
1849
|
type IsHydrate<ClientLoader> = ClientLoader extends {
|
|
1773
1850
|
hydrate: true;
|
|
@@ -1790,4 +1867,4 @@ type _DataActionData<ServerActionData, ClientActionData> = Awaited<[
|
|
|
1790
1867
|
IsDefined<ClientActionData>
|
|
1791
1868
|
] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
|
|
1792
1869
|
|
|
1793
|
-
export { type
|
|
1870
|
+
export { type DataStrategyFunctionArgs as $, type ActionFunction as A, type StaticHandlerContext as B, type ClientDataFunctionArgs as C, type DataStrategyFunction as D, type Equal as E, type Fetcher as F, type GetLoaderData as G, type HydrationState as H, type InitialEntry as I, type Navigation as J, type NavigationStates as K, type LinkDescriptor as L, type MetaDescriptor as M, type Normalize as N, type RelativeRoutingType as O, type Pretty as P, type Blocker as Q, type RouteModule as R, type ServerDataFunctionArgs as S, type To as T, type BlockerFunction as U, type RouterInit as V, type RouterSubscriber as W, type RouterNavigateOptions as X, type RouterFetchOptions as Y, type RevalidationState as Z, type ActionFunctionArgs as _, type Location as a, type FutureConfig as a$, type DataStrategyMatch as a0, type DataStrategyResult as a1, DataWithResponseInit as a2, type ErrorResponse as a3, type FormEncType as a4, type FormMethod as a5, type HTMLFormMethod as a6, type LazyRouteFunction as a7, type LoaderFunctionArgs as a8, type unstable_MiddlewareFunction as a9, type NavigateOptions as aA, type Navigator as aB, type PatchRoutesOnNavigationFunctionArgs as aC, type RouteMatch as aD, type RouteObject as aE, type ClientActionFunctionArgs as aF, type ClientLoaderFunctionArgs as aG, type HeadersArgs as aH, type MetaArgs as aI, type PageLinkDescriptor as aJ, type HtmlLinkDescriptor as aK, type Future as aL, type unstable_SerializesTo as aM, createBrowserHistory as aN, invariant as aO, createRouter as aP, ErrorResponseImpl as aQ, DataRouterContext as aR, DataRouterStateContext as aS, FetchersContext as aT, LocationContext as aU, NavigationContext as aV, RouteContext as aW, ViewTransitionContext as aX, type RouteManifest as aY, type ServerRouteModule as aZ, type SerializeFrom as a_, type ParamParseKey as aa, type PathMatch as ab, type PathParam as ac, type PathPattern as ad, type RedirectFunction as ae, type unstable_RouterContext as af, type ShouldRevalidateFunctionArgs as ag, type UIMatch as ah, unstable_createContext as ai, unstable_RouterContextProvider as aj, Action as ak, createPath as al, parsePath as am, IDLE_NAVIGATION as an, IDLE_FETCHER as ao, IDLE_BLOCKER as ap, data as aq, generatePath as ar, isRouteErrorResponse as as, matchPath as at, matchRoutes as au, redirect as av, redirectDocument as aw, replace as ax, resolvePath as ay, type DataRouteMatch as az, type ServerDataFrom as b, type History as b0, type CreateStaticHandlerOptions as b1, type GetActionData as c, type Router as d, type RouteModules as e, type IndexRouteObject as f, type LoaderFunction as g, type MetaFunction as h, type LinksFunction as i, type NonIndexRouteObject as j, type unstable_InitialContext as k, type MiddlewareEnabled as l, type AppLoadContext as m, type ClientActionFunction as n, type ClientLoaderFunction as o, type HeadersFunction as p, type ShouldRevalidateFunction as q, type Params as r, type RouterState as s, type PatchRoutesOnNavigationFunction as t, type unstable_MiddlewareNextFunction as u, type DataRouteObject as v, type Path as w, type StaticHandler as x, type GetScrollPositionFunction as y, type GetScrollRestorationKeyFunction as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-router",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-23decd7bc",
|
|
4
4
|
"description": "Declarative routing for React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -23,11 +23,20 @@
|
|
|
23
23
|
"module": "./dist/development/index.mjs",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
+
"react-server": {
|
|
27
|
+
"module": "./dist/development/index-react-server.mjs",
|
|
28
|
+
"default": "./dist/development/index-react-server.js"
|
|
29
|
+
},
|
|
26
30
|
"node": {
|
|
27
31
|
"types": "./dist/development/index.d.ts",
|
|
32
|
+
"module": "./dist/development/index.mjs",
|
|
28
33
|
"module-sync": "./dist/development/index.mjs",
|
|
29
34
|
"default": "./dist/development/index.js"
|
|
30
35
|
},
|
|
36
|
+
"module": {
|
|
37
|
+
"types": "./dist/development/index.d.mts",
|
|
38
|
+
"default": "./dist/development/index.mjs"
|
|
39
|
+
},
|
|
31
40
|
"import": {
|
|
32
41
|
"types": "./dist/development/index.d.mts",
|
|
33
42
|
"default": "./dist/development/index.mjs"
|
|
@@ -37,6 +46,26 @@
|
|
|
37
46
|
"default": "./dist/development/index.js"
|
|
38
47
|
}
|
|
39
48
|
},
|
|
49
|
+
"./dom": {
|
|
50
|
+
"node": {
|
|
51
|
+
"types": "./dist/development/dom-export.d.ts",
|
|
52
|
+
"module": "./dist/development/dom-export.mjs",
|
|
53
|
+
"module-sync": "./dist/development/dom-export.mjs",
|
|
54
|
+
"default": "./dist/development/dom-export.js"
|
|
55
|
+
},
|
|
56
|
+
"module": {
|
|
57
|
+
"types": "./dist/development/dom-export.d.mts",
|
|
58
|
+
"default": "./dist/development/dom-export.mjs"
|
|
59
|
+
},
|
|
60
|
+
"import": {
|
|
61
|
+
"types": "./dist/development/dom-export.d.mts",
|
|
62
|
+
"default": "./dist/development/dom-export.mjs"
|
|
63
|
+
},
|
|
64
|
+
"default": {
|
|
65
|
+
"types": "./dist/development/dom-export.d.ts",
|
|
66
|
+
"default": "./dist/development/dom-export.js"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
40
69
|
"./internal": {
|
|
41
70
|
"node": {
|
|
42
71
|
"types": "./dist/development/lib/types/internal.d.ts"
|
|
@@ -48,26 +77,35 @@
|
|
|
48
77
|
"types": "./dist/development/lib/types/index.d.ts"
|
|
49
78
|
}
|
|
50
79
|
},
|
|
51
|
-
"./
|
|
80
|
+
"./internal/react-server-client": {
|
|
81
|
+
"react-server": {
|
|
82
|
+
"module": "./dist/development/index-react-server-client.mjs",
|
|
83
|
+
"default": "./dist/development/index-react-server-client.js"
|
|
84
|
+
},
|
|
52
85
|
"node": {
|
|
53
|
-
"types": "./dist/development/
|
|
54
|
-
"module
|
|
55
|
-
"
|
|
86
|
+
"types": "./dist/development/index.d.ts",
|
|
87
|
+
"module": "./dist/development/index.mjs",
|
|
88
|
+
"module-sync": "./dist/development/index.mjs",
|
|
89
|
+
"default": "./dist/development/index.js"
|
|
90
|
+
},
|
|
91
|
+
"module": {
|
|
92
|
+
"types": "./dist/development/index.d.mts",
|
|
93
|
+
"default": "./dist/development/index.mjs"
|
|
56
94
|
},
|
|
57
95
|
"import": {
|
|
58
|
-
"types": "./dist/development/
|
|
59
|
-
"default": "./dist/development/
|
|
96
|
+
"types": "./dist/development/index.d.mts",
|
|
97
|
+
"default": "./dist/development/index.mjs"
|
|
60
98
|
},
|
|
61
99
|
"default": {
|
|
62
|
-
"types": "./dist/development/
|
|
63
|
-
"default": "./dist/development/
|
|
100
|
+
"types": "./dist/development/index.d.ts",
|
|
101
|
+
"default": "./dist/development/index.js"
|
|
64
102
|
}
|
|
65
103
|
},
|
|
66
104
|
"./package.json": "./package.json"
|
|
67
105
|
},
|
|
68
106
|
"wireit": {
|
|
69
107
|
"build": {
|
|
70
|
-
"command": "rimraf dist && tsup",
|
|
108
|
+
"command": "rimraf dist && tsup && tsup --config tsup.config.rsc.ts",
|
|
71
109
|
"files": [
|
|
72
110
|
"lib/**",
|
|
73
111
|
"*.ts",
|
|
@@ -112,6 +150,7 @@
|
|
|
112
150
|
},
|
|
113
151
|
"scripts": {
|
|
114
152
|
"build": "wireit",
|
|
153
|
+
"watch": "tsup --watch & tsup --config tsup.config.rsc.ts --watch",
|
|
115
154
|
"typecheck": "tsc"
|
|
116
155
|
}
|
|
117
156
|
}
|