react-router 0.0.0-experimental-a65d6f5 → 0.0.0-experimental-e0b6ce9

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 (61) hide show
  1. package/dist/development/{chunk-CWSJ6RYI.mjs → chunk-4FI4BC6Y.mjs} +2 -2
  2. package/dist/development/{chunk-47MIYFLC.mjs → chunk-F6CT5MEB.mjs} +173 -169
  3. package/dist/development/{chunk-QOFB7XZ5.js → chunk-INO4IHBF.js} +172 -168
  4. package/dist/{production/chunk-4SPSFXAZ.js → development/chunk-ITZFCV4J.js} +134 -134
  5. package/dist/development/dom-export.d.mts +1 -1
  6. package/dist/development/dom-export.d.ts +1 -1
  7. package/dist/development/dom-export.js +3 -3
  8. package/dist/development/dom-export.mjs +3 -3
  9. package/dist/{production/index-react-server-client-lf74v6ET.d.mts → development/index-react-server-client-CYIi6gi0.d.mts} +2 -2
  10. package/dist/development/{index-react-server-client-Iw2PMej2.d.ts → index-react-server-client-ChBGplLn.d.ts} +2 -2
  11. package/dist/development/index-react-server-client.d.mts +3 -3
  12. package/dist/development/index-react-server-client.d.ts +3 -3
  13. package/dist/development/index-react-server-client.js +4 -4
  14. package/dist/development/index-react-server-client.mjs +2 -2
  15. package/dist/development/index-react-server.d.mts +23 -39
  16. package/dist/development/index-react-server.d.ts +23 -39
  17. package/dist/development/index-react-server.js +101 -95
  18. package/dist/development/index-react-server.mjs +101 -95
  19. package/dist/development/index.d.mts +6 -6
  20. package/dist/development/index.d.ts +6 -6
  21. package/dist/development/index.js +98 -98
  22. package/dist/development/index.mjs +3 -3
  23. package/dist/development/{instrumentation-BWRz1MRU.d.ts → instrumentation-BGrNA7uj.d.ts} +23 -39
  24. package/dist/development/lib/types/internal.d.mts +2 -2
  25. package/dist/development/lib/types/internal.d.ts +2 -2
  26. package/dist/development/lib/types/internal.js +1 -1
  27. package/dist/development/lib/types/internal.mjs +1 -1
  28. package/dist/development/{routeModules--SgCTStn.d.mts → routeModules-Cy4Xsfoi.d.mts} +1 -1
  29. package/dist/{production/routeModules-rxNxBmdR.d.ts → development/routeModules-DqotkItD.d.ts} +1 -1
  30. package/dist/development/{router-DQIRhYoj.d.mts → router-DWv6Clt-.d.mts} +23 -39
  31. package/dist/production/{chunk-UAAA7FTX.mjs → chunk-52MYED7O.mjs} +2 -2
  32. package/dist/{development/chunk-ZLVXSGFL.js → production/chunk-DASXXYNZ.js} +134 -134
  33. package/dist/production/{chunk-ZOHTOBOT.js → chunk-K7VXYOZD.js} +172 -168
  34. package/dist/production/{chunk-MMAHTIVZ.mjs → chunk-LKSLGWXX.mjs} +173 -169
  35. package/dist/production/dom-export.d.mts +1 -1
  36. package/dist/production/dom-export.d.ts +1 -1
  37. package/dist/production/dom-export.js +3 -3
  38. package/dist/production/dom-export.mjs +3 -3
  39. package/dist/{development/index-react-server-client-lf74v6ET.d.mts → production/index-react-server-client-CYIi6gi0.d.mts} +2 -2
  40. package/dist/production/{index-react-server-client-Iw2PMej2.d.ts → index-react-server-client-ChBGplLn.d.ts} +2 -2
  41. package/dist/production/index-react-server-client.d.mts +3 -3
  42. package/dist/production/index-react-server-client.d.ts +3 -3
  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 +23 -39
  46. package/dist/production/index-react-server.d.ts +23 -39
  47. package/dist/production/index-react-server.js +101 -95
  48. package/dist/production/index-react-server.mjs +101 -95
  49. package/dist/production/index.d.mts +6 -6
  50. package/dist/production/index.d.ts +6 -6
  51. package/dist/production/index.js +98 -98
  52. package/dist/production/index.mjs +3 -3
  53. package/dist/production/{instrumentation-BWRz1MRU.d.ts → instrumentation-BGrNA7uj.d.ts} +23 -39
  54. package/dist/production/lib/types/internal.d.mts +2 -2
  55. package/dist/production/lib/types/internal.d.ts +2 -2
  56. package/dist/production/lib/types/internal.js +1 -1
  57. package/dist/production/lib/types/internal.mjs +1 -1
  58. package/dist/production/{routeModules--SgCTStn.d.mts → routeModules-Cy4Xsfoi.d.mts} +1 -1
  59. package/dist/{development/routeModules-rxNxBmdR.d.ts → production/routeModules-DqotkItD.d.ts} +1 -1
  60. package/dist/production/{router-DQIRhYoj.d.mts → router-DWv6Clt-.d.mts} +23 -39
  61. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1, a as RouterInit, u as unstable_ClientInstrumentation, b as unstable_ClientOnErrorFunction } from './router-DQIRhYoj.mjs';
2
+ import { R as RouterProviderProps$1, a as RouterInit, u as unstable_ClientInstrumentation, b as unstable_ClientOnErrorFunction } from './router-DWv6Clt-.mjs';
3
3
  import './browser-z32v5KVN.mjs';
4
4
 
5
5
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { RouterProviderProps as RouterProviderProps$1, RouterInit, unstable_ClientOnErrorFunction } from 'react-router';
3
- import { u as unstable_ClientInstrumentation } from './instrumentation-BWRz1MRU.js';
3
+ import { u as unstable_ClientInstrumentation } from './instrumentation-BGrNA7uj.js';
4
4
 
5
5
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
6
6
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
@@ -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-a65d6f5
2
+ * react-router v0.0.0-experimental-e0b6ce9
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 _chunkQOFB7XZ5js = require('./chunk-QOFB7XZ5.js');
14
+ var _chunkINO4IHBFjs = require('./chunk-INO4IHBF.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);
@@ -183,7 +183,7 @@ function HydratedRouter(props) {
183
183
  }, []);
184
184
  React2.useEffect(() => {
185
185
  if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
186
- document.querySelectorAll(`[${_chunkQOFB7XZ5js.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
186
+ document.querySelectorAll(`[${_chunkINO4IHBFjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
187
187
  }
188
188
  }, [criticalCss]);
189
189
  let [location, setLocation] = React2.useState(router.state.location);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-a65d6f5
2
+ * react-router v0.0.0-experimental-e0b6ce9
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-CWSJ6RYI.mjs";
15
+ } from "./chunk-4FI4BC6Y.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-47MIYFLC.mjs";
32
+ } from "./chunk-F6CT5MEB.mjs";
33
33
 
34
34
  // lib/dom-export/dom-router-provider.tsx
35
35
  import * as React from "react";
@@ -1,6 +1,6 @@
1
- import { bc as RouteManifest, H as HydrationState, G as DataRouteObject, Q as StaticHandlerContext, e as MiddlewareEnabled, c as RouterContextProvider, f as LoaderFunctionArgs, A as ActionFunctionArgs, ad as unstable_ServerInstrumentation, a4 as HTMLFormMethod, a2 as FormEncType, n as RelativeRoutingType, T as To, bd as History, O as GetScrollRestorationKeyFunction, a as RouterInit, be as FutureConfig$1, u as unstable_ClientInstrumentation, l as DataStrategyFunction, F as PatchRoutesOnNavigationFunction, N as NavigateOptions, V as Fetcher, v as RouteObject, k as Router, B as BlockerFunction, L as Location, bf as CreateStaticHandlerOptions$1, J as StaticHandler } from './router-DQIRhYoj.mjs';
1
+ import { bc as RouteManifest, H as HydrationState, G as DataRouteObject, Q as StaticHandlerContext, e as MiddlewareEnabled, c as RouterContextProvider, f as LoaderFunctionArgs, A as ActionFunctionArgs, ad as unstable_ServerInstrumentation, a4 as HTMLFormMethod, a2 as FormEncType, n as RelativeRoutingType, T as To, bd as History, O as GetScrollRestorationKeyFunction, a as RouterInit, be as FutureConfig$1, u as unstable_ClientInstrumentation, l as DataStrategyFunction, F as PatchRoutesOnNavigationFunction, N as NavigateOptions, V as Fetcher, v as RouteObject, k as Router, B as BlockerFunction, L as Location, bf as CreateStaticHandlerOptions$1, J as StaticHandler } from './router-DWv6Clt-.mjs';
2
2
  import * as React from 'react';
3
- import { c as RouteModules, h as ClientLoaderFunction, o as ServerRouteModule, A as AppLoadContext, m as PageLinkDescriptor, d as SerializeFrom } from './routeModules--SgCTStn.mjs';
3
+ import { c as RouteModules, h as ClientLoaderFunction, o as ServerRouteModule, A as AppLoadContext, m as PageLinkDescriptor, d as SerializeFrom } from './routeModules-Cy4Xsfoi.mjs';
4
4
 
5
5
  interface Route {
6
6
  index?: boolean;
@@ -1,6 +1,6 @@
1
- import { d as RouteModules, H as HydrationState, D as DataRouteObject, r as ClientLoaderFunction, z as StaticHandlerContext, aN as ServerRouteModule, A as AppLoadContext, h as RelativeRoutingType, au as PageLinkDescriptor, y as GetScrollRestorationKeyFunction, t as RouterInit, aO as FutureConfig$1, v as PatchRoutesOnNavigationFunction, e as NavigateOptions, J as Fetcher, j as RouteObject, c as Router, g as SerializeFrom, B as BlockerFunction, aP as CreateStaticHandlerOptions$1, w as StaticHandler } from './routeModules-rxNxBmdR.js';
1
+ import { d as RouteModules, H as HydrationState, D as DataRouteObject, r as ClientLoaderFunction, z as StaticHandlerContext, aN as ServerRouteModule, A as AppLoadContext, h as RelativeRoutingType, au as PageLinkDescriptor, y as GetScrollRestorationKeyFunction, t as RouterInit, aO as FutureConfig$1, v as PatchRoutesOnNavigationFunction, e as NavigateOptions, J as Fetcher, j as RouteObject, c as Router, g as SerializeFrom, B as BlockerFunction, aP as CreateStaticHandlerOptions$1, w as StaticHandler } from './routeModules-DqotkItD.js';
2
2
  import * as React from 'react';
3
- import { af as RouteManifest, t as MiddlewareEnabled, R as RouterContextProvider, w as LoaderFunctionArgs, v as ActionFunctionArgs, j as unstable_ServerInstrumentation, i as HTMLFormMethod, F as FormEncType, T as To, H as History, u as unstable_ClientInstrumentation, f as DataStrategyFunction, L as Location } from './instrumentation-BWRz1MRU.js';
3
+ import { af as RouteManifest, t as MiddlewareEnabled, R as RouterContextProvider, w as LoaderFunctionArgs, v as ActionFunctionArgs, j as unstable_ServerInstrumentation, i as HTMLFormMethod, F as FormEncType, T as To, H as History, u as unstable_ClientInstrumentation, f as DataStrategyFunction, L as Location } from './instrumentation-BGrNA7uj.js';
4
4
 
5
5
  interface Route {
6
6
  index?: boolean;
@@ -1,4 +1,4 @@
1
- export { aJ as MemoryRouter, aK as Navigate, aL as Outlet, aM as Route, aN as Router, aO as RouterProvider, aP as Routes, aw as UNSAFE_AwaitContextProvider, b6 as UNSAFE_WithComponentProps, ba as UNSAFE_WithErrorBoundaryProps, b8 as UNSAFE_WithHydrateFallbackProps } from './router-DQIRhYoj.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-lf74v6ET.mjs';
1
+ export { aJ as MemoryRouter, aK as Navigate, aL as Outlet, aM as Route, aN as Router, aO as RouterProvider, aP as Routes, aw as UNSAFE_AwaitContextProvider, b6 as UNSAFE_WithComponentProps, ba as UNSAFE_WithErrorBoundaryProps, b8 as UNSAFE_WithHydrateFallbackProps } from './router-DWv6Clt-.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-CYIi6gi0.mjs';
3
3
  import 'react';
4
- import './routeModules--SgCTStn.mjs';
4
+ import './routeModules-Cy4Xsfoi.mjs';
@@ -1,4 +1,4 @@
1
- export { af as MemoryRouter, ag as Navigate, ah as Outlet, ai as Route, aj as Router, ak as RouterProvider, al as Routes, a0 as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps } from './routeModules-rxNxBmdR.js';
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-Iw2PMej2.js';
1
+ export { af as MemoryRouter, ag as Navigate, ah as Outlet, ai as Route, aj as Router, ak as RouterProvider, al as Routes, a0 as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps } from './routeModules-DqotkItD.js';
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-ChBGplLn.js';
3
3
  import 'react';
4
- import './instrumentation-BWRz1MRU.js';
4
+ import './instrumentation-BGrNA7uj.js';
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
2
- * react-router v0.0.0-experimental-a65d6f5
2
+ * react-router v0.0.0-experimental-e0b6ce9
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -29,12 +29,12 @@
29
29
 
30
30
 
31
31
 
32
- var _chunkZLVXSGFLjs = require('./chunk-ZLVXSGFL.js');
32
+ var _chunkITZFCV4Jjs = require('./chunk-ITZFCV4J.js');
33
33
 
34
34
 
35
35
 
36
36
 
37
- var _chunkQOFB7XZ5js = require('./chunk-QOFB7XZ5.js');
37
+ var _chunkINO4IHBFjs = require('./chunk-INO4IHBF.js');
38
38
 
39
39
 
40
40
 
@@ -58,4 +58,4 @@ var _chunkQOFB7XZ5js = require('./chunk-QOFB7XZ5.js');
58
58
 
59
59
 
60
60
 
61
- exports.BrowserRouter = _chunkZLVXSGFLjs.BrowserRouter; exports.Form = _chunkZLVXSGFLjs.Form; exports.HashRouter = _chunkZLVXSGFLjs.HashRouter; exports.Link = _chunkZLVXSGFLjs.Link; exports.Links = _chunkQOFB7XZ5js.Links; exports.MemoryRouter = _chunkZLVXSGFLjs.MemoryRouter; exports.Meta = _chunkQOFB7XZ5js.Meta; exports.NavLink = _chunkZLVXSGFLjs.NavLink; exports.Navigate = _chunkZLVXSGFLjs.Navigate; exports.Outlet = _chunkZLVXSGFLjs.Outlet; exports.Route = _chunkZLVXSGFLjs.Route; exports.Router = _chunkZLVXSGFLjs.Router; exports.RouterProvider = _chunkZLVXSGFLjs.RouterProvider; exports.Routes = _chunkZLVXSGFLjs.Routes; exports.ScrollRestoration = _chunkZLVXSGFLjs.ScrollRestoration; exports.StaticRouter = _chunkZLVXSGFLjs.StaticRouter; exports.StaticRouterProvider = _chunkZLVXSGFLjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkQOFB7XZ5js.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkZLVXSGFLjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkZLVXSGFLjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkZLVXSGFLjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkZLVXSGFLjs.HistoryRouter;
61
+ exports.BrowserRouter = _chunkITZFCV4Jjs.BrowserRouter; exports.Form = _chunkITZFCV4Jjs.Form; exports.HashRouter = _chunkITZFCV4Jjs.HashRouter; exports.Link = _chunkITZFCV4Jjs.Link; exports.Links = _chunkINO4IHBFjs.Links; exports.MemoryRouter = _chunkITZFCV4Jjs.MemoryRouter; exports.Meta = _chunkINO4IHBFjs.Meta; exports.NavLink = _chunkITZFCV4Jjs.NavLink; exports.Navigate = _chunkITZFCV4Jjs.Navigate; exports.Outlet = _chunkITZFCV4Jjs.Outlet; exports.Route = _chunkITZFCV4Jjs.Route; exports.Router = _chunkITZFCV4Jjs.Router; exports.RouterProvider = _chunkITZFCV4Jjs.RouterProvider; exports.Routes = _chunkITZFCV4Jjs.Routes; exports.ScrollRestoration = _chunkITZFCV4Jjs.ScrollRestoration; exports.StaticRouter = _chunkITZFCV4Jjs.StaticRouter; exports.StaticRouterProvider = _chunkITZFCV4Jjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkINO4IHBFjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkITZFCV4Jjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkITZFCV4Jjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkITZFCV4Jjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkITZFCV4Jjs.HistoryRouter;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-a65d6f5
2
+ * react-router v0.0.0-experimental-e0b6ce9
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-47MIYFLC.mjs";
35
+ } from "./chunk-F6CT5MEB.mjs";
36
36
  export {
37
37
  BrowserRouter,
38
38
  Form,
@@ -903,9 +903,15 @@ type unstable_ClientInstrumentation = {
903
903
  type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
904
904
  type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
905
905
  type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
906
- interface GenericInstrumentFunction {
907
- (handler: () => Promise<void>, info: unknown): Promise<void>;
906
+ interface InstrumentFunction<T> {
907
+ (handler: () => Promise<void>, info: T): Promise<void>;
908
908
  }
909
+ type ReadonlyRequest = {
910
+ method: string;
911
+ url: string;
912
+ headers: Pick<Headers, "get">;
913
+ };
914
+ type ReadonlyContext = Pick<RouterContextProvider, "get">;
909
915
  type InstrumentableRoute = {
910
916
  id: string;
911
917
  index: boolean | undefined;
@@ -913,36 +919,27 @@ type InstrumentableRoute = {
913
919
  instrument(instrumentations: RouteInstrumentations): void;
914
920
  };
915
921
  type RouteInstrumentations = {
916
- lazy?: InstrumentLazyFunction;
917
- "lazy.loader"?: InstrumentLazyFunction;
918
- "lazy.action"?: InstrumentLazyFunction;
919
- "lazy.middleware"?: InstrumentLazyFunction;
920
- middleware?: InstrumentRouteHandlerFunction;
921
- loader?: InstrumentRouteHandlerFunction;
922
- action?: InstrumentRouteHandlerFunction;
922
+ lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>;
923
+ "lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
924
+ "lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
925
+ "lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
926
+ middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
927
+ loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
928
+ action?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
923
929
  };
930
+ type RouteLazyInstrumentationInfo = undefined;
924
931
  type RouteHandlerInstrumentationInfo = Readonly<{
925
- request: {
926
- method: string;
927
- url: string;
928
- headers: Pick<Headers, "get">;
929
- };
932
+ request: ReadonlyRequest;
930
933
  params: LoaderFunctionArgs["params"];
931
934
  unstable_pattern: string;
932
- context: Pick<RouterContextProvider, "get">;
935
+ context: ReadonlyContext;
933
936
  }>;
934
- interface InstrumentLazyFunction extends GenericInstrumentFunction {
935
- (handler: () => Promise<void>): Promise<void>;
936
- }
937
- interface InstrumentRouteHandlerFunction extends GenericInstrumentFunction {
938
- (handler: () => Promise<void>, info: RouteHandlerInstrumentationInfo): Promise<void>;
939
- }
940
937
  type InstrumentableRouter = {
941
938
  instrument(instrumentations: RouterInstrumentations): void;
942
939
  };
943
940
  type RouterInstrumentations = {
944
- navigate?: InstrumentNavigateFunction;
945
- fetch?: InstrumentFetchFunction;
941
+ navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>;
942
+ fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>;
946
943
  };
947
944
  type RouterNavigationInstrumentationInfo = Readonly<{
948
945
  to: string | number;
@@ -961,29 +958,16 @@ type RouterFetchInstrumentationInfo = Readonly<{
961
958
  formData?: FormData;
962
959
  body?: any;
963
960
  }>;
964
- interface InstrumentNavigateFunction extends GenericInstrumentFunction {
965
- (handler: () => Promise<void>, info: RouterNavigationInstrumentationInfo): MaybePromise<void>;
966
- }
967
- interface InstrumentFetchFunction extends GenericInstrumentFunction {
968
- (handler: () => Promise<void>, info: RouterFetchInstrumentationInfo): MaybePromise<void>;
969
- }
970
961
  type InstrumentableRequestHandler = {
971
962
  instrument(instrumentations: RequestHandlerInstrumentations): void;
972
963
  };
973
964
  type RequestHandlerInstrumentations = {
974
- request?: InstrumentRequestHandlerFunction;
965
+ request?: InstrumentFunction<RequestHandlerInstrumentationInfo>;
975
966
  };
976
967
  type RequestHandlerInstrumentationInfo = Readonly<{
977
- request: {
978
- method: string;
979
- url: string;
980
- headers: Pick<Headers, "get">;
981
- };
982
- context: Pick<RouterContextProvider, "get">;
968
+ request: ReadonlyRequest;
969
+ context: ReadonlyContext;
983
970
  }>;
984
- interface InstrumentRequestHandlerFunction extends GenericInstrumentFunction {
985
- (handler: () => Promise<void>, info: RequestHandlerInstrumentationInfo): MaybePromise<void>;
986
- }
987
971
 
988
972
  /**
989
973
  * A Router instance manages all navigation and data loading/mutations
@@ -903,9 +903,15 @@ type unstable_ClientInstrumentation = {
903
903
  type unstable_InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
904
904
  type unstable_InstrumentRouterFunction = (router: InstrumentableRouter) => void;
905
905
  type unstable_InstrumentRouteFunction = (route: InstrumentableRoute) => void;
906
- interface GenericInstrumentFunction {
907
- (handler: () => Promise<void>, info: unknown): Promise<void>;
906
+ interface InstrumentFunction<T> {
907
+ (handler: () => Promise<void>, info: T): Promise<void>;
908
908
  }
909
+ type ReadonlyRequest = {
910
+ method: string;
911
+ url: string;
912
+ headers: Pick<Headers, "get">;
913
+ };
914
+ type ReadonlyContext = Pick<RouterContextProvider, "get">;
909
915
  type InstrumentableRoute = {
910
916
  id: string;
911
917
  index: boolean | undefined;
@@ -913,36 +919,27 @@ type InstrumentableRoute = {
913
919
  instrument(instrumentations: RouteInstrumentations): void;
914
920
  };
915
921
  type RouteInstrumentations = {
916
- lazy?: InstrumentLazyFunction;
917
- "lazy.loader"?: InstrumentLazyFunction;
918
- "lazy.action"?: InstrumentLazyFunction;
919
- "lazy.middleware"?: InstrumentLazyFunction;
920
- middleware?: InstrumentRouteHandlerFunction;
921
- loader?: InstrumentRouteHandlerFunction;
922
- action?: InstrumentRouteHandlerFunction;
922
+ lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>;
923
+ "lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
924
+ "lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
925
+ "lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
926
+ middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
927
+ loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
928
+ action?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
923
929
  };
930
+ type RouteLazyInstrumentationInfo = undefined;
924
931
  type RouteHandlerInstrumentationInfo = Readonly<{
925
- request: {
926
- method: string;
927
- url: string;
928
- headers: Pick<Headers, "get">;
929
- };
932
+ request: ReadonlyRequest;
930
933
  params: LoaderFunctionArgs["params"];
931
934
  unstable_pattern: string;
932
- context: Pick<RouterContextProvider, "get">;
935
+ context: ReadonlyContext;
933
936
  }>;
934
- interface InstrumentLazyFunction extends GenericInstrumentFunction {
935
- (handler: () => Promise<void>): Promise<void>;
936
- }
937
- interface InstrumentRouteHandlerFunction extends GenericInstrumentFunction {
938
- (handler: () => Promise<void>, info: RouteHandlerInstrumentationInfo): Promise<void>;
939
- }
940
937
  type InstrumentableRouter = {
941
938
  instrument(instrumentations: RouterInstrumentations): void;
942
939
  };
943
940
  type RouterInstrumentations = {
944
- navigate?: InstrumentNavigateFunction;
945
- fetch?: InstrumentFetchFunction;
941
+ navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>;
942
+ fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>;
946
943
  };
947
944
  type RouterNavigationInstrumentationInfo = Readonly<{
948
945
  to: string | number;
@@ -961,29 +958,16 @@ type RouterFetchInstrumentationInfo = Readonly<{
961
958
  formData?: FormData;
962
959
  body?: any;
963
960
  }>;
964
- interface InstrumentNavigateFunction extends GenericInstrumentFunction {
965
- (handler: () => Promise<void>, info: RouterNavigationInstrumentationInfo): MaybePromise<void>;
966
- }
967
- interface InstrumentFetchFunction extends GenericInstrumentFunction {
968
- (handler: () => Promise<void>, info: RouterFetchInstrumentationInfo): MaybePromise<void>;
969
- }
970
961
  type InstrumentableRequestHandler = {
971
962
  instrument(instrumentations: RequestHandlerInstrumentations): void;
972
963
  };
973
964
  type RequestHandlerInstrumentations = {
974
- request?: InstrumentRequestHandlerFunction;
965
+ request?: InstrumentFunction<RequestHandlerInstrumentationInfo>;
975
966
  };
976
967
  type RequestHandlerInstrumentationInfo = Readonly<{
977
- request: {
978
- method: string;
979
- url: string;
980
- headers: Pick<Headers, "get">;
981
- };
982
- context: Pick<RouterContextProvider, "get">;
968
+ request: ReadonlyRequest;
969
+ context: ReadonlyContext;
983
970
  }>;
984
- interface InstrumentRequestHandlerFunction extends GenericInstrumentFunction {
985
- (handler: () => Promise<void>, info: RequestHandlerInstrumentationInfo): MaybePromise<void>;
986
- }
987
971
 
988
972
  /**
989
973
  * A Router instance manages all navigation and data loading/mutations
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
27
27
  var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
28
28
 
29
29
  /**
30
- * react-router v0.0.0-experimental-a65d6f5
30
+ * react-router v0.0.0-experimental-e0b6ce9
31
31
  *
32
32
  * Copyright (c) Remix Software Inc.
33
33
  *
@@ -109,7 +109,86 @@ function parsePath(path) {
109
109
 
110
110
  // lib/router/instrumentation.ts
111
111
  var UninstrumentedSymbol = Symbol("Uninstrumented");
112
- function getInstrumentedImplementation(impls, handler, getInfo = () => void 0) {
112
+ function getRouteInstrumentationUpdates(fns, route) {
113
+ let aggregated = {
114
+ lazy: [],
115
+ "lazy.loader": [],
116
+ "lazy.action": [],
117
+ "lazy.middleware": [],
118
+ middleware: [],
119
+ loader: [],
120
+ action: []
121
+ };
122
+ fns.forEach(
123
+ (fn) => fn({
124
+ id: route.id,
125
+ index: route.index,
126
+ path: route.path,
127
+ instrument(i) {
128
+ let keys = Object.keys(aggregated);
129
+ for (let key of keys) {
130
+ if (i[key]) {
131
+ aggregated[key].push(i[key]);
132
+ }
133
+ }
134
+ }
135
+ })
136
+ );
137
+ let updates = {};
138
+ if (typeof route.lazy === "function" && aggregated.lazy.length > 0) {
139
+ let instrumented = wrapImpl(aggregated.lazy, route.lazy, () => void 0);
140
+ if (instrumented) {
141
+ updates.lazy = instrumented;
142
+ }
143
+ }
144
+ if (typeof route.lazy === "object") {
145
+ let lazyObject = route.lazy;
146
+ ["middleware", "loader", "action"].forEach((key) => {
147
+ let lazyFn = lazyObject[key];
148
+ let instrumentations = aggregated[`lazy.${key}`];
149
+ if (typeof lazyFn === "function" && instrumentations.length > 0) {
150
+ let instrumented = wrapImpl(instrumentations, lazyFn, () => void 0);
151
+ if (instrumented) {
152
+ updates.lazy = Object.assign(updates.lazy || {}, {
153
+ [key]: instrumented
154
+ });
155
+ }
156
+ }
157
+ });
158
+ }
159
+ ["loader", "action"].forEach((key) => {
160
+ let handler = route[key];
161
+ if (typeof handler === "function" && aggregated[key].length > 0) {
162
+ let original = handler[UninstrumentedSymbol] ?? handler;
163
+ let instrumented = wrapImpl(
164
+ aggregated[key],
165
+ original,
166
+ (...args) => getHandlerInfo(args[0])
167
+ );
168
+ if (instrumented) {
169
+ instrumented[UninstrumentedSymbol] = original;
170
+ updates[key] = instrumented;
171
+ }
172
+ }
173
+ });
174
+ if (route.middleware && route.middleware.length > 0 && aggregated.middleware.length > 0) {
175
+ updates.middleware = route.middleware.map((middleware) => {
176
+ let original = middleware[UninstrumentedSymbol] ?? middleware;
177
+ let instrumented = wrapImpl(
178
+ aggregated.middleware,
179
+ original,
180
+ (...args) => getHandlerInfo(args[0])
181
+ );
182
+ if (instrumented) {
183
+ instrumented[UninstrumentedSymbol] = original;
184
+ return instrumented;
185
+ }
186
+ return middleware;
187
+ });
188
+ }
189
+ return updates;
190
+ }
191
+ function wrapImpl(impls, handler, getInfo) {
113
192
  if (impls.length === 0) {
114
193
  return null;
115
194
  }
@@ -137,102 +216,28 @@ async function recurseRight(impls, info, handler, index) {
137
216
  }, info);
138
217
  }
139
218
  }
140
- function getInstrumentationInfo(args) {
219
+ function getHandlerInfo(args) {
141
220
  let { request, context, params, unstable_pattern } = args;
142
221
  return {
143
- // pseudo "Request" with the info they may want to read from
144
- request: {
145
- method: request.method,
146
- url: request.url,
147
- // Maybe make this a proxy that only supports `get`?
148
- headers: {
149
- get: (...args2) => request.headers.get(...args2)
150
- }
151
- },
222
+ request: getReadonlyRequest(request),
152
223
  params: { ...params },
153
224
  unstable_pattern,
154
- context: {
155
- get: (...args2) => context.get(...args2)
156
- }
225
+ context: getReadonlyContext(context)
157
226
  };
158
227
  }
159
- function getInstrumentationsByType(instrumentations, key) {
160
- let value = [];
161
- for (let i in instrumentations) {
162
- let instrumentation = instrumentations[i];
163
- if (key in instrumentation && instrumentation[key] != null) {
164
- value.push(instrumentation[key]);
228
+ function getReadonlyRequest(request) {
229
+ return {
230
+ method: request.method,
231
+ url: request.url,
232
+ headers: {
233
+ get: (...args) => request.headers.get(...args)
165
234
  }
166
- }
167
- return value;
235
+ };
168
236
  }
169
- function getInstrumentationUpdates(fns, route) {
170
- let instrumentations = [];
171
- fns.forEach(
172
- (fn) => fn({
173
- id: route.id,
174
- index: route.index,
175
- path: route.path,
176
- instrument(i) {
177
- instrumentations.push(i);
178
- }
179
- })
180
- );
181
- let updates = {};
182
- if (instrumentations.length > 0) {
183
- ["lazy", "loader", "action"].forEach((key) => {
184
- let func = route[key];
185
- if (typeof func === "function") {
186
- let original = func[UninstrumentedSymbol] ?? func;
187
- let instrumented = getInstrumentedImplementation(
188
- getInstrumentationsByType(instrumentations, key),
189
- original,
190
- key === "lazy" ? () => void 0 : (...args) => getInstrumentationInfo(
191
- args[0]
192
- )
193
- );
194
- if (instrumented) {
195
- instrumented[UninstrumentedSymbol] = original;
196
- updates[key] = instrumented;
197
- }
198
- }
199
- });
200
- if (route.middleware && route.middleware.length > 0) {
201
- updates.middleware = route.middleware.map((middleware) => {
202
- let original = middleware[UninstrumentedSymbol] ?? middleware;
203
- let instrumented = getInstrumentedImplementation(
204
- getInstrumentationsByType(instrumentations, "middleware"),
205
- original,
206
- (...args) => getInstrumentationInfo(
207
- args[0]
208
- )
209
- );
210
- if (instrumented) {
211
- instrumented[UninstrumentedSymbol] = original;
212
- return instrumented;
213
- }
214
- return middleware;
215
- });
216
- }
217
- if (typeof route.lazy === "object") {
218
- let lazyObject = route.lazy;
219
- ["middleware", "loader", "action"].forEach((key) => {
220
- let func = lazyObject[key];
221
- if (typeof func === "function") {
222
- let instrumented = getInstrumentedImplementation(
223
- getInstrumentationsByType(instrumentations, `lazy.${key}`),
224
- func
225
- );
226
- if (instrumented) {
227
- updates.lazy = Object.assign(updates.lazy || {}, {
228
- [key]: instrumented
229
- });
230
- }
231
- }
232
- });
233
- }
234
- }
235
- return updates;
237
+ function getReadonlyContext(context) {
238
+ return {
239
+ get: (ctx) => context.get(ctx)
240
+ };
236
241
  }
237
242
 
238
243
  // lib/router/utils.ts
@@ -835,7 +840,7 @@ function createStaticHandler(routes, opts) {
835
840
  mapRouteProperties = (route) => {
836
841
  return {
837
842
  ..._mapRouteProperties(route),
838
- ...getInstrumentationUpdates(
843
+ ...getRouteInstrumentationUpdates(
839
844
  instrumentations.map((i) => i.route).filter(Boolean),
840
845
  route
841
846
  )
@@ -1333,13 +1338,14 @@ function createStaticHandler(routes, opts) {
1333
1338
  // Up to but not including the boundary
1334
1339
  matches.findIndex((m) => m.route.id === pendingActionResult[0]) - 1
1335
1340
  ) : void 0;
1341
+ let pattern = getRoutePattern(matches.map((m) => m.route.path));
1336
1342
  dsMatches = matches.map((match, index) => {
1337
1343
  if (maxIdx != null && index > maxIdx) {
1338
1344
  return getDataStrategyMatch(
1339
1345
  mapRouteProperties,
1340
1346
  manifest,
1341
1347
  request,
1342
- getRoutePattern(matches.map((m) => m.route.path)),
1348
+ pattern,
1343
1349
  match,
1344
1350
  [],
1345
1351
  requestContext,
@@ -1350,7 +1356,7 @@ function createStaticHandler(routes, opts) {
1350
1356
  mapRouteProperties,
1351
1357
  manifest,
1352
1358
  request,
1353
- getRoutePattern(matches.map((m) => m.route.path)),
1359
+ pattern,
1354
1360
  match,
1355
1361
  [],
1356
1362
  requestContext,
@@ -1689,7 +1695,7 @@ function runServerMiddlewarePipeline(args, handler, errorHandler) {
1689
1695
  }
1690
1696
  }
1691
1697
  async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {
1692
- let { matches, request, params, context } = args;
1698
+ let { matches, request, params, context, unstable_pattern } = args;
1693
1699
  let tuples = matches.flatMap(
1694
1700
  (m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
1695
1701
  );
@@ -1698,7 +1704,7 @@ async function runMiddlewarePipeline(args, handler, processResult, isResult, err
1698
1704
  request,
1699
1705
  params,
1700
1706
  context,
1701
- unstable_pattern: getRoutePattern(matches.map((m) => m.route.path))
1707
+ unstable_pattern
1702
1708
  },
1703
1709
  tuples,
1704
1710
  handler,