react-router 0.0.0-experimental-8265d95da → 0.0.0-experimental-1b459f580

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 (59) hide show
  1. package/dist/development/{browser-CeOQ1V8U.d.mts → browser-BSrXyLft.d.mts} +8 -5
  2. package/dist/{production/chunk-4C6ZXFI7.mjs → development/chunk-4VIKRD7L.mjs} +60 -48
  3. package/dist/development/{chunk-H7YY6DT4.mjs → chunk-L4LRRCSD.mjs} +13 -6
  4. package/dist/development/{chunk-LZUZLU54.js → chunk-OLOTDUGY.js} +1 -1
  5. package/dist/development/{chunk-D3LQIA7F.js → chunk-RZCZIS3B.js} +18 -11
  6. package/dist/development/{components-C4N5AKOq.d.mts → components-IaVqGBuO.d.mts} +1 -1
  7. package/dist/development/dom-export.d.mts +3 -3
  8. package/dist/development/dom-export.js +2 -2
  9. package/dist/development/dom-export.mjs +3 -3
  10. package/dist/{production/index-react-server-client-B5PRzNjB.d.mts → development/index-react-server-client-DOK8MfYF.d.mts} +2 -2
  11. package/dist/development/{index-react-server-client-CZfY0YIG.d.ts → index-react-server-client-LrDNRnlX.d.ts} +1 -1
  12. package/dist/development/index-react-server-client.d.mts +3 -3
  13. package/dist/development/index-react-server-client.d.ts +2 -2
  14. package/dist/development/index-react-server-client.js +4 -4
  15. package/dist/development/index-react-server-client.mjs +2 -2
  16. package/dist/development/index-react-server.d.mts +5 -3
  17. package/dist/development/index-react-server.d.ts +5 -3
  18. package/dist/development/index-react-server.js +89 -27
  19. package/dist/development/index-react-server.mjs +89 -28
  20. package/dist/development/index.d.mts +9 -9
  21. package/dist/development/index.d.ts +13 -10
  22. package/dist/development/index.js +154 -142
  23. package/dist/development/index.mjs +3 -3
  24. package/dist/development/lib/types/internal.d.mts +1 -1
  25. package/dist/development/lib/types/internal.d.ts +1 -1
  26. package/dist/development/lib/types/internal.js +1 -1
  27. package/dist/development/lib/types/internal.mjs +1 -1
  28. package/dist/{production/route-data-CDK1PbMf.d.ts → development/route-data-7aXBQ4I3.d.ts} +1 -1
  29. package/dist/{production/route-data-CT-4wcAx.d.mts → development/route-data-DAw7Esur.d.mts} +1 -1
  30. package/dist/production/{browser-CeOQ1V8U.d.mts → browser-BSrXyLft.d.mts} +8 -5
  31. package/dist/production/{chunk-4AOOXYBO.js → chunk-6P3A53A7.js} +18 -11
  32. package/dist/production/{chunk-LZUZLU54.js → chunk-OLOTDUGY.js} +1 -1
  33. package/dist/{development/chunk-F6CHBNAM.mjs → production/chunk-PFSXYEQ3.mjs} +60 -48
  34. package/dist/production/{chunk-QMNFIUXP.mjs → chunk-SFXFO2NO.mjs} +13 -6
  35. package/dist/production/{components-C4N5AKOq.d.mts → components-IaVqGBuO.d.mts} +1 -1
  36. package/dist/production/dom-export.d.mts +3 -3
  37. package/dist/production/dom-export.js +2 -2
  38. package/dist/production/dom-export.mjs +3 -3
  39. package/dist/{development/index-react-server-client-B5PRzNjB.d.mts → production/index-react-server-client-DOK8MfYF.d.mts} +2 -2
  40. package/dist/production/{index-react-server-client-CZfY0YIG.d.ts → index-react-server-client-LrDNRnlX.d.ts} +1 -1
  41. package/dist/production/index-react-server-client.d.mts +3 -3
  42. package/dist/production/index-react-server-client.d.ts +2 -2
  43. package/dist/production/index-react-server-client.js +4 -4
  44. package/dist/production/index-react-server-client.mjs +2 -2
  45. package/dist/production/index-react-server.d.mts +5 -3
  46. package/dist/production/index-react-server.d.ts +5 -3
  47. package/dist/production/index-react-server.js +89 -27
  48. package/dist/production/index-react-server.mjs +89 -28
  49. package/dist/production/index.d.mts +9 -9
  50. package/dist/production/index.d.ts +13 -10
  51. package/dist/production/index.js +154 -142
  52. package/dist/production/index.mjs +3 -3
  53. package/dist/production/lib/types/internal.d.mts +1 -1
  54. package/dist/production/lib/types/internal.d.ts +1 -1
  55. package/dist/production/lib/types/internal.js +1 -1
  56. package/dist/production/lib/types/internal.mjs +1 -1
  57. package/dist/{development/route-data-CDK1PbMf.d.ts → production/route-data-7aXBQ4I3.d.ts} +1 -1
  58. package/dist/{development/route-data-CT-4wcAx.d.mts → production/route-data-DAw7Esur.d.mts} +1 -1
  59. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { p as ActionFunction, C as ClientActionFunction, q as ClientLoaderFunction, r as HeadersFunction, s as LinksFunction, t as LoaderFunction, M as MetaFunction, u as ShouldRevalidateFunction, L as Location, g as Params, h as Router } from './route-data-CT-4wcAx.mjs';
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
3
  import { AsyncLocalStorage } from 'node:async_hooks';
4
4
 
5
5
  type ServerContext = {
@@ -66,7 +66,7 @@ type RSCRouteMatch = RSCRouteManifest & {
66
66
  type RSCRenderPayload = {
67
67
  type: "render";
68
68
  actionData: Record<string, any> | null;
69
- basename?: string;
69
+ basename: string | undefined;
70
70
  errors: Record<string, any> | null;
71
71
  loaderData: Record<string, any>;
72
72
  location: Location;
@@ -98,17 +98,19 @@ type RSCMatch = {
98
98
  headers: Headers;
99
99
  payload: RSCPayload;
100
100
  };
101
- type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<void>>;
101
+ type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
102
102
  type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
103
103
  type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
104
104
  temporaryReferences: unknown;
105
105
  }) => Promise<unknown[]>;
106
106
  type LoadServerActionFunction = (id: string) => Promise<Function>;
107
- declare function matchRSCServerRequest({ createTemporaryReferenceSet, decodeReply, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
107
+ declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
108
108
  createTemporaryReferenceSet: () => unknown;
109
+ basename?: string;
109
110
  decodeReply?: DecodeReplyFunction;
110
111
  decodeAction?: DecodeActionFunction;
111
112
  decodeFormState?: DecodeFormStateFunction;
113
+ requestContext?: unstable_RouterContextProvider;
112
114
  loadServerAction?: LoadServerActionFunction;
113
115
  onError?: (error: unknown) => void;
114
116
  request: Request;
@@ -137,11 +139,12 @@ declare function createCallServer({ createFromReadableStream, createTemporaryRef
137
139
  encodeReply: EncodeReplyFunction;
138
140
  fetch?: (request: Request) => Promise<Response>;
139
141
  }): (id: string, args: unknown[]) => Promise<unknown>;
140
- declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, routeDiscovery, }: {
142
+ declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, routeDiscovery, unstable_getContext, }: {
141
143
  createFromReadableStream: BrowserCreateFromReadableStreamFunction;
142
144
  fetch?: (request: Request) => Promise<Response>;
143
145
  payload: RSCPayload;
144
146
  routeDiscovery?: "eager" | "lazy";
147
+ unstable_getContext?: RouterInit["unstable_getContext"];
145
148
  }): React.JSX.Element;
146
149
 
147
150
  declare global {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-8265d95da
2
+ * react-router v0.0.0-experimental-1b459f580
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -57,7 +57,7 @@ import {
57
57
  withComponentProps,
58
58
  withErrorBoundaryProps,
59
59
  withHydrateFallbackProps
60
- } from "./chunk-QMNFIUXP.mjs";
60
+ } from "./chunk-L4LRRCSD.mjs";
61
61
 
62
62
  // lib/dom/ssr/server.tsx
63
63
  import * as React from "react";
@@ -139,9 +139,9 @@ function createRoutesStub(routes, _context) {
139
139
  future
140
140
  }) {
141
141
  let routerRef = React2.useRef();
142
- let remixContextRef = React2.useRef();
142
+ let frameworkContextRef = React2.useRef();
143
143
  if (routerRef.current == null) {
144
- remixContextRef.current = {
144
+ frameworkContextRef.current = {
145
145
  future: {
146
146
  unstable_subResourceIntegrity: future?.unstable_subResourceIntegrity === true,
147
147
  unstable_middleware: future?.unstable_middleware === true
@@ -162,8 +162,8 @@ function createRoutesStub(routes, _context) {
162
162
  // types compared to `AgnosticRouteObject`
163
163
  convertRoutesToDataRoutes(routes, (r) => r),
164
164
  _context !== void 0 ? _context : future?.unstable_middleware ? new unstable_RouterContextProvider() : {},
165
- remixContextRef.current.manifest,
166
- remixContextRef.current.routeModules
165
+ frameworkContextRef.current.manifest,
166
+ frameworkContextRef.current.routeModules
167
167
  );
168
168
  routerRef.current = createMemoryRouter(patched, {
169
169
  initialEntries,
@@ -171,14 +171,14 @@ function createRoutesStub(routes, _context) {
171
171
  hydrationData
172
172
  });
173
173
  }
174
- return /* @__PURE__ */ React2.createElement(FrameworkContext.Provider, { value: remixContextRef.current }, /* @__PURE__ */ React2.createElement(RouterProvider, { router: routerRef.current }));
174
+ return /* @__PURE__ */ React2.createElement(FrameworkContext.Provider, { value: frameworkContextRef.current }, /* @__PURE__ */ React2.createElement(RouterProvider, { router: routerRef.current }));
175
175
  };
176
176
  }
177
177
  function processRoutes(routes, context, manifest, routeModules, parentId) {
178
178
  return routes.map((route) => {
179
179
  if (!route.id) {
180
180
  throw new Error(
181
- "Expected a route.id in @remix-run/testing processRoutes() function"
181
+ "Expected a route.id in react-router processRoutes() function"
182
182
  );
183
183
  }
184
184
  let newRoute = {
@@ -1839,47 +1839,50 @@ function createCallServer({
1839
1839
  throw new Error("Unexpected payload type");
1840
1840
  }
1841
1841
  if (payload.rerender) {
1842
- (async () => {
1843
- const rerender = await payload.rerender;
1844
- if (!rerender) return;
1845
- if (landedActionId < actionId && window.__routerActionID <= actionId) {
1846
- landedActionId = actionId;
1847
- if (rerender.type === "redirect") {
1848
- if (rerender.reload) {
1849
- window.location.href = rerender.location;
1842
+ React4.startTransition(
1843
+ // @ts-expect-error - We have old react types that don't know this can be async
1844
+ async () => {
1845
+ const rerender = await payload.rerender;
1846
+ if (!rerender) return;
1847
+ if (landedActionId < actionId && window.__routerActionID <= actionId) {
1848
+ landedActionId = actionId;
1849
+ if (rerender.type === "redirect") {
1850
+ if (rerender.reload) {
1851
+ window.location.href = rerender.location;
1852
+ return;
1853
+ }
1854
+ window.__router.navigate(rerender.location, {
1855
+ replace: rerender.replace
1856
+ });
1850
1857
  return;
1851
1858
  }
1852
- window.__router.navigate(rerender.location, {
1853
- replace: rerender.replace
1859
+ let lastMatch;
1860
+ for (const match of rerender.matches) {
1861
+ window.__router.patchRoutes(
1862
+ lastMatch?.id ?? null,
1863
+ [createRouteFromServerManifest(match)],
1864
+ true
1865
+ );
1866
+ lastMatch = match;
1867
+ }
1868
+ window.__router._internalSetStateDoNotUseOrYouWillBreakYourApp({});
1869
+ React4.startTransition(() => {
1870
+ window.__router._internalSetStateDoNotUseOrYouWillBreakYourApp({
1871
+ loaderData: Object.assign(
1872
+ {},
1873
+ window.__router.state.loaderData,
1874
+ rerender.loaderData
1875
+ ),
1876
+ errors: rerender.errors ? Object.assign(
1877
+ {},
1878
+ window.__router.state.errors,
1879
+ rerender.errors
1880
+ ) : null
1881
+ });
1854
1882
  });
1855
- return;
1856
- }
1857
- let lastMatch;
1858
- for (const match of rerender.matches) {
1859
- window.__router.patchRoutes(
1860
- lastMatch?.id ?? null,
1861
- [createRouteFromServerManifest(match)],
1862
- true
1863
- );
1864
- lastMatch = match;
1865
1883
  }
1866
- window.__router._internalSetStateDoNotUseOrYouWillBreakYourApp({});
1867
- React4.startTransition(() => {
1868
- window.__router._internalSetStateDoNotUseOrYouWillBreakYourApp({
1869
- loaderData: Object.assign(
1870
- {},
1871
- window.__router.state.loaderData,
1872
- rerender.loaderData
1873
- ),
1874
- errors: rerender.errors ? Object.assign(
1875
- {},
1876
- window.__router.state.errors,
1877
- rerender.errors
1878
- ) : null
1879
- });
1880
- });
1881
1884
  }
1882
- })();
1885
+ );
1883
1886
  }
1884
1887
  return payload.actionResult;
1885
1888
  };
@@ -1887,6 +1890,7 @@ function createCallServer({
1887
1890
  function createRouterFromPayload({
1888
1891
  fetchImplementation,
1889
1892
  createFromReadableStream,
1893
+ unstable_getContext,
1890
1894
  payload
1891
1895
  }) {
1892
1896
  if (window.__router) return window.__router;
@@ -1917,6 +1921,7 @@ function createRouterFromPayload({
1917
1921
  }, []);
1918
1922
  window.__router = createRouter({
1919
1923
  routes,
1924
+ unstable_getContext,
1920
1925
  basename: payload.basename,
1921
1926
  history: createBrowserHistory(),
1922
1927
  hydrationData: getHydrationData(
@@ -1950,11 +1955,11 @@ function createRouterFromPayload({
1950
1955
  signal
1951
1956
  );
1952
1957
  },
1953
- // FIXME: Pass `build.ssr` and `build.basename` into this function
1958
+ // FIXME: Pass `build.ssr` into this function
1954
1959
  dataStrategy: getRSCSingleFetchDataStrategy(
1955
1960
  () => window.__router,
1956
1961
  true,
1957
- void 0,
1962
+ payload.basename,
1958
1963
  createFromReadableStream,
1959
1964
  fetchImplementation
1960
1965
  )
@@ -2085,16 +2090,23 @@ function RSCHydratedRouter({
2085
2090
  createFromReadableStream,
2086
2091
  fetch: fetchImplementation = fetch,
2087
2092
  payload,
2088
- routeDiscovery = "eager"
2093
+ routeDiscovery = "eager",
2094
+ unstable_getContext
2089
2095
  }) {
2090
2096
  if (payload.type !== "render") throw new Error("Invalid payload type");
2091
2097
  let router = React4.useMemo(
2092
2098
  () => createRouterFromPayload({
2093
2099
  payload,
2094
2100
  fetchImplementation,
2101
+ unstable_getContext,
2095
2102
  createFromReadableStream
2096
2103
  }),
2097
- [createFromReadableStream, payload, fetchImplementation]
2104
+ [
2105
+ createFromReadableStream,
2106
+ payload,
2107
+ fetchImplementation,
2108
+ unstable_getContext
2109
+ ]
2098
2110
  );
2099
2111
  React4.useLayoutEffect(() => {
2100
2112
  if (!window.__routerInitialized) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-8265d95da
2
+ * react-router v0.0.0-experimental-1b459f580
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -760,6 +760,12 @@ function stripBasename(pathname, basename) {
760
760
  }
761
761
  return pathname.slice(startIndex) || "/";
762
762
  }
763
+ function prependBasename({
764
+ basename,
765
+ pathname
766
+ }) {
767
+ return pathname === "/" ? basename : joinPaths([basename, pathname]);
768
+ }
763
769
  function resolvePath(to, fromPathname = "/") {
764
770
  let {
765
771
  pathname: toPathname,
@@ -944,6 +950,7 @@ var IDLE_BLOCKER = {
944
950
  location: void 0
945
951
  };
946
952
  var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
953
+ var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
947
954
  var defaultMapRouteProperties = (route) => ({
948
955
  hasErrorBoundary: Boolean(route.hasErrorBoundary)
949
956
  });
@@ -2213,7 +2220,7 @@ function createRouter(init) {
2213
2220
  let isDocumentReload = false;
2214
2221
  if (redirect2.response.headers.has("X-Remix-Reload-Document")) {
2215
2222
  isDocumentReload = true;
2216
- } else if (ABSOLUTE_URL_REGEX.test(location)) {
2223
+ } else if (isAbsoluteUrl(location)) {
2217
2224
  const url = createBrowserURLImpl(location, true);
2218
2225
  isDocumentReload = // Hard reload if it's an absolute URL to a new origin
2219
2226
  url.origin !== routerWindow.location.origin || // Hard reload if it's an absolute URL that does not match our basename
@@ -3351,7 +3358,7 @@ function normalizeTo(location, matches, basename, to, fromRouteId, relative) {
3351
3358
  }
3352
3359
  }
3353
3360
  if (basename !== "/") {
3354
- path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
3361
+ path.pathname = prependBasename({ basename, pathname: path.pathname });
3355
3362
  }
3356
3363
  return createPath(path);
3357
3364
  }
@@ -4337,7 +4344,7 @@ function normalizeRelativeRoutingRedirectResponse(response, request, routeId, ma
4337
4344
  location,
4338
4345
  "Redirects returned/thrown from loaders/actions must have a Location header"
4339
4346
  );
4340
- if (!ABSOLUTE_URL_REGEX.test(location)) {
4347
+ if (!isAbsoluteUrl(location)) {
4341
4348
  let trimmedMatches = matches.slice(
4342
4349
  0,
4343
4350
  matches.findIndex((m) => m.route.id === routeId) + 1
@@ -4353,7 +4360,7 @@ function normalizeRelativeRoutingRedirectResponse(response, request, routeId, ma
4353
4360
  return response;
4354
4361
  }
4355
4362
  function normalizeRedirectLocation(location, currentUrl, basename) {
4356
- if (ABSOLUTE_URL_REGEX.test(location)) {
4363
+ if (isAbsoluteUrl(location)) {
4357
4364
  let normalizedLocation = location;
4358
4365
  let url = normalizedLocation.startsWith("//") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation);
4359
4366
  let isSameBasename = stripBasename(url.pathname, basename) != null;
@@ -8794,7 +8801,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
8794
8801
  try {
8795
8802
  if (isBrowser) {
8796
8803
  window.__reactRouterVersion = // @ts-expect-error
8797
- "0.0.0-experimental-8265d95da";
8804
+ "0.0.0-experimental-1b459f580";
8798
8805
  }
8799
8806
  } catch (e) {
8800
8807
  }
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
2
- * react-router v0.0.0-experimental-8265d95da
2
+ * react-router v0.0.0-experimental-1b459f580
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2
- * react-router v0.0.0-experimental-8265d95da
2
+ * react-router v0.0.0-experimental-1b459f580
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -11,7 +11,7 @@
11
11
 
12
12
 
13
13
 
14
- var _chunkLZUZLU54js = require('./chunk-LZUZLU54.js');
14
+ var _chunkOLOTDUGYjs = require('./chunk-OLOTDUGY.js');
15
15
 
16
16
  // lib/router/history.ts
17
17
  var Action = /* @__PURE__ */ ((Action2) => {
@@ -366,7 +366,7 @@ function unstable_createContext(defaultValue) {
366
366
  var _map;
367
367
  var unstable_RouterContextProvider = class {
368
368
  constructor(init) {
369
- _chunkLZUZLU54js.__privateAdd.call(void 0, this, _map, /* @__PURE__ */ new Map());
369
+ _chunkOLOTDUGYjs.__privateAdd.call(void 0, this, _map, /* @__PURE__ */ new Map());
370
370
  if (init) {
371
371
  for (let [context, value] of init) {
372
372
  this.set(context, value);
@@ -374,8 +374,8 @@ var unstable_RouterContextProvider = class {
374
374
  }
375
375
  }
376
376
  get(context) {
377
- if (_chunkLZUZLU54js.__privateGet.call(void 0, this, _map).has(context)) {
378
- return _chunkLZUZLU54js.__privateGet.call(void 0, this, _map).get(context);
377
+ if (_chunkOLOTDUGYjs.__privateGet.call(void 0, this, _map).has(context)) {
378
+ return _chunkOLOTDUGYjs.__privateGet.call(void 0, this, _map).get(context);
379
379
  }
380
380
  if (context.defaultValue !== void 0) {
381
381
  return context.defaultValue;
@@ -383,7 +383,7 @@ var unstable_RouterContextProvider = class {
383
383
  throw new Error("No value found for context");
384
384
  }
385
385
  set(context, value) {
386
- _chunkLZUZLU54js.__privateGet.call(void 0, this, _map).set(context, value);
386
+ _chunkOLOTDUGYjs.__privateGet.call(void 0, this, _map).set(context, value);
387
387
  }
388
388
  };
389
389
  _map = new WeakMap();
@@ -758,6 +758,12 @@ function stripBasename(pathname, basename) {
758
758
  }
759
759
  return pathname.slice(startIndex) || "/";
760
760
  }
761
+ function prependBasename({
762
+ basename,
763
+ pathname
764
+ }) {
765
+ return pathname === "/" ? basename : joinPaths([basename, pathname]);
766
+ }
761
767
  function resolvePath(to, fromPathname = "/") {
762
768
  let {
763
769
  pathname: toPathname,
@@ -942,6 +948,7 @@ var IDLE_BLOCKER = {
942
948
  location: void 0
943
949
  };
944
950
  var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
951
+ var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
945
952
  var defaultMapRouteProperties = (route) => ({
946
953
  hasErrorBoundary: Boolean(route.hasErrorBoundary)
947
954
  });
@@ -2211,7 +2218,7 @@ function createRouter(init) {
2211
2218
  let isDocumentReload = false;
2212
2219
  if (redirect2.response.headers.has("X-Remix-Reload-Document")) {
2213
2220
  isDocumentReload = true;
2214
- } else if (ABSOLUTE_URL_REGEX.test(location)) {
2221
+ } else if (isAbsoluteUrl(location)) {
2215
2222
  const url = createBrowserURLImpl(location, true);
2216
2223
  isDocumentReload = // Hard reload if it's an absolute URL to a new origin
2217
2224
  url.origin !== routerWindow.location.origin || // Hard reload if it's an absolute URL that does not match our basename
@@ -3349,7 +3356,7 @@ function normalizeTo(location, matches, basename, to, fromRouteId, relative) {
3349
3356
  }
3350
3357
  }
3351
3358
  if (basename !== "/") {
3352
- path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
3359
+ path.pathname = prependBasename({ basename, pathname: path.pathname });
3353
3360
  }
3354
3361
  return createPath(path);
3355
3362
  }
@@ -4335,7 +4342,7 @@ function normalizeRelativeRoutingRedirectResponse(response, request, routeId, ma
4335
4342
  location,
4336
4343
  "Redirects returned/thrown from loaders/actions must have a Location header"
4337
4344
  );
4338
- if (!ABSOLUTE_URL_REGEX.test(location)) {
4345
+ if (!isAbsoluteUrl(location)) {
4339
4346
  let trimmedMatches = matches.slice(
4340
4347
  0,
4341
4348
  matches.findIndex((m) => m.route.id === routeId) + 1
@@ -4351,7 +4358,7 @@ function normalizeRelativeRoutingRedirectResponse(response, request, routeId, ma
4351
4358
  return response;
4352
4359
  }
4353
4360
  function normalizeRedirectLocation(location, currentUrl, basename) {
4354
- if (ABSOLUTE_URL_REGEX.test(location)) {
4361
+ if (isAbsoluteUrl(location)) {
4355
4362
  let normalizedLocation = location;
4356
4363
  let url = normalizedLocation.startsWith("//") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation);
4357
4364
  let isSameBasename = stripBasename(url.pathname, basename) != null;
@@ -8792,7 +8799,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
8792
8799
  try {
8793
8800
  if (isBrowser) {
8794
8801
  window.__reactRouterVersion = // @ts-expect-error
8795
- "0.0.0-experimental-8265d95da";
8802
+ "0.0.0-experimental-1b459f580";
8796
8803
  }
8797
8804
  } catch (e) {
8798
8805
  }
@@ -1,4 +1,4 @@
1
- import { T as To, N as NavigateOptions, B as BlockerFunction, a as Blocker, S as SerializeFrom, b as RelativeRoutingType, L as Location, P as ParamParseKey, c as Path, d as PathPattern, e as PathMatch, U as UIMatch, f as Navigation, A as Action, g as Params, h as Router$1, i as RouteObject, I as InitialEntry, j as NonIndexRouteObject, k as LazyRouteFunction, l as IndexRouteObject, m as Navigator, R as RouterInit, F as FutureConfig, H as HydrationState, D as DataStrategyFunction, n as PatchRoutesOnNavigationFunction, o as RouteMatch } from './route-data-CT-4wcAx.mjs';
1
+ import { T as To, N as NavigateOptions, B as BlockerFunction, a as Blocker, S as SerializeFrom, b as RelativeRoutingType, L as Location, P as ParamParseKey, c as Path, d as PathPattern, e as PathMatch, U as UIMatch, f as Navigation, A as Action, g as Params, h as Router$1, i as RouteObject, I as InitialEntry, j as NonIndexRouteObject, k as LazyRouteFunction, l as IndexRouteObject, m as Navigator, R as RouterInit, F as FutureConfig, H as HydrationState, D as DataStrategyFunction, n as PatchRoutesOnNavigationFunction, o as RouteMatch } from './route-data-DAw7Esur.mjs';
2
2
  import * as React from 'react';
3
3
 
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1 } from './components-C4N5AKOq.mjs';
3
- import './browser-CeOQ1V8U.mjs';
4
- import { R as RouterInit } from './route-data-CT-4wcAx.mjs';
2
+ import { R as RouterProviderProps$1 } from './components-IaVqGBuO.mjs';
3
+ import './browser-BSrXyLft.mjs';
4
+ import { R as RouterInit } from './route-data-DAw7Esur.mjs';
5
5
  import 'node:async_hooks';
6
6
 
7
7
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2
- * react-router v0.0.0-experimental-8265d95da
2
+ * react-router v0.0.0-experimental-1b459f580
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -9,7 +9,7 @@
9
9
  * @license MIT
10
10
  */
11
11
  "use client";
12
- require('./chunk-LZUZLU54.js');
12
+ require('./chunk-OLOTDUGY.js');
13
13
 
14
14
  // lib/dom-export/dom-router-provider.tsx
15
15
  var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-8265d95da
2
+ * react-router v0.0.0-experimental-1b459f580
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -12,7 +12,7 @@
12
12
  import {
13
13
  deserializeErrors,
14
14
  getHydrationData
15
- } from "./chunk-F6CHBNAM.mjs";
15
+ } from "./chunk-4VIKRD7L.mjs";
16
16
  import {
17
17
  FrameworkContext,
18
18
  RemixErrorBoundary,
@@ -28,7 +28,7 @@ import {
28
28
  invariant,
29
29
  mapRouteProperties,
30
30
  useFogOFWarDiscovery
31
- } from "./chunk-H7YY6DT4.mjs";
31
+ } from "./chunk-L4LRRCSD.mjs";
32
32
 
33
33
  // lib/dom-export/dom-router-provider.tsx
34
34
  import * as React from "react";
@@ -1,6 +1,6 @@
1
- import './components-C4N5AKOq.mjs';
1
+ import './components-IaVqGBuO.mjs';
2
2
  import * as React from 'react';
3
- import { a_ as RouteManifest, a$ as ServerRouteModule, W as MiddlewareEnabled, X as unstable_RouterContextProvider, Y as AppLoadContext, ak as LoaderFunctionArgs, ab as ActionFunctionArgs, V as RouteModules, a4 as StaticHandlerContext, H as HydrationState, a0 as DataRouteObject, q as ClientLoaderFunction, aj as HTMLFormMethod, ah as FormEncType, b as RelativeRoutingType, aL as PageLinkDescriptor, T as To, b0 as History, a3 as GetScrollRestorationKeyFunction, R as RouterInit, F as FutureConfig$1, D as DataStrategyFunction, n as PatchRoutesOnNavigationFunction, N as NavigateOptions, a5 as Fetcher, i as RouteObject, h as Router, S as SerializeFrom, B as BlockerFunction, L as Location, b1 as CreateStaticHandlerOptions$1, a1 as StaticHandler } from './route-data-CT-4wcAx.mjs';
3
+ import { a_ as RouteManifest, a$ as ServerRouteModule, Y as MiddlewareEnabled, u as unstable_RouterContextProvider, X as AppLoadContext, ak as LoaderFunctionArgs, ab as ActionFunctionArgs, W as RouteModules, a4 as StaticHandlerContext, H as HydrationState, a0 as DataRouteObject, q as ClientLoaderFunction, aj as HTMLFormMethod, ah as FormEncType, b as RelativeRoutingType, aL as PageLinkDescriptor, T as To, b0 as History, a3 as GetScrollRestorationKeyFunction, R as RouterInit, F as FutureConfig$1, D as DataStrategyFunction, n as PatchRoutesOnNavigationFunction, N as NavigateOptions, a5 as Fetcher, i as RouteObject, h as Router, S as SerializeFrom, B as BlockerFunction, L as Location, b1 as CreateStaticHandlerOptions$1, a1 as StaticHandler } from './route-data-DAw7Esur.mjs';
4
4
 
5
5
  type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
6
6
  interface ServerRoute extends Route {
@@ -1,4 +1,4 @@
1
- import { aY as RouteManifest, aZ as ServerRouteModule, k as MiddlewareEnabled, l as unstable_RouterContextProvider, m as AppLoadContext, a9 as LoaderFunctionArgs, $ as ActionFunctionArgs, e as RouteModules, F as StaticHandlerContext, H as HydrationState, w as DataRouteObject, p as ClientLoaderFunction, T as To, aA as NavigateOptions, V as BlockerFunction, U as Blocker, a_ as SerializeFrom, Q as RelativeRoutingType, a as Location, ab as ParamParseKey, x as Path, ae as PathPattern, ac as PathMatch, ai as UIMatch, K as Navigation, ak as Action, s as Params, d as Router$1, aE as RouteObject, I as InitialEntry, j as NonIndexRouteObject, a8 as LazyRouteFunction, f as IndexRouteObject, aB as Navigator, W as RouterInit, a$ as FutureConfig$1, D as DataStrategyFunction, v as PatchRoutesOnNavigationFunction, aD as RouteMatch, a7 as HTMLFormMethod, a5 as FormEncType, aJ as PageLinkDescriptor, b0 as History, B as GetScrollRestorationKeyFunction, J as Fetcher, b1 as CreateStaticHandlerOptions$1, y as StaticHandler } from './route-data-CDK1PbMf.js';
1
+ import { aY as RouteManifest, aZ as ServerRouteModule, m as MiddlewareEnabled, l as unstable_RouterContextProvider, k as AppLoadContext, a9 as LoaderFunctionArgs, $ as ActionFunctionArgs, e as RouteModules, J as StaticHandlerContext, H as HydrationState, x as DataRouteObject, p as ClientLoaderFunction, T as To, aA as NavigateOptions, W as BlockerFunction, V as Blocker, a_ as SerializeFrom, U as RelativeRoutingType, a as Location, ab as ParamParseKey, y as Path, ae as PathPattern, ac as PathMatch, ai as UIMatch, O as Navigation, ak as Action, s as Params, d as Router$1, aE as RouteObject, I as InitialEntry, j as NonIndexRouteObject, a8 as LazyRouteFunction, f as IndexRouteObject, aB as Navigator, t as RouterInit, a$ as FutureConfig$1, D as DataStrategyFunction, w as PatchRoutesOnNavigationFunction, aD as RouteMatch, a7 as HTMLFormMethod, a5 as FormEncType, aJ as PageLinkDescriptor, b0 as History, F as GetScrollRestorationKeyFunction, K as Fetcher, b1 as CreateStaticHandlerOptions$1, z as StaticHandler } from './route-data-7aXBQ4I3.js';
2
2
  import * as React from 'react';
3
3
 
4
4
  type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
@@ -1,4 +1,4 @@
1
- export { f as Await, g as MemoryRouter, h as Navigate, i as Outlet, j as Route, k as Router, l as RouterProvider, m as Routes } from './components-C4N5AKOq.mjs';
2
- export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-B5PRzNjB.mjs';
3
- import './route-data-CT-4wcAx.mjs';
1
+ export { f as Await, g as MemoryRouter, h as Navigate, i as Outlet, j as Route, k as Router, l as RouterProvider, m as Routes } from './components-IaVqGBuO.mjs';
2
+ export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-DOK8MfYF.mjs';
3
+ import './route-data-DAw7Esur.mjs';
4
4
  import 'react';
@@ -1,3 +1,3 @@
1
- export { h as Await, af as BrowserRouter, ak as Form, ag as HashRouter, ah as Link, aI as Links, i as MemoryRouter, aH as Meta, aj as NavLink, j as Navigate, k as Outlet, l as Route, m as Router, n as RouterProvider, o as Routes, al as ScrollRestoration, aF as StaticRouter, aG as StaticRouterProvider, ai as unstable_HistoryRouter } from './index-react-server-client-CZfY0YIG.js';
2
- import './route-data-CDK1PbMf.js';
1
+ export { h as Await, af as BrowserRouter, ak as Form, ag as HashRouter, ah as Link, aI as Links, i as MemoryRouter, aH as Meta, aj as NavLink, j as Navigate, k as Outlet, l as Route, m as Router, n as RouterProvider, o as Routes, al as ScrollRestoration, aF as StaticRouter, aG as StaticRouterProvider, ai as unstable_HistoryRouter } from './index-react-server-client-LrDNRnlX.js';
2
+ import './route-data-7aXBQ4I3.js';
3
3
  import 'react';
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
2
- * react-router v0.0.0-experimental-8265d95da
2
+ * react-router v0.0.0-experimental-1b459f580
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -29,8 +29,8 @@
29
29
 
30
30
 
31
31
 
32
- var _chunkD3LQIA7Fjs = require('./chunk-D3LQIA7F.js');
33
- require('./chunk-LZUZLU54.js');
32
+ var _chunkRZCZIS3Bjs = require('./chunk-RZCZIS3B.js');
33
+ require('./chunk-OLOTDUGY.js');
34
34
 
35
35
 
36
36
 
@@ -51,4 +51,4 @@ require('./chunk-LZUZLU54.js');
51
51
 
52
52
 
53
53
 
54
- exports.Await = _chunkD3LQIA7Fjs.Await; exports.BrowserRouter = _chunkD3LQIA7Fjs.BrowserRouter; exports.Form = _chunkD3LQIA7Fjs.Form; exports.HashRouter = _chunkD3LQIA7Fjs.HashRouter; exports.Link = _chunkD3LQIA7Fjs.Link; exports.Links = _chunkD3LQIA7Fjs.Links; exports.MemoryRouter = _chunkD3LQIA7Fjs.MemoryRouter; exports.Meta = _chunkD3LQIA7Fjs.Meta; exports.NavLink = _chunkD3LQIA7Fjs.NavLink; exports.Navigate = _chunkD3LQIA7Fjs.Navigate; exports.Outlet = _chunkD3LQIA7Fjs.Outlet; exports.Route = _chunkD3LQIA7Fjs.Route; exports.Router = _chunkD3LQIA7Fjs.Router; exports.RouterProvider = _chunkD3LQIA7Fjs.RouterProvider; exports.Routes = _chunkD3LQIA7Fjs.Routes; exports.ScrollRestoration = _chunkD3LQIA7Fjs.ScrollRestoration; exports.StaticRouter = _chunkD3LQIA7Fjs.StaticRouter; exports.StaticRouterProvider = _chunkD3LQIA7Fjs.StaticRouterProvider; exports.unstable_HistoryRouter = _chunkD3LQIA7Fjs.HistoryRouter;
54
+ exports.Await = _chunkRZCZIS3Bjs.Await; exports.BrowserRouter = _chunkRZCZIS3Bjs.BrowserRouter; exports.Form = _chunkRZCZIS3Bjs.Form; exports.HashRouter = _chunkRZCZIS3Bjs.HashRouter; exports.Link = _chunkRZCZIS3Bjs.Link; exports.Links = _chunkRZCZIS3Bjs.Links; exports.MemoryRouter = _chunkRZCZIS3Bjs.MemoryRouter; exports.Meta = _chunkRZCZIS3Bjs.Meta; exports.NavLink = _chunkRZCZIS3Bjs.NavLink; exports.Navigate = _chunkRZCZIS3Bjs.Navigate; exports.Outlet = _chunkRZCZIS3Bjs.Outlet; exports.Route = _chunkRZCZIS3Bjs.Route; exports.Router = _chunkRZCZIS3Bjs.Router; exports.RouterProvider = _chunkRZCZIS3Bjs.RouterProvider; exports.Routes = _chunkRZCZIS3Bjs.Routes; exports.ScrollRestoration = _chunkRZCZIS3Bjs.ScrollRestoration; exports.StaticRouter = _chunkRZCZIS3Bjs.StaticRouter; exports.StaticRouterProvider = _chunkRZCZIS3Bjs.StaticRouterProvider; exports.unstable_HistoryRouter = _chunkRZCZIS3Bjs.HistoryRouter;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-8265d95da
2
+ * react-router v0.0.0-experimental-1b459f580
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -29,7 +29,7 @@ import {
29
29
  ScrollRestoration,
30
30
  StaticRouter,
31
31
  StaticRouterProvider
32
- } from "./chunk-H7YY6DT4.mjs";
32
+ } from "./chunk-L4LRRCSD.mjs";
33
33
  export {
34
34
  Await,
35
35
  BrowserRouter,
@@ -1576,7 +1576,7 @@ type RSCRouteMatch = RSCRouteManifest & {
1576
1576
  type RSCRenderPayload = {
1577
1577
  type: "render";
1578
1578
  actionData: Record<string, any> | null;
1579
- basename?: string;
1579
+ basename: string | undefined;
1580
1580
  errors: Record<string, any> | null;
1581
1581
  loaderData: Record<string, any>;
1582
1582
  location: Location;
@@ -1608,17 +1608,19 @@ type RSCMatch = {
1608
1608
  headers: Headers;
1609
1609
  payload: RSCPayload;
1610
1610
  };
1611
- type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<void>>;
1611
+ type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
1612
1612
  type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
1613
1613
  type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
1614
1614
  temporaryReferences: unknown;
1615
1615
  }) => Promise<unknown[]>;
1616
1616
  type LoadServerActionFunction = (id: string) => Promise<Function>;
1617
- declare function matchRSCServerRequest({ createTemporaryReferenceSet, decodeReply, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
1617
+ declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
1618
1618
  createTemporaryReferenceSet: () => unknown;
1619
+ basename?: string;
1619
1620
  decodeReply?: DecodeReplyFunction;
1620
1621
  decodeAction?: DecodeActionFunction;
1621
1622
  decodeFormState?: DecodeFormStateFunction;
1623
+ requestContext?: unstable_RouterContextProvider;
1622
1624
  loadServerAction?: LoadServerActionFunction;
1623
1625
  onError?: (error: unknown) => void;
1624
1626
  request: Request;
@@ -1576,7 +1576,7 @@ type RSCRouteMatch = RSCRouteManifest & {
1576
1576
  type RSCRenderPayload = {
1577
1577
  type: "render";
1578
1578
  actionData: Record<string, any> | null;
1579
- basename?: string;
1579
+ basename: string | undefined;
1580
1580
  errors: Record<string, any> | null;
1581
1581
  loaderData: Record<string, any>;
1582
1582
  location: Location;
@@ -1608,17 +1608,19 @@ type RSCMatch = {
1608
1608
  headers: Headers;
1609
1609
  payload: RSCPayload;
1610
1610
  };
1611
- type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<void>>;
1611
+ type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
1612
1612
  type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
1613
1613
  type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
1614
1614
  temporaryReferences: unknown;
1615
1615
  }) => Promise<unknown[]>;
1616
1616
  type LoadServerActionFunction = (id: string) => Promise<Function>;
1617
- declare function matchRSCServerRequest({ createTemporaryReferenceSet, decodeReply, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
1617
+ declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
1618
1618
  createTemporaryReferenceSet: () => unknown;
1619
+ basename?: string;
1619
1620
  decodeReply?: DecodeReplyFunction;
1620
1621
  decodeAction?: DecodeActionFunction;
1621
1622
  decodeFormState?: DecodeFormStateFunction;
1623
+ requestContext?: unstable_RouterContextProvider;
1622
1624
  loadServerAction?: LoadServerActionFunction;
1623
1625
  onError?: (error: unknown) => void;
1624
1626
  request: Request;