react-router 7.13.0-pre.0 → 7.13.1-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 (68) hide show
  1. package/CHANGELOG.md +63 -1
  2. package/dist/development/{browser-BEPxnEBW.d.mts → browser-DzsJABDQ.d.mts} +3 -2
  3. package/dist/{production/browser-BEPxnEBW.d.mts → development/browser-sPQ7eaK4.d.ts} +3 -2
  4. package/dist/development/{chunk-SF52QKH6.mjs → chunk-BPFEYQ6M.mjs} +13 -4
  5. package/dist/{production/chunk-6XK2MF5F.js → development/chunk-CGPAOPIJ.js} +7 -7
  6. package/dist/development/{chunk-NHVOTNWC.js → chunk-LF5SS6XE.js} +203 -128
  7. package/dist/development/{chunk-A6FK77NR.js → chunk-TC44ITIJ.js} +124 -107
  8. package/dist/development/{chunk-MINIYV7Y.mjs → chunk-WQZSGSJA.mjs} +153 -63
  9. package/dist/development/dom-export.d.mts +2 -2
  10. package/dist/development/dom-export.d.ts +2 -2
  11. package/dist/development/dom-export.js +34 -27
  12. package/dist/development/dom-export.mjs +10 -3
  13. package/dist/{production/index-react-server-client-1TI9M9o1.d.ts → development/index-react-server-client-C4tCIird.d.ts} +54 -2
  14. package/dist/development/{index-react-server-client-MKTlCGL3.d.mts → index-react-server-client-EzWJGpN_.d.mts} +54 -2
  15. package/dist/development/index-react-server-client.d.mts +2 -2
  16. package/dist/development/index-react-server-client.d.ts +2 -2
  17. package/dist/development/index-react-server-client.js +4 -4
  18. package/dist/development/index-react-server-client.mjs +2 -2
  19. package/dist/development/index-react-server.d.mts +12 -1
  20. package/dist/development/index-react-server.d.ts +12 -1
  21. package/dist/development/index-react-server.js +80 -44
  22. package/dist/development/index-react-server.mjs +80 -45
  23. package/dist/development/index.d.mts +11 -10
  24. package/dist/development/index.d.ts +11 -10
  25. package/dist/development/index.js +94 -85
  26. package/dist/development/index.mjs +3 -3
  27. package/dist/{production/instrumentation-DvHY1sgY.d.ts → development/instrumentation--6Pioq_G.d.ts} +14 -2
  28. package/dist/development/lib/types/internal.d.mts +4 -4
  29. package/dist/development/lib/types/internal.d.ts +4 -4
  30. package/dist/development/lib/types/internal.js +1 -1
  31. package/dist/development/lib/types/internal.mjs +1 -1
  32. package/dist/development/{register-Bm80E9qL.d.ts → register-CBoanF80.d.ts} +1 -1
  33. package/dist/development/{register-CS_tiXsm.d.mts → register-cRYJ3CjG.d.mts} +1 -1
  34. package/dist/development/{router-5iOvts3c.d.mts → router-cLsU7kHk.d.mts} +14 -2
  35. package/dist/{development/browser-CJ9_du-U.d.ts → production/browser-DzsJABDQ.d.mts} +3 -2
  36. package/dist/production/{browser-CJ9_du-U.d.ts → browser-sPQ7eaK4.d.ts} +3 -2
  37. package/dist/production/{chunk-2UGROV6V.mjs → chunk-2K4LVAAG.mjs} +153 -63
  38. package/dist/{development/chunk-JWU7ULCM.js → production/chunk-I63A6YSE.js} +7 -7
  39. package/dist/production/{chunk-LJWOAQJE.mjs → chunk-ROHSFSEU.mjs} +13 -4
  40. package/dist/production/{chunk-ITSLVQOX.js → chunk-XCKC4VBJ.js} +203 -128
  41. package/dist/production/{chunk-RXRN6IEZ.js → chunk-ZXYVKLN7.js} +124 -107
  42. package/dist/production/dom-export.d.mts +2 -2
  43. package/dist/production/dom-export.d.ts +2 -2
  44. package/dist/production/dom-export.js +34 -27
  45. package/dist/production/dom-export.mjs +10 -3
  46. package/dist/{development/index-react-server-client-1TI9M9o1.d.ts → production/index-react-server-client-C4tCIird.d.ts} +54 -2
  47. package/dist/production/{index-react-server-client-MKTlCGL3.d.mts → index-react-server-client-EzWJGpN_.d.mts} +54 -2
  48. package/dist/production/index-react-server-client.d.mts +2 -2
  49. package/dist/production/index-react-server-client.d.ts +2 -2
  50. package/dist/production/index-react-server-client.js +4 -4
  51. package/dist/production/index-react-server-client.mjs +2 -2
  52. package/dist/production/index-react-server.d.mts +12 -1
  53. package/dist/production/index-react-server.d.ts +12 -1
  54. package/dist/production/index-react-server.js +80 -44
  55. package/dist/production/index-react-server.mjs +80 -45
  56. package/dist/production/index.d.mts +11 -10
  57. package/dist/production/index.d.ts +11 -10
  58. package/dist/production/index.js +94 -85
  59. package/dist/production/index.mjs +3 -3
  60. package/dist/{development/instrumentation-DvHY1sgY.d.ts → production/instrumentation--6Pioq_G.d.ts} +14 -2
  61. package/dist/production/lib/types/internal.d.mts +4 -4
  62. package/dist/production/lib/types/internal.d.ts +4 -4
  63. package/dist/production/lib/types/internal.js +1 -1
  64. package/dist/production/lib/types/internal.mjs +1 -1
  65. package/dist/production/{register-Bm80E9qL.d.ts → register-CBoanF80.d.ts} +1 -1
  66. package/dist/production/{register-CS_tiXsm.d.mts → register-cRYJ3CjG.d.mts} +1 -1
  67. package/dist/production/{router-5iOvts3c.d.mts → router-cLsU7kHk.d.mts} +14 -2
  68. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,68 @@
1
1
  # `react-router`
2
2
 
3
- ## 7.13.0-pre.0
3
+ ## 7.13.1-pre.0
4
+
5
+ ### Patch Changes
6
+
7
+ - fix null reference exception in bad codepath leading to invalid route tree comparisons ([#14780](https://github.com/remix-run/react-router/pull/14780))
8
+ - fix: clear timeout when turbo-stream encoding completes ([#14810](https://github.com/remix-run/react-router/pull/14810))
9
+ - Improve error message when Origin header is invalid ([#14743](https://github.com/remix-run/react-router/pull/14743))
10
+ - Fix matchPath optional params matching without a "/" separator. ([#14689](https://github.com/remix-run/react-router/pull/14689))
11
+ - matchPath("/users/:id?", "/usersblah") now returns null.
12
+ - matchPath("/test_route/:part?", "/test_route_more") now returns null.
13
+
14
+ - add RSC unstable_getRequest ([#14758](https://github.com/remix-run/react-router/pull/14758))
15
+ - Fix `HydrateFallback` rendering during initial lazy route discovery with matching splat route ([#14740](https://github.com/remix-run/react-router/pull/14740))
16
+ - [UNSTABLE] Add support for `<Link unstable_mask>` in Data Mode which allows users to navigate to a URL in the router but "mask" the URL displayed in the browser. This is useful for contextual routing usages such as displaying an image in a model on top of a gallery, but displaying a browser URL directly to the image that can be shared and loaded without the contextual gallery in the background. ([#14716](https://github.com/remix-run/react-router/pull/14716))
17
+
18
+ ```tsx
19
+ // routes/gallery.tsx
20
+ export function clientLoader({ request }: Route.LoaderArgs) {
21
+ let sp = new URL(request.url).searchParams;
22
+ return {
23
+ images: getImages(),
24
+ // When the router location has the image param, load the modal data
25
+ modalImage: sp.has("image") ? getImage(sp.get("image")!) : null,
26
+ };
27
+ }
28
+
29
+ export default function Gallery({ loaderData }: Route.ComponentProps) {
30
+ return (
31
+ <>
32
+ <GalleryGrid>
33
+ {loaderData.images.map((image) => (
34
+ <Link
35
+ key={image.id}
36
+ {/* Navigate the router to /galley?image=N */}}
37
+ to={`/gallery?image=${image.id}`}
38
+ {/* But display /images/N in the URL bar */}}
39
+ unstable_mask={`/images/${image.id}`}
40
+ >
41
+ <img src={image.url} alt={image.alt} />
42
+ </Link>
43
+ ))}
44
+ </GalleryGrid>
45
+
46
+ {/* When the modal data exists, display the modal */}
47
+ {data.modalImage ? (
48
+ <dialog open>
49
+ <img src={data.modalImage.url} alt={data.modalImage.alt} />
50
+ </dialog>
51
+ ) : null}
52
+ </>
53
+ );
54
+ }
55
+ ```
56
+
57
+ Notes:
58
+ - The masked location, if present, will be available on `useLocation().unstable_mask` so you can detect whether you are currently masked or not.
59
+ - Masked URLs only work for SPA use cases, and will be removed from `history.state` during SSR.
60
+ - This provides a first-class API to mask URLs in Data Mode to achieve the same behavior you could do in Declarative Mode via [manual `backgroundLocation` management](https://github.com/remix-run/react-router/tree/main/examples/modal).
61
+
62
+ - RSC: Update failed origin checks to return a 400 status and appropriate UI instead of a generic 500 ([#14755](https://github.com/remix-run/react-router/pull/14755))
63
+ - Preserve query parameters and hash on manifest version mismatch reload ([#14813](https://github.com/remix-run/react-router/pull/14813))
64
+
65
+ ## 7.13.0
4
66
 
5
67
  ### Minor Changes
6
68
 
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
- import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction, e as RouterInit } from './router-5iOvts3c.mjs';
2
+ import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction, e as RouterInit } from './router-cLsU7kHk.mjs';
3
3
 
4
+ declare function getRequest(): Request;
4
5
  type RSCRouteConfigEntryBase = {
5
6
  action?: ActionFunction;
6
7
  clientAction?: ClientActionFunction;
@@ -310,4 +311,4 @@ interface RSCHydratedRouterProps {
310
311
  */
311
312
  declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, routeDiscovery, getContext, }: RSCHydratedRouterProps): React.JSX.Element;
312
313
 
313
- export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, type RSCHydratedRouterProps as g, type RSCMatch as h, type RSCRouteManifest as i, type RSCRouteMatch as j, type RSCRouteConfigEntry as k, type RSCRouteConfig as l, matchRSCServerRequest as m };
314
+ export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n };
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
- import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction, e as RouterInit } from './router-5iOvts3c.mjs';
2
+ import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction, e as RouterInit } from './instrumentation--6Pioq_G.js';
3
3
 
4
+ declare function getRequest(): Request;
4
5
  type RSCRouteConfigEntryBase = {
5
6
  action?: ActionFunction;
6
7
  clientAction?: ClientActionFunction;
@@ -310,4 +311,4 @@ interface RSCHydratedRouterProps {
310
311
  */
311
312
  declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, routeDiscovery, getContext, }: RSCHydratedRouterProps): React.JSX.Element;
312
313
 
313
- export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, type RSCHydratedRouterProps as g, type RSCMatch as h, type RSCRouteManifest as i, type RSCRouteMatch as j, type RSCRouteConfigEntry as k, type RSCRouteConfig as l, matchRSCServerRequest as m };
314
+ export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, RSCHydratedRouter as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, createCallServer as c, type RSCManifestPayload as d, type RSCPayload as e, type RSCRenderPayload as f, getRequest as g, type RSCHydratedRouterProps as h, type RSCMatch as i, type RSCRouteManifest as j, type RSCRouteMatch as k, type RSCRouteConfigEntry as l, matchRSCServerRequest as m, type RSCRouteConfig as n };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.13.0-pre.0
2
+ * react-router v7.13.1-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -51,7 +51,7 @@ import {
51
51
  withComponentProps,
52
52
  withErrorBoundaryProps,
53
53
  withHydrateFallbackProps
54
- } from "./chunk-MINIYV7Y.mjs";
54
+ } from "./chunk-WQZSGSJA.mjs";
55
55
 
56
56
  // lib/dom/ssr/server.tsx
57
57
  import * as React from "react";
@@ -758,7 +758,14 @@ function prependCookies(parentHeaders, childHeaders) {
758
758
  // lib/actions.ts
759
759
  function throwIfPotentialCSRFAttack(headers, allowedActionOrigins) {
760
760
  let originHeader = headers.get("origin");
761
- let originDomain = typeof originHeader === "string" && originHeader !== "null" ? new URL(originHeader).host : originHeader;
761
+ let originDomain = null;
762
+ try {
763
+ originDomain = typeof originHeader === "string" && originHeader !== "null" ? new URL(originHeader).host : originHeader;
764
+ } catch {
765
+ throw new Error(
766
+ `\`origin\` header is not a valid URL. Aborting the action.`
767
+ );
768
+ }
762
769
  let host = parseHostHeader(headers);
763
770
  if (originDomain && (!host || originDomain !== host.value)) {
764
771
  if (!isAllowedOrigin(originDomain, allowedActionOrigins)) {
@@ -1049,9 +1056,11 @@ function encodeViaTurboStream(data2, requestSignal, streamTimeout, serverMode) {
1049
1056
  () => controller.abort(new Error("Server Timeout")),
1050
1057
  typeof streamTimeout === "number" ? streamTimeout : 4950
1051
1058
  );
1052
- requestSignal.addEventListener("abort", () => clearTimeout(timeoutId));
1059
+ let clearStreamTimeout = () => clearTimeout(timeoutId);
1060
+ requestSignal.addEventListener("abort", clearStreamTimeout);
1053
1061
  return encode(data2, {
1054
1062
  signal: controller.signal,
1063
+ onComplete: clearStreamTimeout,
1055
1064
  plugins: [
1056
1065
  (value) => {
1057
1066
  if (value instanceof Error) {
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
2
- * react-router v7.13.0-pre.0
2
+ * react-router v7.13.1-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
 
17
- var _chunkITSLVQOXjs = require('./chunk-ITSLVQOX.js');
17
+ var _chunkLF5SS6XEjs = require('./chunk-LF5SS6XE.js');
18
18
 
19
19
  // lib/dom/ssr/hydration.tsx
20
20
  function getHydrationData({
@@ -29,12 +29,12 @@ function getHydrationData({
29
29
  ...state,
30
30
  loaderData: { ...state.loaderData }
31
31
  };
32
- let initialMatches = _chunkITSLVQOXjs.matchRoutes.call(void 0, routes, location, basename);
32
+ let initialMatches = _chunkLF5SS6XEjs.matchRoutes.call(void 0, routes, location, basename);
33
33
  if (initialMatches) {
34
34
  for (let match of initialMatches) {
35
35
  let routeId = match.route.id;
36
36
  let routeInfo = getRouteInfo(routeId);
37
- if (_chunkITSLVQOXjs.shouldHydrateRouteLoader.call(void 0,
37
+ if (_chunkLF5SS6XEjs.shouldHydrateRouteLoader.call(void 0,
38
38
  routeId,
39
39
  routeInfo.clientLoader,
40
40
  routeInfo.hasLoader,
@@ -112,7 +112,7 @@ function RSCDefaultRootErrorBoundaryImpl({
112
112
  }
113
113
  }
114
114
  );
115
- if (_chunkITSLVQOXjs.isRouteErrorResponse.call(void 0, error)) {
115
+ if (_chunkLF5SS6XEjs.isRouteErrorResponse.call(void 0, error)) {
116
116
  return /* @__PURE__ */ _react2.default.createElement(
117
117
  ErrorWrapper,
118
118
  {
@@ -120,7 +120,7 @@ function RSCDefaultRootErrorBoundaryImpl({
120
120
  title: "Unhandled Thrown Response!"
121
121
  },
122
122
  /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
123
- _chunkITSLVQOXjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
123
+ _chunkLF5SS6XEjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
124
124
  );
125
125
  }
126
126
  let errorInstance;
@@ -146,7 +146,7 @@ function RSCDefaultRootErrorBoundaryImpl({
146
146
  function RSCDefaultRootErrorBoundary({
147
147
  hasRootLayout
148
148
  }) {
149
- let error = _chunkITSLVQOXjs.useRouteError.call(void 0, );
149
+ let error = _chunkLF5SS6XEjs.useRouteError.call(void 0, );
150
150
  if (hasRootLayout === void 0) {
151
151
  throw new Error("Missing 'hasRootLayout' prop");
152
152
  }