react-router 7.9.2-pre.0 → 7.9.2-pre.2

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 (30) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/development/{chunk-ED2JHW2I.js → chunk-BMRATXNU.js} +1 -1
  3. package/dist/development/{chunk-VM65TX2A.js → chunk-CVJRSTVH.js} +270 -156
  4. package/dist/development/{chunk-EPSRV6KC.mjs → chunk-IM5OGALA.mjs} +116 -2
  5. package/dist/{production/chunk-HAV7J4RO.mjs → development/chunk-Z2FQBQSH.mjs} +63 -58
  6. package/dist/development/dom-export.js +3 -3
  7. package/dist/development/dom-export.mjs +3 -3
  8. package/dist/development/index-react-server-client.js +4 -4
  9. package/dist/development/index-react-server-client.mjs +2 -2
  10. package/dist/development/index-react-server.js +1 -1
  11. package/dist/development/index-react-server.mjs +1 -1
  12. package/dist/development/index.js +157 -152
  13. package/dist/development/index.mjs +3 -3
  14. package/dist/development/lib/types/internal.js +1 -1
  15. package/dist/development/lib/types/internal.mjs +1 -1
  16. package/dist/{development/chunk-PVJ3J6E6.mjs → production/chunk-54D6QT34.mjs} +63 -58
  17. package/dist/production/{chunk-22I2H6CR.js → chunk-JZBSSDER.js} +1 -1
  18. package/dist/production/{chunk-K4BWIVAI.js → chunk-MZDKBHOP.js} +270 -156
  19. package/dist/production/{chunk-662O2YDJ.mjs → chunk-QE6DSGL5.mjs} +116 -2
  20. package/dist/production/dom-export.js +3 -3
  21. package/dist/production/dom-export.mjs +3 -3
  22. package/dist/production/index-react-server-client.js +4 -4
  23. package/dist/production/index-react-server-client.mjs +2 -2
  24. package/dist/production/index-react-server.js +1 -1
  25. package/dist/production/index-react-server.mjs +1 -1
  26. package/dist/production/index.js +157 -152
  27. package/dist/production/index.mjs +3 -3
  28. package/dist/production/lib/types/internal.js +1 -1
  29. package/dist/production/lib/types/internal.mjs +1 -1
  30. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.9.2-pre.0
2
+ * react-router v7.9.2-pre.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -5653,6 +5653,119 @@ var Deferred = class {
5653
5653
  });
5654
5654
  }
5655
5655
  };
5656
+ function shallowDiff(a, b) {
5657
+ if (a === b) {
5658
+ return false;
5659
+ }
5660
+ let aKeys = Object.keys(a);
5661
+ let bKeys = Object.keys(b);
5662
+ if (aKeys.length !== bKeys.length) {
5663
+ return true;
5664
+ }
5665
+ for (let key of aKeys) {
5666
+ if (a[key] !== b[key]) {
5667
+ return true;
5668
+ }
5669
+ }
5670
+ return false;
5671
+ }
5672
+ function UNSTABLE_TransitionEnabledRouterProvider({
5673
+ router,
5674
+ flushSync: reactDomFlushSyncImpl,
5675
+ unstable_onError
5676
+ }) {
5677
+ let fetcherData = React3.useRef(/* @__PURE__ */ new Map());
5678
+ let [revalidating, startRevalidation] = React3.useTransition();
5679
+ let [state, setState] = React3.useState(router.state);
5680
+ router.__setPendingRerender = (promise) => startRevalidation(
5681
+ // @ts-expect-error - need react 19 types for this to be async
5682
+ async () => {
5683
+ const rerender = await promise;
5684
+ startRevalidation(() => {
5685
+ rerender();
5686
+ });
5687
+ }
5688
+ );
5689
+ let navigator = React3.useMemo(() => {
5690
+ return {
5691
+ createHref: router.createHref,
5692
+ encodeLocation: router.encodeLocation,
5693
+ go: (n) => router.navigate(n),
5694
+ push: (to, state2, opts) => router.navigate(to, {
5695
+ state: state2,
5696
+ preventScrollReset: opts?.preventScrollReset
5697
+ }),
5698
+ replace: (to, state2, opts) => router.navigate(to, {
5699
+ replace: true,
5700
+ state: state2,
5701
+ preventScrollReset: opts?.preventScrollReset
5702
+ })
5703
+ };
5704
+ }, [router]);
5705
+ let basename = router.basename || "/";
5706
+ let dataRouterContext = React3.useMemo(
5707
+ () => ({
5708
+ router,
5709
+ navigator,
5710
+ static: false,
5711
+ basename,
5712
+ unstable_onError
5713
+ }),
5714
+ [router, navigator, basename, unstable_onError]
5715
+ );
5716
+ React3.useLayoutEffect(() => {
5717
+ return router.subscribe(
5718
+ (newState, { deletedFetchers, flushSync, viewTransitionOpts }) => {
5719
+ newState.fetchers.forEach((fetcher, key) => {
5720
+ if (fetcher.data !== void 0) {
5721
+ fetcherData.current.set(key, fetcher.data);
5722
+ }
5723
+ });
5724
+ deletedFetchers.forEach((key) => fetcherData.current.delete(key));
5725
+ const diff = shallowDiff(state, newState);
5726
+ if (!diff) return;
5727
+ if (flushSync) {
5728
+ if (reactDomFlushSyncImpl) {
5729
+ reactDomFlushSyncImpl(() => setState(newState));
5730
+ } else {
5731
+ setState(newState);
5732
+ }
5733
+ } else {
5734
+ React3.startTransition(() => {
5735
+ setState(newState);
5736
+ });
5737
+ }
5738
+ }
5739
+ );
5740
+ }, [router, reactDomFlushSyncImpl, state]);
5741
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React3.createElement(
5742
+ DataRouterStateContext.Provider,
5743
+ {
5744
+ value: {
5745
+ ...state,
5746
+ revalidation: revalidating ? "loading" : state.revalidation
5747
+ }
5748
+ },
5749
+ /* @__PURE__ */ React3.createElement(FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React3.createElement(
5750
+ Router,
5751
+ {
5752
+ basename,
5753
+ location: state.location,
5754
+ navigationType: state.historyAction,
5755
+ navigator
5756
+ },
5757
+ /* @__PURE__ */ React3.createElement(
5758
+ MemoizedDataRoutes,
5759
+ {
5760
+ routes: router.routes,
5761
+ future: router.future,
5762
+ state,
5763
+ unstable_onError
5764
+ }
5765
+ )
5766
+ ))
5767
+ )), null);
5768
+ }
5656
5769
  function RouterProvider({
5657
5770
  router,
5658
5771
  flushSync: reactDomFlushSyncImpl,
@@ -8997,7 +9110,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
8997
9110
  try {
8998
9111
  if (isBrowser) {
8999
9112
  window.__reactRouterVersion = // @ts-expect-error
9000
- "7.9.2-pre.0";
9113
+ "7.9.2-pre.2";
9001
9114
  }
9002
9115
  } catch (e) {
9003
9116
  }
@@ -10159,6 +10272,7 @@ export {
10159
10272
  mapRouteProperties,
10160
10273
  hydrationRouteProperties,
10161
10274
  createMemoryRouter,
10275
+ UNSTABLE_TransitionEnabledRouterProvider,
10162
10276
  RouterProvider,
10163
10277
  MemoryRouter,
10164
10278
  Navigate,
@@ -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 v7.9.2-pre.0
2
+ * react-router v7.9.2-pre.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -11,7 +11,7 @@
11
11
  "use client";
12
12
 
13
13
 
14
- var _chunk22I2H6CRjs = require('./chunk-22I2H6CR.js');
14
+ var _chunkJZBSSDERjs = require('./chunk-JZBSSDER.js');
15
15
 
16
16
  // lib/dom-export/dom-router-provider.tsx
17
17
  var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
@@ -180,7 +180,7 @@ function HydratedRouter(props) {
180
180
  }, []);
181
181
  React2.useEffect(() => {
182
182
  if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
183
- document.querySelectorAll(`[${_chunk22I2H6CRjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
183
+ document.querySelectorAll(`[${_chunkJZBSSDERjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
184
184
  }
185
185
  }, [criticalCss]);
186
186
  let [location, setLocation] = React2.useState(router.state.location);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.9.2-pre.0
2
+ * react-router v7.9.2-pre.2
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-HAV7J4RO.mjs";
15
+ } from "./chunk-54D6QT34.mjs";
16
16
  import {
17
17
  CRITICAL_CSS_DATA_ATTRIBUTE,
18
18
  FrameworkContext,
@@ -29,7 +29,7 @@ import {
29
29
  invariant,
30
30
  mapRouteProperties,
31
31
  useFogOFWarDiscovery
32
- } from "./chunk-662O2YDJ.mjs";
32
+ } from "./chunk-QE6DSGL5.mjs";
33
33
 
34
34
  // lib/dom-export/dom-router-provider.tsx
35
35
  import * as React from "react";
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
2
- * react-router v7.9.2-pre.0
2
+ * react-router v7.9.2-pre.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -29,12 +29,12 @@
29
29
 
30
30
 
31
31
 
32
- var _chunkK4BWIVAIjs = require('./chunk-K4BWIVAI.js');
32
+ var _chunkMZDKBHOPjs = require('./chunk-MZDKBHOP.js');
33
33
 
34
34
 
35
35
 
36
36
 
37
- var _chunk22I2H6CRjs = require('./chunk-22I2H6CR.js');
37
+ var _chunkJZBSSDERjs = require('./chunk-JZBSSDER.js');
38
38
 
39
39
 
40
40
 
@@ -58,4 +58,4 @@ var _chunk22I2H6CRjs = require('./chunk-22I2H6CR.js');
58
58
 
59
59
 
60
60
 
61
- exports.BrowserRouter = _chunkK4BWIVAIjs.BrowserRouter; exports.Form = _chunkK4BWIVAIjs.Form; exports.HashRouter = _chunkK4BWIVAIjs.HashRouter; exports.Link = _chunkK4BWIVAIjs.Link; exports.Links = _chunk22I2H6CRjs.Links; exports.MemoryRouter = _chunkK4BWIVAIjs.MemoryRouter; exports.Meta = _chunk22I2H6CRjs.Meta; exports.NavLink = _chunkK4BWIVAIjs.NavLink; exports.Navigate = _chunkK4BWIVAIjs.Navigate; exports.Outlet = _chunkK4BWIVAIjs.Outlet; exports.Route = _chunkK4BWIVAIjs.Route; exports.Router = _chunkK4BWIVAIjs.Router; exports.RouterProvider = _chunkK4BWIVAIjs.RouterProvider; exports.Routes = _chunkK4BWIVAIjs.Routes; exports.ScrollRestoration = _chunkK4BWIVAIjs.ScrollRestoration; exports.StaticRouter = _chunkK4BWIVAIjs.StaticRouter; exports.StaticRouterProvider = _chunkK4BWIVAIjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunk22I2H6CRjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkK4BWIVAIjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkK4BWIVAIjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkK4BWIVAIjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkK4BWIVAIjs.HistoryRouter;
61
+ exports.BrowserRouter = _chunkMZDKBHOPjs.BrowserRouter; exports.Form = _chunkMZDKBHOPjs.Form; exports.HashRouter = _chunkMZDKBHOPjs.HashRouter; exports.Link = _chunkMZDKBHOPjs.Link; exports.Links = _chunkJZBSSDERjs.Links; exports.MemoryRouter = _chunkMZDKBHOPjs.MemoryRouter; exports.Meta = _chunkJZBSSDERjs.Meta; exports.NavLink = _chunkMZDKBHOPjs.NavLink; exports.Navigate = _chunkMZDKBHOPjs.Navigate; exports.Outlet = _chunkMZDKBHOPjs.Outlet; exports.Route = _chunkMZDKBHOPjs.Route; exports.Router = _chunkMZDKBHOPjs.Router; exports.RouterProvider = _chunkMZDKBHOPjs.RouterProvider; exports.Routes = _chunkMZDKBHOPjs.Routes; exports.ScrollRestoration = _chunkMZDKBHOPjs.ScrollRestoration; exports.StaticRouter = _chunkMZDKBHOPjs.StaticRouter; exports.StaticRouterProvider = _chunkMZDKBHOPjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkJZBSSDERjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkMZDKBHOPjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkMZDKBHOPjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkMZDKBHOPjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkMZDKBHOPjs.HistoryRouter;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.9.2-pre.0
2
+ * react-router v7.9.2-pre.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -32,7 +32,7 @@ import {
32
32
  WithComponentProps,
33
33
  WithErrorBoundaryProps,
34
34
  WithHydrateFallbackProps
35
- } from "./chunk-662O2YDJ.mjs";
35
+ } from "./chunk-QE6DSGL5.mjs";
36
36
  export {
37
37
  BrowserRouter,
38
38
  Form,
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
27
27
  var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
28
28
 
29
29
  /**
30
- * react-router v7.9.2-pre.0
30
+ * react-router v7.9.2-pre.2
31
31
  *
32
32
  * Copyright (c) Remix Software Inc.
33
33
  *
@@ -6,7 +6,7 @@ export { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLi
6
6
  import { serialize, parse } from 'cookie';
7
7
 
8
8
  /**
9
- * react-router v7.9.2-pre.0
9
+ * react-router v7.9.2-pre.2
10
10
  *
11
11
  * Copyright (c) Remix Software Inc.
12
12
  *