react-router 7.6.3-pre.0 → 7.7.0-pre.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 (64) hide show
  1. package/CHANGELOG.md +43 -2
  2. package/dist/development/browser-BSrXyLft.d.mts +157 -0
  3. package/dist/development/chunk-P37AORTA.js +21 -0
  4. package/dist/development/{chunk-CCB6XHGW.mjs → chunk-PUMRC5B5.mjs} +1473 -3024
  5. package/dist/development/chunk-PY5DBM7W.mjs +2695 -0
  6. package/dist/development/chunk-X5ZUQHCD.js +10021 -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 +57 -76
  10. package/dist/development/dom-export.mjs +11 -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 +54 -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 +2596 -11444
  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-2T4DELW3.mjs → chunk-5AMJKWMN.mjs} +1473 -3024
  35. package/dist/production/chunk-KWWBKJDT.mjs +2695 -0
  36. package/dist/production/chunk-LKVDO7TU.js +10021 -0
  37. package/dist/production/chunk-P37AORTA.js +21 -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 +57 -76
  41. package/dist/production/dom-export.mjs +11 -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 +54 -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 +2596 -11444
  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,6 +1,47 @@
1
1
  # `react-router`
2
2
 
3
- ## 7.6.3-pre.0
3
+ ## 7.7.0-pre.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add unstable RSC support ([#13700](https://github.com/remix-run/react-router/pull/13700))
8
+
9
+ For more information, see the [RSC documentation](https://reactrouter.com/start/rsc/installation).
10
+
11
+ ### Patch Changes
12
+
13
+ - Handle `InvalidCharacterError` when validating cookie signature ([#13847](https://github.com/remix-run/react-router/pull/13847))
14
+ - 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))
15
+ - Support invalid `Date` in `turbo-stream` v2 fork ([#13684](https://github.com/remix-run/react-router/pull/13684))
16
+ - In Framework Mode, clear critical CSS in development after initial render ([#13872](https://github.com/remix-run/react-router/pull/13872))
17
+ - Strip search parameters from `patchRoutesOnNavigation` `path` param for fetcher calls ([#13911](https://github.com/remix-run/react-router/pull/13911))
18
+ - Skip scroll restoration on useRevalidator() calls because they're not new locations ([#13671](https://github.com/remix-run/react-router/pull/13671))
19
+ - Support unencoded UTF-8 routes in prerender config with `ssr` set to `false` ([#13699](https://github.com/remix-run/react-router/pull/13699))
20
+ - Do not throw if the url hash is not a valid URI component ([#13247](https://github.com/remix-run/react-router/pull/13247))
21
+ - Fix a regression in `createRoutesStub` introduced with the middleware feature. ([#13946](https://github.com/remix-run/react-router/pull/13946))
22
+
23
+ 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.
24
+
25
+ We've reverted this change and re-implemented it in such a way that both sets of users can leverage it.
26
+
27
+ ```tsx
28
+ // If you have not opted into middleware, the old API should work again
29
+ let context: AppLoadContext = {
30
+ /*...*/
31
+ };
32
+ let Stub = createRoutesStub(routes, context);
33
+
34
+ // If you have opted into middleware, you should now pass an instantiated `unstable_routerContextProvider` instead of a `getContext` factory function.
35
+ let context = new unstable_RouterContextProvider();
36
+ context.set(SomeContext, someValue);
37
+ let Stub = createRoutesStub(routes, context);
38
+ ```
39
+
40
+ ⚠️ This may be a breaking bug for if you have adopted the unstable Middleware feature and are using `createRoutesStub` with the updated API.
41
+
42
+ - Remove `Content-Length` header from Single Fetch responses ([#13902](https://github.com/remix-run/react-router/pull/13902))
43
+
44
+ ## 7.6.3
4
45
 
5
46
  ### Patch Changes
6
47
 
@@ -26,7 +67,7 @@
26
67
  ### Patch Changes
27
68
 
28
69
  - Avoid additional `with-props` chunk in Framework Mode by moving route module component prop logic from the Vite plugin to `react-router` ([#13650](https://github.com/remix-run/react-router/pull/13650))
29
- - \[INTERNAL] Slight refactor of internal `headers()` function processing for use with RSC ([#13639](https://github.com/remix-run/react-router/pull/13639))
70
+ - Slight refactor of internal `headers()` function processing for use with RSC ([#13639](https://github.com/remix-run/react-router/pull/13639))
30
71
 
31
72
  ## 7.6.1
32
73
 
@@ -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 };
@@ -0,0 +1,21 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
2
+ * react-router v7.7.0-pre.0
3
+ *
4
+ * Copyright (c) Remix Software Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ var __typeError = (msg) => {
12
+ throw TypeError(msg);
13
+ };
14
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
15
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
16
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
17
+
18
+
19
+
20
+
21
+ exports.__privateGet = __privateGet; exports.__privateAdd = __privateAdd;