react-router 7.9.4 → 7.9.6

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 (74) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/dist/development/browser-BbBXFHbO.d.ts +310 -0
  3. package/dist/development/browser-C07r42Tt.d.mts +310 -0
  4. package/dist/development/{chunk-OIYGIGL5.mjs → chunk-4WY6JWTD.mjs} +458 -43
  5. package/dist/development/{chunk-DI2QHYMJ.js → chunk-AMVS5XVJ.js} +1314 -138
  6. package/dist/development/{chunk-WY5IRSCW.mjs → chunk-G3INQAYP.mjs} +197 -857
  7. package/dist/development/chunk-O4JVZSOY.js +1310 -0
  8. package/dist/development/chunk-PZWDWJAY.js +188 -0
  9. package/dist/development/dom-export.d.mts +103 -6
  10. package/dist/development/dom-export.d.ts +103 -4
  11. package/dist/development/dom-export.js +708 -20
  12. package/dist/development/dom-export.mjs +692 -11
  13. package/dist/{production/index-react-server-client-BbRcBjrA.d.ts → development/index-react-server-client-Da3kmxNd.d.ts} +195 -135
  14. package/dist/{production/index-react-server-client-BIz4AUNd.d.mts → development/index-react-server-client-rcoGPJhU.d.mts} +137 -78
  15. package/dist/development/index-react-server-client.d.mts +2 -3
  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 +107 -3
  20. package/dist/development/index-react-server.d.ts +107 -3
  21. package/dist/development/index-react-server.js +259 -13
  22. package/dist/development/index-react-server.mjs +259 -13
  23. package/dist/development/index.d.mts +14 -320
  24. package/dist/development/index.d.ts +14 -362
  25. package/dist/development/index.js +146 -962
  26. package/dist/development/index.mjs +3 -9
  27. package/dist/development/{routeModules-D5iJ6JYT.d.ts → instrumentation-Unc20tLk.d.ts} +178 -25
  28. package/dist/development/lib/types/internal.d.mts +2 -3
  29. package/dist/development/lib/types/internal.d.ts +2 -2
  30. package/dist/development/lib/types/internal.js +1 -1
  31. package/dist/development/lib/types/internal.mjs +1 -1
  32. package/dist/{production/register-C34pU-in.d.ts → development/register-BpU9rFBJ.d.ts} +1 -1
  33. package/dist/development/{register-CI4bTprK.d.mts → register-QkB3HGjm.d.mts} +1 -1
  34. package/dist/{production/context-DSyS5mLj.d.mts → development/router-CAvh_Drx.d.mts} +1877 -1254
  35. package/dist/production/browser-BbBXFHbO.d.ts +310 -0
  36. package/dist/production/browser-C07r42Tt.d.mts +310 -0
  37. package/dist/production/{chunk-4E5LHRQP.js → chunk-EAIF67OW.js} +1314 -138
  38. package/dist/production/{chunk-FR6HSPLK.mjs → chunk-FDUMZGKM.mjs} +197 -857
  39. package/dist/production/{chunk-3TADTUL4.mjs → chunk-FUSXQSWG.mjs} +458 -43
  40. package/dist/production/chunk-G5A35OQU.js +188 -0
  41. package/dist/production/chunk-QN64DHI4.js +1310 -0
  42. package/dist/production/dom-export.d.mts +103 -6
  43. package/dist/production/dom-export.d.ts +103 -4
  44. package/dist/production/dom-export.js +708 -20
  45. package/dist/production/dom-export.mjs +692 -11
  46. package/dist/{development/index-react-server-client-BIz4AUNd.d.mts → production/index-react-server-client-Da3kmxNd.d.ts} +137 -78
  47. package/dist/{development/index-react-server-client-BbRcBjrA.d.ts → production/index-react-server-client-rcoGPJhU.d.mts} +195 -135
  48. package/dist/production/index-react-server-client.d.mts +2 -3
  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 +107 -3
  53. package/dist/production/index-react-server.d.ts +107 -3
  54. package/dist/production/index-react-server.js +259 -13
  55. package/dist/production/index-react-server.mjs +259 -13
  56. package/dist/production/index.d.mts +14 -320
  57. package/dist/production/index.d.ts +14 -362
  58. package/dist/production/index.js +146 -962
  59. package/dist/production/index.mjs +3 -9
  60. package/dist/production/{routeModules-D5iJ6JYT.d.ts → instrumentation-Unc20tLk.d.ts} +178 -25
  61. package/dist/production/lib/types/internal.d.mts +2 -3
  62. package/dist/production/lib/types/internal.d.ts +2 -2
  63. package/dist/production/lib/types/internal.js +1 -1
  64. package/dist/production/lib/types/internal.mjs +1 -1
  65. package/dist/{development/register-C34pU-in.d.ts → production/register-BpU9rFBJ.d.ts} +1 -1
  66. package/dist/production/{register-CI4bTprK.d.mts → register-QkB3HGjm.d.mts} +1 -1
  67. package/dist/{development/context-DSyS5mLj.d.mts → production/router-CAvh_Drx.d.mts} +1877 -1254
  68. package/package.json +1 -1
  69. package/dist/development/browser-z32v5KVN.d.mts +0 -46
  70. package/dist/development/chunk-72XNTZCV.js +0 -2089
  71. package/dist/development/route-data-DZQOUSqV.d.mts +0 -473
  72. package/dist/production/browser-z32v5KVN.d.mts +0 -46
  73. package/dist/production/chunk-WNLQ53P5.js +0 -2089
  74. package/dist/production/route-data-DZQOUSqV.d.mts +0 -473
@@ -1,6 +1,148 @@
1
- import { ai as HTMLFormMethod, ag as FormEncType, k as RelativeRoutingType, by as RouteManifest, bz as ServerRouteModule, O as MiddlewareEnabled, K as RouterContextProvider, J as AppLoadContext, ak as LoaderFunctionArgs, ab as ActionFunctionArgs, f as RouteModules, H as HydrationState, a0 as DataRouteObject, W as ClientLoaderFunction, a4 as StaticHandlerContext, bb as PageLinkDescriptor, T as To, bA as History, a3 as GetScrollRestorationKeyFunction, Z as RouterInit, bB as FutureConfig$1, g as DataStrategyFunction, $ as PatchRoutesOnNavigationFunction, h as NavigateOptions, a5 as Fetcher, r as RouteObject, e as Router, j as SerializeFrom, B as BlockerFunction, a as Location, bC as CreateStaticHandlerOptions$1, a1 as StaticHandler } from './routeModules-D5iJ6JYT.js';
1
+ import { bE as RouteManifest, o as RouteModules, Q as HydrationState, a1 as DataRouteObject, a as ClientLoaderFunction, a5 as StaticHandlerContext, bF as ServerRouteModule, q as MiddlewareEnabled, c as RouterContextProvider, r as AppLoadContext, al as LoaderFunctionArgs, ac as ActionFunctionArgs, au as unstable_ServerInstrumentation, aj as HTMLFormMethod, ah as FormEncType, w as RelativeRoutingType, bh as PageLinkDescriptor, T as To, bG as History, a4 as GetScrollRestorationKeyFunction, e as RouterInit, bH as FutureConfig$1, u as unstable_ClientInstrumentation, p as DataStrategyFunction, a0 as PatchRoutesOnNavigationFunction, s as NavigateOptions, a6 as Fetcher, K as RouteObject, n as Router, v as SerializeFrom, B as BlockerFunction, L as Location, bI as CreateStaticHandlerOptions$1, a2 as StaticHandler } from './instrumentation-Unc20tLk.js';
2
2
  import * as React from 'react';
3
3
 
4
+ interface Route {
5
+ index?: boolean;
6
+ caseSensitive?: boolean;
7
+ id: string;
8
+ parentId?: string;
9
+ path?: string;
10
+ }
11
+ interface EntryRoute extends Route {
12
+ hasAction: boolean;
13
+ hasLoader: boolean;
14
+ hasClientAction: boolean;
15
+ hasClientLoader: boolean;
16
+ hasClientMiddleware: boolean;
17
+ hasErrorBoundary: boolean;
18
+ imports?: string[];
19
+ css?: string[];
20
+ module: string;
21
+ clientActionModule: string | undefined;
22
+ clientLoaderModule: string | undefined;
23
+ clientMiddlewareModule: string | undefined;
24
+ hydrateFallbackModule: string | undefined;
25
+ parentId?: string;
26
+ }
27
+ declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, ssr: boolean, isSpaMode: boolean): DataRouteObject[];
28
+ declare function createClientRoutes(manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState | null, ssr: boolean, isSpaMode: boolean, parentId?: string, routesByParentId?: Record<string, Omit<EntryRoute, "children">[]>, needsRevalidation?: Set<string>): DataRouteObject[];
29
+ declare function shouldHydrateRouteLoader(routeId: string, clientLoader: ClientLoaderFunction | undefined, hasLoader: boolean, isSpaMode: boolean): boolean;
30
+
31
+ type SerializedError = {
32
+ message: string;
33
+ stack?: string;
34
+ };
35
+ interface FrameworkContextObject {
36
+ manifest: AssetsManifest;
37
+ routeModules: RouteModules;
38
+ criticalCss?: CriticalCss;
39
+ serverHandoffString?: string;
40
+ future: FutureConfig;
41
+ ssr: boolean;
42
+ isSpaMode: boolean;
43
+ routeDiscovery: ServerBuild["routeDiscovery"];
44
+ serializeError?(error: Error): SerializedError;
45
+ renderMeta?: {
46
+ didRenderScripts?: boolean;
47
+ streamCache?: Record<number, Promise<void> & {
48
+ result?: {
49
+ done: boolean;
50
+ value: string;
51
+ };
52
+ error?: unknown;
53
+ }>;
54
+ };
55
+ }
56
+ interface EntryContext extends FrameworkContextObject {
57
+ staticHandlerContext: StaticHandlerContext;
58
+ serverHandoffStream?: ReadableStream<Uint8Array>;
59
+ }
60
+ interface FutureConfig {
61
+ unstable_subResourceIntegrity: boolean;
62
+ v8_middleware: boolean;
63
+ }
64
+ type CriticalCss = string | {
65
+ rel: "stylesheet";
66
+ href: string;
67
+ };
68
+ interface AssetsManifest {
69
+ entry: {
70
+ imports: string[];
71
+ module: string;
72
+ };
73
+ routes: RouteManifest<EntryRoute>;
74
+ url: string;
75
+ version: string;
76
+ hmr?: {
77
+ timestamp?: number;
78
+ runtime: string;
79
+ };
80
+ sri?: Record<string, string> | true;
81
+ }
82
+
83
+ type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
84
+ interface ServerRoute extends Route {
85
+ children: ServerRoute[];
86
+ module: ServerRouteModule;
87
+ }
88
+
89
+ type OptionalCriticalCss = CriticalCss | undefined;
90
+ /**
91
+ * The output of the compiler for the server build.
92
+ */
93
+ interface ServerBuild {
94
+ entry: {
95
+ module: ServerEntryModule;
96
+ };
97
+ routes: ServerRouteManifest;
98
+ assets: AssetsManifest;
99
+ basename?: string;
100
+ publicPath: string;
101
+ assetsBuildDirectory: string;
102
+ future: FutureConfig;
103
+ ssr: boolean;
104
+ unstable_getCriticalCss?: (args: {
105
+ pathname: string;
106
+ }) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
107
+ /**
108
+ * @deprecated This is now done via a custom header during prerendering
109
+ */
110
+ isSpaMode: boolean;
111
+ prerender: string[];
112
+ routeDiscovery: {
113
+ mode: "lazy" | "initial";
114
+ manifestPath: string;
115
+ };
116
+ }
117
+ interface HandleDocumentRequestFunction {
118
+ (request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: MiddlewareEnabled extends true ? RouterContextProvider : AppLoadContext): Promise<Response> | Response;
119
+ }
120
+ interface HandleDataRequestFunction {
121
+ (response: Response, args: {
122
+ request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
123
+ context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
124
+ params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
125
+ }): Promise<Response> | Response;
126
+ }
127
+ interface HandleErrorFunction {
128
+ (error: unknown, args: {
129
+ request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
130
+ context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
131
+ params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
132
+ }): void;
133
+ }
134
+ /**
135
+ * A module that serves as the entry point for a Remix app during server
136
+ * rendering.
137
+ */
138
+ interface ServerEntryModule {
139
+ default: HandleDocumentRequestFunction;
140
+ handleDataRequest?: HandleDataRequestFunction;
141
+ handleError?: HandleErrorFunction;
142
+ unstable_instrumentations?: unstable_ServerInstrumentation[];
143
+ streamTimeout?: number;
144
+ }
145
+
4
146
  type ParamKeyValuePair = [string, string];
5
147
  type URLSearchParamsInit = string | ParamKeyValuePair[] | Record<string, string | string[]> | URLSearchParams;
6
148
  /**
@@ -107,139 +249,6 @@ interface SubmitOptions extends FetcherSubmitOptions {
107
249
  viewTransition?: boolean;
108
250
  }
109
251
 
110
- type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
111
- interface ServerRoute extends Route {
112
- children: ServerRoute[];
113
- module: ServerRouteModule;
114
- }
115
-
116
- type OptionalCriticalCss = CriticalCss | undefined;
117
- /**
118
- * The output of the compiler for the server build.
119
- */
120
- interface ServerBuild {
121
- entry: {
122
- module: ServerEntryModule;
123
- };
124
- routes: ServerRouteManifest;
125
- assets: AssetsManifest;
126
- basename?: string;
127
- publicPath: string;
128
- assetsBuildDirectory: string;
129
- future: FutureConfig;
130
- ssr: boolean;
131
- unstable_getCriticalCss?: (args: {
132
- pathname: string;
133
- }) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
134
- /**
135
- * @deprecated This is now done via a custom header during prerendering
136
- */
137
- isSpaMode: boolean;
138
- prerender: string[];
139
- routeDiscovery: {
140
- mode: "lazy" | "initial";
141
- manifestPath: string;
142
- };
143
- }
144
- interface HandleDocumentRequestFunction {
145
- (request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: MiddlewareEnabled extends true ? RouterContextProvider : AppLoadContext): Promise<Response> | Response;
146
- }
147
- interface HandleDataRequestFunction {
148
- (response: Response, args: LoaderFunctionArgs | ActionFunctionArgs): Promise<Response> | Response;
149
- }
150
- interface HandleErrorFunction {
151
- (error: unknown, args: LoaderFunctionArgs | ActionFunctionArgs): void;
152
- }
153
- /**
154
- * A module that serves as the entry point for a Remix app during server
155
- * rendering.
156
- */
157
- interface ServerEntryModule {
158
- default: HandleDocumentRequestFunction;
159
- handleDataRequest?: HandleDataRequestFunction;
160
- handleError?: HandleErrorFunction;
161
- streamTimeout?: number;
162
- }
163
-
164
- interface Route {
165
- index?: boolean;
166
- caseSensitive?: boolean;
167
- id: string;
168
- parentId?: string;
169
- path?: string;
170
- }
171
- interface EntryRoute extends Route {
172
- hasAction: boolean;
173
- hasLoader: boolean;
174
- hasClientAction: boolean;
175
- hasClientLoader: boolean;
176
- hasClientMiddleware: boolean;
177
- hasErrorBoundary: boolean;
178
- imports?: string[];
179
- css?: string[];
180
- module: string;
181
- clientActionModule: string | undefined;
182
- clientLoaderModule: string | undefined;
183
- clientMiddlewareModule: string | undefined;
184
- hydrateFallbackModule: string | undefined;
185
- parentId?: string;
186
- }
187
- declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, ssr: boolean, isSpaMode: boolean): DataRouteObject[];
188
- declare function createClientRoutes(manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState | null, ssr: boolean, isSpaMode: boolean, parentId?: string, routesByParentId?: Record<string, Omit<EntryRoute, "children">[]>, needsRevalidation?: Set<string>): DataRouteObject[];
189
- declare function shouldHydrateRouteLoader(routeId: string, clientLoader: ClientLoaderFunction | undefined, hasLoader: boolean, isSpaMode: boolean): boolean;
190
-
191
- type SerializedError = {
192
- message: string;
193
- stack?: string;
194
- };
195
- interface FrameworkContextObject {
196
- manifest: AssetsManifest;
197
- routeModules: RouteModules;
198
- criticalCss?: CriticalCss;
199
- serverHandoffString?: string;
200
- future: FutureConfig;
201
- ssr: boolean;
202
- isSpaMode: boolean;
203
- routeDiscovery: ServerBuild["routeDiscovery"];
204
- serializeError?(error: Error): SerializedError;
205
- renderMeta?: {
206
- didRenderScripts?: boolean;
207
- streamCache?: Record<number, Promise<void> & {
208
- result?: {
209
- done: boolean;
210
- value: string;
211
- };
212
- error?: unknown;
213
- }>;
214
- };
215
- }
216
- interface EntryContext extends FrameworkContextObject {
217
- staticHandlerContext: StaticHandlerContext;
218
- serverHandoffStream?: ReadableStream<Uint8Array>;
219
- }
220
- interface FutureConfig {
221
- unstable_subResourceIntegrity: boolean;
222
- v8_middleware: boolean;
223
- }
224
- type CriticalCss = string | {
225
- rel: "stylesheet";
226
- href: string;
227
- };
228
- interface AssetsManifest {
229
- entry: {
230
- imports: string[];
231
- module: string;
232
- };
233
- routes: RouteManifest<EntryRoute>;
234
- url: string;
235
- version: string;
236
- hmr?: {
237
- timestamp?: number;
238
- runtime: string;
239
- };
240
- sri?: Record<string, string> | true;
241
- }
242
-
243
252
  declare const FrameworkContext: React.Context<FrameworkContextObject | undefined>;
244
253
  /**
245
254
  * Defines the discovery behavior of the link:
@@ -521,6 +530,55 @@ interface DOMRouterOpts {
521
530
  * ```
522
531
  */
523
532
  hydrationData?: HydrationState;
533
+ /**
534
+ * Array of instrumentation objects allowing you to instrument the router and
535
+ * individual routes prior to router initialization (and on any subsequently
536
+ * added routes via `route.lazy` or `patchRoutesOnNavigation`). This is
537
+ * mostly useful for observability such as wrapping navigations, fetches,
538
+ * as well as route loaders/actions/middlewares with logging and/or performance
539
+ * tracing.
540
+ *
541
+ * ```tsx
542
+ * let router = createBrowserRouter(routes, {
543
+ * unstable_instrumentations: [logging]
544
+ * });
545
+ *
546
+ *
547
+ * let logging = {
548
+ * router({ instrument }) {
549
+ * instrument({
550
+ * navigate: (impl, info) => logExecution(`navigate ${info.to}`, impl),
551
+ * fetch: (impl, info) => logExecution(`fetch ${info.to}`, impl)
552
+ * });
553
+ * },
554
+ * route({ instrument, id }) {
555
+ * instrument({
556
+ * middleware: (impl, info) => logExecution(
557
+ * `middleware ${info.request.url} (route ${id})`,
558
+ * impl
559
+ * ),
560
+ * loader: (impl, info) => logExecution(
561
+ * `loader ${info.request.url} (route ${id})`,
562
+ * impl
563
+ * ),
564
+ * action: (impl, info) => logExecution(
565
+ * `action ${info.request.url} (route ${id})`,
566
+ * impl
567
+ * ),
568
+ * })
569
+ * }
570
+ * };
571
+ *
572
+ * async function logExecution(label: string, impl: () => Promise<void>) {
573
+ * let start = performance.now();
574
+ * console.log(`start ${label}`);
575
+ * await impl();
576
+ * let duration = Math.round(performance.now() - start);
577
+ * console.log(`end ${label} (${duration}ms)`);
578
+ * }
579
+ * ```
580
+ */
581
+ unstable_instrumentations?: unstable_ClientInstrumentation[];
524
582
  /**
525
583
  * Override the default data strategy of running loaders in parallel.
526
584
  * See {@link DataStrategyFunction}.
@@ -1026,6 +1084,7 @@ interface DOMRouterOpts {
1026
1084
  * @param {DOMRouterOpts.future} opts.future n/a
1027
1085
  * @param {DOMRouterOpts.getContext} opts.getContext n/a
1028
1086
  * @param {DOMRouterOpts.hydrationData} opts.hydrationData n/a
1087
+ * @param {DOMRouterOpts.unstable_instrumentations} opts.unstable_instrumentations n/a
1029
1088
  * @param {DOMRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a
1030
1089
  * @param {DOMRouterOpts.window} opts.window n/a
1031
1090
  * @returns An initialized {@link DataRouter| data router} to pass to {@link RouterProvider | `<RouterProvider>`}
@@ -1033,7 +1092,7 @@ interface DOMRouterOpts {
1033
1092
  declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts): Router;
1034
1093
  /**
1035
1094
  * Create a new {@link DataRouter| data router} that manages the application
1036
- * path via the URL [`hash`]https://developer.mozilla.org/en-US/docs/Web/API/URL/hash).
1095
+ * path via the URL [`hash`](https://developer.mozilla.org/en-US/docs/Web/API/URL/hash).
1037
1096
  *
1038
1097
  * @public
1039
1098
  * @category Data Routers
@@ -1044,6 +1103,7 @@ declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts
1044
1103
  * @param {DOMRouterOpts.future} opts.future n/a
1045
1104
  * @param {DOMRouterOpts.getContext} opts.getContext n/a
1046
1105
  * @param {DOMRouterOpts.hydrationData} opts.hydrationData n/a
1106
+ * @param {DOMRouterOpts.unstable_instrumentations} opts.unstable_instrumentations n/a
1047
1107
  * @param {DOMRouterOpts.dataStrategy} opts.dataStrategy n/a
1048
1108
  * @param {DOMRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a
1049
1109
  * @param {DOMRouterOpts.window} opts.window n/a
@@ -1,60 +1,32 @@
1
- import { b7 as RouteManifest, i as MiddlewareEnabled, g as RouterContextProvider, b as LoaderFunctionArgs, A as ActionFunctionArgs, O as StaticHandlerContext, H as HydrationState, F as DataRouteObject, a3 as HTMLFormMethod, a1 as FormEncType, m as RelativeRoutingType, T as To, b8 as History, K as GetScrollRestorationKeyFunction, a as RouterInit, b9 as FutureConfig$1, k as DataStrategyFunction, C as PatchRoutesOnNavigationFunction, N as NavigateOptions, Q as Fetcher, t as RouteObject, j as Router, B as BlockerFunction, L as Location, ba as CreateStaticHandlerOptions$1, G as StaticHandler } from './context-DSyS5mLj.mjs';
1
+ import { bE as RouteManifest, q as RouteModules, W as HydrationState, a3 as DataRouteObject, a as ClientLoaderFunction, a7 as StaticHandlerContext, bF as ServerRouteModule, s as MiddlewareEnabled, c as RouterContextProvider, t as AppLoadContext, an as LoaderFunctionArgs, ae as ActionFunctionArgs, aw as unstable_ServerInstrumentation, al as HTMLFormMethod, aj as FormEncType, y as RelativeRoutingType, bh as PageLinkDescriptor, T as To, bG as History, a6 as GetScrollRestorationKeyFunction, e as RouterInit, bH as FutureConfig$1, u as unstable_ClientInstrumentation, r as DataStrategyFunction, a2 as PatchRoutesOnNavigationFunction, v as NavigateOptions, a8 as Fetcher, Q as RouteObject, p as Router, x as SerializeFrom, B as BlockerFunction, L as Location, bI as CreateStaticHandlerOptions$1, a4 as StaticHandler } from './router-CAvh_Drx.mjs';
2
2
  import * as React from 'react';
3
- import { o as ServerRouteModule, A as AppLoadContext, c as RouteModules, h as ClientLoaderFunction, m as PageLinkDescriptor, d as SerializeFrom } from './route-data-DZQOUSqV.mjs';
4
3
 
5
- type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
6
- interface ServerRoute extends Route {
7
- children: ServerRoute[];
8
- module: ServerRouteModule;
9
- }
10
-
11
- type OptionalCriticalCss = CriticalCss | undefined;
12
- /**
13
- * The output of the compiler for the server build.
14
- */
15
- interface ServerBuild {
16
- entry: {
17
- module: ServerEntryModule;
18
- };
19
- routes: ServerRouteManifest;
20
- assets: AssetsManifest;
21
- basename?: string;
22
- publicPath: string;
23
- assetsBuildDirectory: string;
24
- future: FutureConfig;
25
- ssr: boolean;
26
- unstable_getCriticalCss?: (args: {
27
- pathname: string;
28
- }) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
29
- /**
30
- * @deprecated This is now done via a custom header during prerendering
31
- */
32
- isSpaMode: boolean;
33
- prerender: string[];
34
- routeDiscovery: {
35
- mode: "lazy" | "initial";
36
- manifestPath: string;
37
- };
38
- }
39
- interface HandleDocumentRequestFunction {
40
- (request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: MiddlewareEnabled extends true ? RouterContextProvider : AppLoadContext): Promise<Response> | Response;
41
- }
42
- interface HandleDataRequestFunction {
43
- (response: Response, args: LoaderFunctionArgs | ActionFunctionArgs): Promise<Response> | Response;
44
- }
45
- interface HandleErrorFunction {
46
- (error: unknown, args: LoaderFunctionArgs | ActionFunctionArgs): void;
4
+ interface Route {
5
+ index?: boolean;
6
+ caseSensitive?: boolean;
7
+ id: string;
8
+ parentId?: string;
9
+ path?: string;
47
10
  }
48
- /**
49
- * A module that serves as the entry point for a Remix app during server
50
- * rendering.
51
- */
52
- interface ServerEntryModule {
53
- default: HandleDocumentRequestFunction;
54
- handleDataRequest?: HandleDataRequestFunction;
55
- handleError?: HandleErrorFunction;
56
- streamTimeout?: number;
11
+ interface EntryRoute extends Route {
12
+ hasAction: boolean;
13
+ hasLoader: boolean;
14
+ hasClientAction: boolean;
15
+ hasClientLoader: boolean;
16
+ hasClientMiddleware: boolean;
17
+ hasErrorBoundary: boolean;
18
+ imports?: string[];
19
+ css?: string[];
20
+ module: string;
21
+ clientActionModule: string | undefined;
22
+ clientLoaderModule: string | undefined;
23
+ clientMiddlewareModule: string | undefined;
24
+ hydrateFallbackModule: string | undefined;
25
+ parentId?: string;
57
26
  }
27
+ declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, ssr: boolean, isSpaMode: boolean): DataRouteObject[];
28
+ declare function createClientRoutes(manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState | null, ssr: boolean, isSpaMode: boolean, parentId?: string, routesByParentId?: Record<string, Omit<EntryRoute, "children">[]>, needsRevalidation?: Set<string>): DataRouteObject[];
29
+ declare function shouldHydrateRouteLoader(routeId: string, clientLoader: ClientLoaderFunction | undefined, hasLoader: boolean, isSpaMode: boolean): boolean;
58
30
 
59
31
  type SerializedError = {
60
32
  message: string;
@@ -108,32 +80,68 @@ interface AssetsManifest {
108
80
  sri?: Record<string, string> | true;
109
81
  }
110
82
 
111
- interface Route {
112
- index?: boolean;
113
- caseSensitive?: boolean;
114
- id: string;
115
- parentId?: string;
116
- path?: string;
83
+ type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
84
+ interface ServerRoute extends Route {
85
+ children: ServerRoute[];
86
+ module: ServerRouteModule;
117
87
  }
118
- interface EntryRoute extends Route {
119
- hasAction: boolean;
120
- hasLoader: boolean;
121
- hasClientAction: boolean;
122
- hasClientLoader: boolean;
123
- hasClientMiddleware: boolean;
124
- hasErrorBoundary: boolean;
125
- imports?: string[];
126
- css?: string[];
127
- module: string;
128
- clientActionModule: string | undefined;
129
- clientLoaderModule: string | undefined;
130
- clientMiddlewareModule: string | undefined;
131
- hydrateFallbackModule: string | undefined;
132
- parentId?: string;
88
+
89
+ type OptionalCriticalCss = CriticalCss | undefined;
90
+ /**
91
+ * The output of the compiler for the server build.
92
+ */
93
+ interface ServerBuild {
94
+ entry: {
95
+ module: ServerEntryModule;
96
+ };
97
+ routes: ServerRouteManifest;
98
+ assets: AssetsManifest;
99
+ basename?: string;
100
+ publicPath: string;
101
+ assetsBuildDirectory: string;
102
+ future: FutureConfig;
103
+ ssr: boolean;
104
+ unstable_getCriticalCss?: (args: {
105
+ pathname: string;
106
+ }) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
107
+ /**
108
+ * @deprecated This is now done via a custom header during prerendering
109
+ */
110
+ isSpaMode: boolean;
111
+ prerender: string[];
112
+ routeDiscovery: {
113
+ mode: "lazy" | "initial";
114
+ manifestPath: string;
115
+ };
116
+ }
117
+ interface HandleDocumentRequestFunction {
118
+ (request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: MiddlewareEnabled extends true ? RouterContextProvider : AppLoadContext): Promise<Response> | Response;
119
+ }
120
+ interface HandleDataRequestFunction {
121
+ (response: Response, args: {
122
+ request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
123
+ context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
124
+ params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
125
+ }): Promise<Response> | Response;
126
+ }
127
+ interface HandleErrorFunction {
128
+ (error: unknown, args: {
129
+ request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
130
+ context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
131
+ params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
132
+ }): void;
133
+ }
134
+ /**
135
+ * A module that serves as the entry point for a Remix app during server
136
+ * rendering.
137
+ */
138
+ interface ServerEntryModule {
139
+ default: HandleDocumentRequestFunction;
140
+ handleDataRequest?: HandleDataRequestFunction;
141
+ handleError?: HandleErrorFunction;
142
+ unstable_instrumentations?: unstable_ServerInstrumentation[];
143
+ streamTimeout?: number;
133
144
  }
134
- declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, ssr: boolean, isSpaMode: boolean): DataRouteObject[];
135
- declare function createClientRoutes(manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState | null, ssr: boolean, isSpaMode: boolean, parentId?: string, routesByParentId?: Record<string, Omit<EntryRoute, "children">[]>, needsRevalidation?: Set<string>): DataRouteObject[];
136
- declare function shouldHydrateRouteLoader(routeId: string, clientLoader: ClientLoaderFunction | undefined, hasLoader: boolean, isSpaMode: boolean): boolean;
137
145
 
138
146
  type ParamKeyValuePair = [string, string];
139
147
  type URLSearchParamsInit = string | ParamKeyValuePair[] | Record<string, string | string[]> | URLSearchParams;
@@ -522,6 +530,55 @@ interface DOMRouterOpts {
522
530
  * ```
523
531
  */
524
532
  hydrationData?: HydrationState;
533
+ /**
534
+ * Array of instrumentation objects allowing you to instrument the router and
535
+ * individual routes prior to router initialization (and on any subsequently
536
+ * added routes via `route.lazy` or `patchRoutesOnNavigation`). This is
537
+ * mostly useful for observability such as wrapping navigations, fetches,
538
+ * as well as route loaders/actions/middlewares with logging and/or performance
539
+ * tracing.
540
+ *
541
+ * ```tsx
542
+ * let router = createBrowserRouter(routes, {
543
+ * unstable_instrumentations: [logging]
544
+ * });
545
+ *
546
+ *
547
+ * let logging = {
548
+ * router({ instrument }) {
549
+ * instrument({
550
+ * navigate: (impl, info) => logExecution(`navigate ${info.to}`, impl),
551
+ * fetch: (impl, info) => logExecution(`fetch ${info.to}`, impl)
552
+ * });
553
+ * },
554
+ * route({ instrument, id }) {
555
+ * instrument({
556
+ * middleware: (impl, info) => logExecution(
557
+ * `middleware ${info.request.url} (route ${id})`,
558
+ * impl
559
+ * ),
560
+ * loader: (impl, info) => logExecution(
561
+ * `loader ${info.request.url} (route ${id})`,
562
+ * impl
563
+ * ),
564
+ * action: (impl, info) => logExecution(
565
+ * `action ${info.request.url} (route ${id})`,
566
+ * impl
567
+ * ),
568
+ * })
569
+ * }
570
+ * };
571
+ *
572
+ * async function logExecution(label: string, impl: () => Promise<void>) {
573
+ * let start = performance.now();
574
+ * console.log(`start ${label}`);
575
+ * await impl();
576
+ * let duration = Math.round(performance.now() - start);
577
+ * console.log(`end ${label} (${duration}ms)`);
578
+ * }
579
+ * ```
580
+ */
581
+ unstable_instrumentations?: unstable_ClientInstrumentation[];
525
582
  /**
526
583
  * Override the default data strategy of running loaders in parallel.
527
584
  * See {@link DataStrategyFunction}.
@@ -1027,6 +1084,7 @@ interface DOMRouterOpts {
1027
1084
  * @param {DOMRouterOpts.future} opts.future n/a
1028
1085
  * @param {DOMRouterOpts.getContext} opts.getContext n/a
1029
1086
  * @param {DOMRouterOpts.hydrationData} opts.hydrationData n/a
1087
+ * @param {DOMRouterOpts.unstable_instrumentations} opts.unstable_instrumentations n/a
1030
1088
  * @param {DOMRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a
1031
1089
  * @param {DOMRouterOpts.window} opts.window n/a
1032
1090
  * @returns An initialized {@link DataRouter| data router} to pass to {@link RouterProvider | `<RouterProvider>`}
@@ -1034,7 +1092,7 @@ interface DOMRouterOpts {
1034
1092
  declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts): Router;
1035
1093
  /**
1036
1094
  * Create a new {@link DataRouter| data router} that manages the application
1037
- * path via the URL [`hash`]https://developer.mozilla.org/en-US/docs/Web/API/URL/hash).
1095
+ * path via the URL [`hash`](https://developer.mozilla.org/en-US/docs/Web/API/URL/hash).
1038
1096
  *
1039
1097
  * @public
1040
1098
  * @category Data Routers
@@ -1045,6 +1103,7 @@ declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts
1045
1103
  * @param {DOMRouterOpts.future} opts.future n/a
1046
1104
  * @param {DOMRouterOpts.getContext} opts.getContext n/a
1047
1105
  * @param {DOMRouterOpts.hydrationData} opts.hydrationData n/a
1106
+ * @param {DOMRouterOpts.unstable_instrumentations} opts.unstable_instrumentations n/a
1048
1107
  * @param {DOMRouterOpts.dataStrategy} opts.dataStrategy n/a
1049
1108
  * @param {DOMRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a
1050
1109
  * @param {DOMRouterOpts.window} opts.window n/a
@@ -1,4 +1,3 @@
1
- export { aE as MemoryRouter, aF as Navigate, aG as Outlet, aH as Route, aI as Router, aJ as RouterProvider, aK as Routes, ar as UNSAFE_AwaitContextProvider, b1 as UNSAFE_WithComponentProps, b5 as UNSAFE_WithErrorBoundaryProps, b3 as UNSAFE_WithHydrateFallbackProps } from './context-DSyS5mLj.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-BIz4AUNd.mjs';
1
+ export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aR as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './router-CAvh_Drx.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-rcoGPJhU.mjs';
3
3
  import 'react';
4
- import './route-data-DZQOUSqV.mjs';
@@ -1,3 +1,3 @@
1
- export { aY as MemoryRouter, aZ as Navigate, a_ as Outlet, a$ as Route, b0 as Router, b1 as RouterProvider, b2 as Routes, aJ as UNSAFE_AwaitContextProvider, bs as UNSAFE_WithComponentProps, bw as UNSAFE_WithErrorBoundaryProps, bu as UNSAFE_WithHydrateFallbackProps } from './routeModules-D5iJ6JYT.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-BbRcBjrA.js';
1
+ export { b2 as MemoryRouter, b3 as Navigate, b4 as Outlet, b5 as Route, b6 as Router, b7 as RouterProvider, b8 as Routes, aP as UNSAFE_AwaitContextProvider, by as UNSAFE_WithComponentProps, bC as UNSAFE_WithErrorBoundaryProps, bA as UNSAFE_WithHydrateFallbackProps } from './instrumentation-Unc20tLk.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-Da3kmxNd.js';
3
3
  import 'react';