react-router 7.6.3 → 7.7.0-pre.1

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 (64) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/development/browser-BSrXyLft.d.mts +157 -0
  3. package/dist/development/chunk-6ZHKKNZG.js +1898 -0
  4. package/dist/development/{chunk-QMGIS6GS.mjs → chunk-YNUF36W5.mjs} +1483 -3019
  5. package/dist/development/chunk-YP7CIEHK.mjs +2695 -0
  6. package/dist/development/chunk-Z7T4GLA7.js +8217 -0
  7. package/dist/development/components-IaVqGBuO.d.mts +816 -0
  8. package/dist/development/dom-export.d.mts +4 -2
  9. package/dist/development/dom-export.js +64 -76
  10. package/dist/development/dom-export.mjs +17 -8
  11. package/dist/development/index-react-server-client-DOK8MfYF.d.mts +1360 -0
  12. package/dist/development/{lib-B33EY9A0.d.mts → index-react-server-client-LrDNRnlX.d.ts} +39 -5
  13. package/dist/development/index-react-server-client.d.mts +4 -0
  14. package/dist/development/index-react-server-client.d.ts +3 -0
  15. package/dist/development/index-react-server-client.js +55 -0
  16. package/dist/development/index-react-server-client.mjs +53 -0
  17. package/dist/development/index-react-server.d.mts +1863 -0
  18. package/dist/development/index-react-server.d.ts +1863 -0
  19. package/dist/development/index-react-server.js +3196 -0
  20. package/dist/development/index-react-server.mjs +3083 -0
  21. package/dist/development/index.d.mts +33 -47
  22. package/dist/development/index.d.ts +195 -2190
  23. package/dist/development/index.js +2600 -11447
  24. package/dist/development/index.mjs +33 -18
  25. package/dist/development/lib/types/internal.d.mts +2 -2
  26. package/dist/development/lib/types/internal.d.ts +2 -1
  27. package/dist/development/lib/types/internal.js +2 -20
  28. package/dist/development/lib/types/internal.mjs +1 -1
  29. package/dist/{production/register-DeIo2iHO.d.mts → development/register-DiOIlEq5.d.mts} +1 -1
  30. package/dist/development/{register-DeIo2iHO.d.mts → register-DiOIlEq5.d.ts} +1 -1
  31. package/dist/development/{route-data-D7Xbr_Ww.d.mts → route-data-7aXBQ4I3.d.ts} +26 -15
  32. package/dist/{production/route-data-D7Xbr_Ww.d.mts → development/route-data-DAw7Esur.d.mts} +16 -5
  33. package/dist/production/browser-BSrXyLft.d.mts +157 -0
  34. package/dist/production/{chunk-S4Z2UWCU.mjs → chunk-4FKAWASN.mjs} +1483 -3019
  35. package/dist/production/chunk-KZZC37RO.mjs +2695 -0
  36. package/dist/production/chunk-SH44XSL4.js +8217 -0
  37. package/dist/production/chunk-W77PDD2Y.js +1898 -0
  38. package/dist/production/components-IaVqGBuO.d.mts +816 -0
  39. package/dist/production/dom-export.d.mts +4 -2
  40. package/dist/production/dom-export.js +64 -76
  41. package/dist/production/dom-export.mjs +17 -8
  42. package/dist/production/index-react-server-client-DOK8MfYF.d.mts +1360 -0
  43. package/dist/production/{lib-B33EY9A0.d.mts → index-react-server-client-LrDNRnlX.d.ts} +39 -5
  44. package/dist/production/index-react-server-client.d.mts +4 -0
  45. package/dist/production/index-react-server-client.d.ts +3 -0
  46. package/dist/production/index-react-server-client.js +55 -0
  47. package/dist/production/index-react-server-client.mjs +53 -0
  48. package/dist/production/index-react-server.d.mts +1863 -0
  49. package/dist/production/index-react-server.d.ts +1863 -0
  50. package/dist/production/index-react-server.js +3196 -0
  51. package/dist/production/index-react-server.mjs +3083 -0
  52. package/dist/production/index.d.mts +33 -47
  53. package/dist/production/index.d.ts +195 -2190
  54. package/dist/production/index.js +2600 -11447
  55. package/dist/production/index.mjs +33 -18
  56. package/dist/production/lib/types/internal.d.mts +2 -2
  57. package/dist/production/lib/types/internal.d.ts +2 -1
  58. package/dist/production/lib/types/internal.js +2 -20
  59. package/dist/production/lib/types/internal.mjs +1 -1
  60. package/dist/production/register-DiOIlEq5.d.mts +24 -0
  61. package/dist/production/register-DiOIlEq5.d.ts +24 -0
  62. package/dist/production/{register-COAKzST_.d.ts → route-data-7aXBQ4I3.d.ts} +26 -38
  63. package/dist/{development/register-COAKzST_.d.ts → production/route-data-DAw7Esur.d.mts} +16 -28
  64. package/package.json +56 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # `react-router`
2
2
 
3
+ ## 7.7.0-pre.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [REMOVE] (continuation of #13872) In Framework Mode, remove leftover critical CSS elements in development after initial render if there's a hydration mismatch ([#13995](https://github.com/remix-run/react-router/pull/13995))
8
+
9
+ ## 7.7.0-pre.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Add unstable RSC support ([#13700](https://github.com/remix-run/react-router/pull/13700))
14
+
15
+ For more information, see the [RSC documentation](https://reactrouter.com/start/rsc/installation).
16
+
17
+ ### Patch Changes
18
+
19
+ - Handle `InvalidCharacterError` when validating cookie signature ([#13847](https://github.com/remix-run/react-router/pull/13847))
20
+ - Pass a copy of `searchParams` to the `setSearchParams` callback function to avoid muations of the internal `searchParams` instance. This was an issue when navigations were blocked because the internal instance be out of sync with `useLocation().search`. ([#12784](https://github.com/remix-run/react-router/pull/12784))
21
+ - Support invalid `Date` in `turbo-stream` v2 fork ([#13684](https://github.com/remix-run/react-router/pull/13684))
22
+ - In Framework Mode, clear critical CSS in development after initial render ([#13872](https://github.com/remix-run/react-router/pull/13872))
23
+ - Strip search parameters from `patchRoutesOnNavigation` `path` param for fetcher calls ([#13911](https://github.com/remix-run/react-router/pull/13911))
24
+ - Skip scroll restoration on useRevalidator() calls because they're not new locations ([#13671](https://github.com/remix-run/react-router/pull/13671))
25
+ - Support unencoded UTF-8 routes in prerender config with `ssr` set to `false` ([#13699](https://github.com/remix-run/react-router/pull/13699))
26
+ - Do not throw if the url hash is not a valid URI component ([#13247](https://github.com/remix-run/react-router/pull/13247))
27
+ - Fix a regression in `createRoutesStub` introduced with the middleware feature. ([#13946](https://github.com/remix-run/react-router/pull/13946))
28
+
29
+ As part of that work we altered the signature to align with the new middleware APIs without making it backwards compatible with the prior `AppLoadContext` API. This permitted `createRoutesStub` to work if you were opting into middleware and the updated `context` typings, but broke `createRoutesStub` for users not yet opting into middleware.
30
+
31
+ We've reverted this change and re-implemented it in such a way that both sets of users can leverage it.
32
+
33
+ ```tsx
34
+ // If you have not opted into middleware, the old API should work again
35
+ let context: AppLoadContext = {
36
+ /*...*/
37
+ };
38
+ let Stub = createRoutesStub(routes, context);
39
+
40
+ // If you have opted into middleware, you should now pass an instantiated `unstable_routerContextProvider` instead of a `getContext` factory function.
41
+ let context = new unstable_RouterContextProvider();
42
+ context.set(SomeContext, someValue);
43
+ let Stub = createRoutesStub(routes, context);
44
+ ```
45
+
46
+ ⚠️ This may be a breaking bug for if you have adopted the unstable Middleware feature and are using `createRoutesStub` with the updated API.
47
+
48
+ - Remove `Content-Length` header from Single Fetch responses ([#13902](https://github.com/remix-run/react-router/pull/13902))
49
+
3
50
  ## 7.6.3
4
51
 
5
52
  ### Patch Changes
@@ -0,0 +1,157 @@
1
+ import * as React from 'react';
2
+ import { u as unstable_RouterContextProvider, p as ActionFunction, C as ClientActionFunction, q as ClientLoaderFunction, r as HeadersFunction, s as LinksFunction, t as LoaderFunction, M as MetaFunction, v as ShouldRevalidateFunction, L as Location, g as Params, h as Router, R as RouterInit } from './route-data-DAw7Esur.mjs';
3
+ import { AsyncLocalStorage } from 'node:async_hooks';
4
+
5
+ type ServerContext = {
6
+ redirect?: Response;
7
+ };
8
+ declare global {
9
+ var ___reactRouterServerStorage___: AsyncLocalStorage<ServerContext> | undefined;
10
+ }
11
+ type RSCRouteConfigEntryBase = {
12
+ action?: ActionFunction;
13
+ clientAction?: ClientActionFunction;
14
+ clientLoader?: ClientLoaderFunction;
15
+ ErrorBoundary?: React.ComponentType<any>;
16
+ handle?: any;
17
+ headers?: HeadersFunction;
18
+ HydrateFallback?: React.ComponentType<any>;
19
+ Layout?: React.ComponentType<any>;
20
+ links?: LinksFunction;
21
+ loader?: LoaderFunction;
22
+ meta?: MetaFunction;
23
+ shouldRevalidate?: ShouldRevalidateFunction;
24
+ };
25
+ type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
26
+ id: string;
27
+ path?: string;
28
+ Component?: React.ComponentType<any>;
29
+ lazy?: () => Promise<RSCRouteConfigEntryBase & ({
30
+ default?: React.ComponentType<any>;
31
+ Component?: never;
32
+ } | {
33
+ default?: never;
34
+ Component?: React.ComponentType<any>;
35
+ })>;
36
+ } & ({
37
+ index: true;
38
+ } | {
39
+ children?: RSCRouteConfigEntry[];
40
+ });
41
+ type RSCRouteConfig = Array<RSCRouteConfigEntry>;
42
+ type RSCRouteManifest = {
43
+ clientAction?: ClientActionFunction;
44
+ clientLoader?: ClientLoaderFunction;
45
+ element?: React.ReactElement | false;
46
+ errorElement?: React.ReactElement;
47
+ handle?: any;
48
+ hasAction: boolean;
49
+ hasComponent: boolean;
50
+ hasErrorBoundary: boolean;
51
+ hasLoader: boolean;
52
+ hydrateFallbackElement?: React.ReactElement;
53
+ id: string;
54
+ index?: boolean;
55
+ links?: LinksFunction;
56
+ meta?: MetaFunction;
57
+ parentId?: string;
58
+ path?: string;
59
+ shouldRevalidate?: ShouldRevalidateFunction;
60
+ };
61
+ type RSCRouteMatch = RSCRouteManifest & {
62
+ params: Params;
63
+ pathname: string;
64
+ pathnameBase: string;
65
+ };
66
+ type RSCRenderPayload = {
67
+ type: "render";
68
+ actionData: Record<string, any> | null;
69
+ basename: string | undefined;
70
+ errors: Record<string, any> | null;
71
+ loaderData: Record<string, any>;
72
+ location: Location;
73
+ matches: RSCRouteMatch[];
74
+ patches?: RSCRouteManifest[];
75
+ nonce?: string;
76
+ formState?: unknown;
77
+ };
78
+ type RSCManifestPayload = {
79
+ type: "manifest";
80
+ patches: RSCRouteManifest[];
81
+ };
82
+ type RSCActionPayload = {
83
+ type: "action";
84
+ actionResult: Promise<unknown>;
85
+ rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
86
+ };
87
+ type RSCRedirectPayload = {
88
+ type: "redirect";
89
+ status: number;
90
+ location: string;
91
+ replace: boolean;
92
+ reload: boolean;
93
+ actionResult?: Promise<unknown>;
94
+ };
95
+ type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
96
+ type RSCMatch = {
97
+ statusCode: number;
98
+ headers: Headers;
99
+ payload: RSCPayload;
100
+ };
101
+ type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
102
+ type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
103
+ type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
104
+ temporaryReferences: unknown;
105
+ }) => Promise<unknown[]>;
106
+ type LoadServerActionFunction = (id: string) => Promise<Function>;
107
+ declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
108
+ createTemporaryReferenceSet: () => unknown;
109
+ basename?: string;
110
+ decodeReply?: DecodeReplyFunction;
111
+ decodeAction?: DecodeActionFunction;
112
+ decodeFormState?: DecodeFormStateFunction;
113
+ requestContext?: unstable_RouterContextProvider;
114
+ loadServerAction?: LoadServerActionFunction;
115
+ onError?: (error: unknown) => void;
116
+ request: Request;
117
+ routes: RSCRouteConfigEntry[];
118
+ generateResponse: (match: RSCMatch, { temporaryReferences, }: {
119
+ temporaryReferences: unknown;
120
+ }) => Response;
121
+ }): Promise<Response>;
122
+
123
+ type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: {
124
+ temporaryReferences: unknown;
125
+ }) => Promise<unknown>;
126
+ type EncodeReplyFunction = (args: unknown[], options: {
127
+ temporaryReferences: unknown;
128
+ }) => Promise<BodyInit>;
129
+ declare global {
130
+ interface Window {
131
+ __router: Router;
132
+ __routerInitialized: boolean;
133
+ __routerActionID: number;
134
+ }
135
+ }
136
+ declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: {
137
+ createFromReadableStream: BrowserCreateFromReadableStreamFunction;
138
+ createTemporaryReferenceSet: () => unknown;
139
+ encodeReply: EncodeReplyFunction;
140
+ fetch?: (request: Request) => Promise<Response>;
141
+ }): (id: string, args: unknown[]) => Promise<unknown>;
142
+ declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, routeDiscovery, unstable_getContext, }: {
143
+ createFromReadableStream: BrowserCreateFromReadableStreamFunction;
144
+ fetch?: (request: Request) => Promise<Response>;
145
+ payload: RSCPayload;
146
+ routeDiscovery?: "eager" | "lazy";
147
+ unstable_getContext?: RouterInit["unstable_getContext"];
148
+ }): React.JSX.Element;
149
+
150
+ declare global {
151
+ interface Window {
152
+ __FLIGHT_DATA: any[];
153
+ }
154
+ }
155
+ declare function getRSCStream(): ReadableStream<any>;
156
+
157
+ export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, type RSCPayload as R, RSCHydratedRouter as a, type DecodeFormStateFunction as b, createCallServer as c, type DecodeReplyFunction as d, type RSCManifestPayload as e, type RSCMatch as f, getRSCStream as g, type RSCRenderPayload as h, type RSCRouteManifest as i, type RSCRouteMatch as j, type RSCRouteConfigEntry as k, type RSCRouteConfig as l, matchRSCServerRequest as m };