react-router 7.14.1 → 7.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +105 -0
- package/dist/development/{browser-D-3-U2Jj.d.mts → browser-CRsXgNrY.d.mts} +2 -2
- package/dist/{production/browser-D-3-U2Jj.d.mts → development/browser-wDl1FZEL.d.ts} +2 -2
- package/dist/{production/chunk-3SUPTI2U.js → development/chunk-2D5H3HU3.js} +7 -7
- package/dist/development/{chunk-OE4NN4TA.mjs → chunk-5KNZJZUH.mjs} +362 -213
- package/dist/development/{chunk-YMKMFAYZ.js → chunk-AM3XM4LS.js} +314 -172
- package/dist/development/{chunk-BFXCU3MI.mjs → chunk-RMD3H4O3.mjs} +81 -62
- package/dist/development/{chunk-3F6IB66O.js → chunk-Z5YQYACE.js} +146 -139
- package/dist/{production/context-BzhbVly6.d.mts → development/context-BQs41HrG.d.mts} +94 -42
- package/dist/development/{routeModules-CM_clkdE.d.ts → data-BVUf681J.d.mts} +89 -56
- package/dist/{production/routeModules-CM_clkdE.d.ts → development/data-BqZ2x964.d.ts} +79 -46
- package/dist/development/dom-export.d.mts +9 -9
- package/dist/development/dom-export.d.ts +9 -9
- package/dist/development/dom-export.js +37 -40
- package/dist/development/dom-export.mjs +12 -15
- package/dist/development/{index-react-server-client-CimaPp9o.d.ts → index-react-server-client-CSv-KZBk.d.ts} +123 -121
- package/dist/{production/index-react-server-client-WSaoxloq.d.mts → development/index-react-server-client-Ck_yZ1qL.d.mts} +102 -100
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +3 -3
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +107 -36
- package/dist/development/index-react-server.d.ts +107 -36
- package/dist/development/index-react-server.js +60 -33
- package/dist/development/index-react-server.mjs +60 -33
- package/dist/development/index.d.mts +11 -11
- package/dist/development/index.d.ts +11 -11
- package/dist/development/index.js +174 -155
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-CMVbvxj9.d.ts → development/instrumentation-DlJ2QV7d.d.ts} +73 -21
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-D1WlEpq9.d.ts → register-Bsscfj79.d.ts} +1 -1
- package/dist/{production/register-D1WlEpq9.d.ts → development/register-Df8okEea.d.mts} +1 -1
- package/dist/production/{browser-CtktEGQs.d.ts → browser-CRsXgNrY.d.mts} +2 -2
- package/dist/{development/browser-CtktEGQs.d.ts → production/browser-wDl1FZEL.d.ts} +2 -2
- package/dist/production/{chunk-G5ZWO7Q6.mjs → chunk-23ZOHYE5.mjs} +81 -62
- package/dist/{development/chunk-7VLQJKNG.js → production/chunk-7YXKJMLN.js} +7 -7
- package/dist/production/{chunk-SPR7R4GU.mjs → chunk-GM3PW4GX.mjs} +362 -213
- package/dist/production/{chunk-UVEQGZIH.js → chunk-LCJTIOKZ.js} +314 -172
- package/dist/production/{chunk-LIOP3ILM.js → chunk-YBQJ3ABE.js} +146 -139
- package/dist/{development/context-BzhbVly6.d.mts → production/context-BQs41HrG.d.mts} +94 -42
- package/dist/{development/routeModules-Djumx26z.d.mts → production/data-BVUf681J.d.mts} +79 -46
- package/dist/production/{routeModules-Djumx26z.d.mts → data-BqZ2x964.d.ts} +89 -56
- package/dist/production/dom-export.d.mts +9 -9
- package/dist/production/dom-export.d.ts +9 -9
- package/dist/production/dom-export.js +37 -40
- package/dist/production/dom-export.mjs +12 -15
- package/dist/production/{index-react-server-client-CimaPp9o.d.ts → index-react-server-client-CSv-KZBk.d.ts} +123 -121
- package/dist/{development/index-react-server-client-WSaoxloq.d.mts → production/index-react-server-client-Ck_yZ1qL.d.mts} +102 -100
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +3 -3
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +107 -36
- package/dist/production/index-react-server.d.ts +107 -36
- package/dist/production/index-react-server.js +60 -33
- package/dist/production/index-react-server.mjs +60 -33
- package/dist/production/index.d.mts +11 -11
- package/dist/production/index.d.ts +11 -11
- package/dist/production/index.js +174 -155
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-CMVbvxj9.d.ts → production/instrumentation-DlJ2QV7d.d.ts} +73 -21
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-aE9ob3TK.d.mts → production/register-Bsscfj79.d.ts} +1 -1
- package/dist/production/{register-aE9ob3TK.d.mts → register-Df8okEea.d.mts} +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.15.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
isSession,
|
|
29
29
|
routeRSCServerRequest,
|
|
30
30
|
setDevServerHooks
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-RMD3H4O3.mjs";
|
|
32
32
|
import {
|
|
33
33
|
Action,
|
|
34
34
|
Await,
|
|
@@ -141,7 +141,7 @@ import {
|
|
|
141
141
|
withComponentProps,
|
|
142
142
|
withErrorBoundaryProps,
|
|
143
143
|
withHydrateFallbackProps
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-5KNZJZUH.mjs";
|
|
145
145
|
export {
|
|
146
146
|
Await,
|
|
147
147
|
BrowserRouter,
|
package/dist/{production/instrumentation-CMVbvxj9.d.ts → development/instrumentation-DlJ2QV7d.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as RouteObject, f as History, g as MaybePromise, c as RouterContextProvider, h as MapRoutePropertiesFunction, i as Action, L as Location, D as DataRouteMatch, j as Submission, k as RouteData, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, U as UIMatch, T as To,
|
|
1
|
+
import { e as RouteObject, f as History, g as MaybePromise, c as RouterContextProvider, h as MapRoutePropertiesFunction, i as Action, L as Location, D as DataRouteMatch, j as Submission, k as RouteData, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, n as DataRouteObject, o as RouteBranch, p as RouteManifest, U as UIMatch, T as To, q as HTMLFormMethod, F as FormEncType, r as Path, s as LoaderFunctionArgs, t as MiddlewareEnabled, u as AppLoadContext } from './data-BqZ2x964.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A Router instance manages all navigation and data loading/mutations
|
|
@@ -32,6 +32,20 @@ interface Router {
|
|
|
32
32
|
* Return the routes for this router instance
|
|
33
33
|
*/
|
|
34
34
|
get routes(): DataRouteObject[];
|
|
35
|
+
/**
|
|
36
|
+
* @private
|
|
37
|
+
* PRIVATE - DO NOT USE
|
|
38
|
+
*
|
|
39
|
+
* Return the route branches for this router instance
|
|
40
|
+
*/
|
|
41
|
+
get branches(): RouteBranch<DataRouteObject>[] | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* @private
|
|
44
|
+
* PRIVATE - DO NOT USE
|
|
45
|
+
*
|
|
46
|
+
* Return the manifest for this router instance
|
|
47
|
+
*/
|
|
48
|
+
get manifest(): RouteManifest;
|
|
35
49
|
/**
|
|
36
50
|
* @private
|
|
37
51
|
* PRIVATE - DO NOT USE
|
|
@@ -279,7 +293,6 @@ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "e
|
|
|
279
293
|
* Future flags to toggle new feature behavior
|
|
280
294
|
*/
|
|
281
295
|
interface FutureConfig {
|
|
282
|
-
unstable_passThroughRequests: boolean;
|
|
283
296
|
}
|
|
284
297
|
/**
|
|
285
298
|
* Initialization options for createRouter
|
|
@@ -289,7 +302,7 @@ interface RouterInit {
|
|
|
289
302
|
history: History;
|
|
290
303
|
basename?: string;
|
|
291
304
|
getContext?: () => MaybePromise<RouterContextProvider>;
|
|
292
|
-
|
|
305
|
+
instrumentations?: ClientInstrumentation[];
|
|
293
306
|
mapRouteProperties?: MapRoutePropertiesFunction;
|
|
294
307
|
future?: Partial<FutureConfig>;
|
|
295
308
|
hydrationRouteProperties?: string[];
|
|
@@ -317,7 +330,33 @@ interface StaticHandlerContext {
|
|
|
317
330
|
* A StaticHandler instance manages a singular SSR navigation/fetch event
|
|
318
331
|
*/
|
|
319
332
|
interface StaticHandler {
|
|
333
|
+
/**
|
|
334
|
+
* The set of data routes managed by this handler
|
|
335
|
+
*/
|
|
320
336
|
dataRoutes: DataRouteObject[];
|
|
337
|
+
/**
|
|
338
|
+
* @private
|
|
339
|
+
* PRIVATE - DO NOT USE
|
|
340
|
+
*
|
|
341
|
+
* The route branches derived from the data routes, used for internal route
|
|
342
|
+
* matching in Framework Mode
|
|
343
|
+
*/
|
|
344
|
+
_internalRouteBranches: RouteBranch<DataRouteObject>[];
|
|
345
|
+
/**
|
|
346
|
+
* Perform a query for a given request - executing all matched route
|
|
347
|
+
* loaders/actions. Used for document requests.
|
|
348
|
+
*
|
|
349
|
+
* @param request The request to query
|
|
350
|
+
* @param opts Optional query options
|
|
351
|
+
* @param opts.dataStrategy Alternate dataStrategy implementation
|
|
352
|
+
* @param opts.filterMatchesToLoad Predicate function to filter which matches should be loaded
|
|
353
|
+
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
|
|
354
|
+
* to generate a response to bubble back up the middleware chain
|
|
355
|
+
* @param opts.requestContext Context object to pass to loaders/actions
|
|
356
|
+
* @param opts.skipLoaderErrorBubbling Skip loader error bubbling
|
|
357
|
+
* @param opts.skipRevalidation Skip revalidation after action submission
|
|
358
|
+
* @param opts.normalizePath Normalize the request path
|
|
359
|
+
*/
|
|
321
360
|
query(request: Request, opts?: {
|
|
322
361
|
requestContext?: unknown;
|
|
323
362
|
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
|
@@ -327,14 +366,27 @@ interface StaticHandler {
|
|
|
327
366
|
generateMiddlewareResponse?: (query: (r: Request, args?: {
|
|
328
367
|
filterMatchesToLoad?: (match: DataRouteMatch) => boolean;
|
|
329
368
|
}) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
|
|
330
|
-
|
|
369
|
+
normalizePath?: (request: Request) => Path;
|
|
331
370
|
}): Promise<StaticHandlerContext | Response>;
|
|
371
|
+
/**
|
|
372
|
+
* Perform a query for a specific route. Used for resource requests.
|
|
373
|
+
*
|
|
374
|
+
* @param request The request to query
|
|
375
|
+
* @param opts Optional queryRoute options
|
|
376
|
+
* @param opts.dataStrategy Alternate dataStrategy implementation
|
|
377
|
+
* @param opts.generateMiddlewareResponse To enable middleware, provide a function
|
|
378
|
+
* to generate a response to bubble back up the middleware chain
|
|
379
|
+
* @param opts.requestContext Context object to pass to loaders/actions
|
|
380
|
+
* @param opts.routeId The ID of the route to query
|
|
381
|
+
* @param opts.normalizePath Normalize the request path
|
|
382
|
+
|
|
383
|
+
*/
|
|
332
384
|
queryRoute(request: Request, opts?: {
|
|
333
385
|
routeId?: string;
|
|
334
386
|
requestContext?: unknown;
|
|
335
387
|
dataStrategy?: DataStrategyFunction<unknown>;
|
|
336
388
|
generateMiddlewareResponse?: (queryRoute: (r: Request) => Promise<Response>) => MaybePromise<Response>;
|
|
337
|
-
|
|
389
|
+
normalizePath?: (request: Request) => Path;
|
|
338
390
|
}): Promise<any>;
|
|
339
391
|
}
|
|
340
392
|
type ViewTransitionOpts = {
|
|
@@ -378,14 +430,14 @@ type BaseNavigateOrFetchOptions = {
|
|
|
378
430
|
preventScrollReset?: boolean;
|
|
379
431
|
relative?: RelativeRoutingType;
|
|
380
432
|
flushSync?: boolean;
|
|
381
|
-
|
|
433
|
+
defaultShouldRevalidate?: boolean;
|
|
382
434
|
};
|
|
383
435
|
type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
|
|
384
436
|
replace?: boolean;
|
|
385
437
|
state?: any;
|
|
386
438
|
fromRouteId?: string;
|
|
387
439
|
viewTransition?: boolean;
|
|
388
|
-
|
|
440
|
+
mask?: To;
|
|
389
441
|
};
|
|
390
442
|
type BaseSubmissionOptions = {
|
|
391
443
|
formMethod?: HTMLFormMethod;
|
|
@@ -568,29 +620,29 @@ declare function createRouter(init: RouterInit): Router;
|
|
|
568
620
|
interface CreateStaticHandlerOptions {
|
|
569
621
|
basename?: string;
|
|
570
622
|
mapRouteProperties?: MapRoutePropertiesFunction;
|
|
571
|
-
|
|
623
|
+
instrumentations?: Pick<ServerInstrumentation, "route">[];
|
|
572
624
|
future?: Partial<FutureConfig>;
|
|
573
625
|
}
|
|
574
626
|
|
|
575
|
-
type
|
|
576
|
-
handler?:
|
|
577
|
-
route?:
|
|
627
|
+
type ServerInstrumentation = {
|
|
628
|
+
handler?: InstrumentRequestHandlerFunction;
|
|
629
|
+
route?: InstrumentRouteFunction;
|
|
578
630
|
};
|
|
579
|
-
type
|
|
580
|
-
router?:
|
|
581
|
-
route?:
|
|
631
|
+
type ClientInstrumentation = {
|
|
632
|
+
router?: InstrumentRouterFunction;
|
|
633
|
+
route?: InstrumentRouteFunction;
|
|
582
634
|
};
|
|
583
|
-
type
|
|
584
|
-
type
|
|
585
|
-
type
|
|
586
|
-
type
|
|
635
|
+
type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
|
636
|
+
type InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
|
637
|
+
type InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
|
638
|
+
type InstrumentationHandlerResult = {
|
|
587
639
|
status: "success";
|
|
588
640
|
error: undefined;
|
|
589
641
|
} | {
|
|
590
642
|
status: "error";
|
|
591
643
|
error: Error;
|
|
592
644
|
};
|
|
593
|
-
type InstrumentFunction<T> = (handler: () => Promise<
|
|
645
|
+
type InstrumentFunction<T> = (handler: () => Promise<InstrumentationHandlerResult>, info: T) => Promise<void>;
|
|
594
646
|
type ReadonlyRequest = {
|
|
595
647
|
method: string;
|
|
596
648
|
url: string;
|
|
@@ -616,7 +668,7 @@ type RouteLazyInstrumentationInfo = undefined;
|
|
|
616
668
|
type RouteHandlerInstrumentationInfo = Readonly<{
|
|
617
669
|
request: ReadonlyRequest;
|
|
618
670
|
params: LoaderFunctionArgs["params"];
|
|
619
|
-
|
|
671
|
+
pattern: string;
|
|
620
672
|
context: ReadonlyContext;
|
|
621
673
|
}>;
|
|
622
674
|
type InstrumentableRouter = {
|
|
@@ -654,4 +706,4 @@ type RequestHandlerInstrumentationInfo = Readonly<{
|
|
|
654
706
|
context: ReadonlyContext | undefined;
|
|
655
707
|
}>;
|
|
656
708
|
|
|
657
|
-
export { type BlockerFunction as B, type
|
|
709
|
+
export { type BlockerFunction as B, type ClientInstrumentation as C, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type Navigation as N, type RouterInit as R, type StaticHandler as S, type Router as a, type Blocker as b, type RelativeRoutingType as c, type RouterState as d, type GetScrollRestorationKeyFunction as e, type StaticHandlerContext as f, type NavigationStates as g, type RouterSubscriber as h, type RouterNavigateOptions as i, type RouterFetchOptions as j, type RevalidationState as k, type ServerInstrumentation as l, type InstrumentRouterFunction as m, type InstrumentRouteFunction as n, type InstrumentationHandlerResult as o, IDLE_NAVIGATION as p, IDLE_FETCHER as q, IDLE_BLOCKER as r, createRouter as s, type FutureConfig as t, type CreateStaticHandlerOptions as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RouteModule, e as LinkDescriptor, L as Location, F as Func, f as Pretty, g as MetaDescriptor, G as GetLoaderData, h as ServerDataFunctionArgs, i as MiddlewareNextFunction, j as ClientDataFunctionArgs, D as DataStrategyResult, k as ServerDataFrom, N as Normalize, l as GetActionData } from '../../
|
|
2
|
-
import { R as RouteFiles, P as Pages } from '../../register-
|
|
1
|
+
import { R as RouteModule, e as LinkDescriptor, L as Location, F as Func, f as Pretty, g as MetaDescriptor, G as GetLoaderData, h as ServerDataFunctionArgs, i as MiddlewareNextFunction, j as ClientDataFunctionArgs, D as DataStrategyResult, k as ServerDataFrom, N as Normalize, l as GetActionData } from '../../data-BVUf681J.mjs';
|
|
2
|
+
import { R as RouteFiles, P as Pages } from '../../register-Df8okEea.mjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
type MaybePromise<T> = T | Promise<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RouteModule,
|
|
2
|
-
import { R as RouteFiles, P as Pages } from '../../register-
|
|
1
|
+
import { R as RouteModule, v as LinkDescriptor, L as Location, w as Func, x as Pretty, y as MetaDescriptor, G as GetLoaderData, z as ServerDataFunctionArgs, B as MiddlewareNextFunction, E as ClientDataFunctionArgs, I as DataStrategyResult, J as ServerDataFrom, N as Normalize, K as GetActionData } from '../../data-BqZ2x964.js';
|
|
2
|
+
import { R as RouteFiles, P as Pages } from '../../register-Bsscfj79.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
type MaybePromise<T> = T | Promise<T>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterInit } from './
|
|
3
|
-
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './
|
|
2
|
+
import { R as RouterInit } from './context-BQs41HrG.mjs';
|
|
3
|
+
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './data-BVUf681J.mjs';
|
|
4
4
|
|
|
5
5
|
declare function getRequest(): Request;
|
|
6
6
|
type RSCRouteConfigEntryBase = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterInit } from './instrumentation-
|
|
3
|
-
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './
|
|
2
|
+
import { R as RouterInit } from './instrumentation-DlJ2QV7d.js';
|
|
3
|
+
import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './data-BqZ2x964.js';
|
|
4
4
|
|
|
5
5
|
declare function getRequest(): Request;
|
|
6
6
|
type RSCRouteConfigEntryBase = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.15.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
SingleFetchRedirectSymbol,
|
|
23
23
|
StaticRouterProvider,
|
|
24
24
|
StreamTransfer,
|
|
25
|
+
URL_LIMIT,
|
|
25
26
|
convertRoutesToDataRoutes,
|
|
26
27
|
createMemoryRouter,
|
|
27
28
|
createServerRoutes,
|
|
@@ -41,6 +42,7 @@ import {
|
|
|
41
42
|
isResponse,
|
|
42
43
|
isRouteErrorResponse,
|
|
43
44
|
matchRoutes,
|
|
45
|
+
matchRoutesImpl,
|
|
44
46
|
redirect,
|
|
45
47
|
redirectDocument,
|
|
46
48
|
replace,
|
|
@@ -51,7 +53,7 @@ import {
|
|
|
51
53
|
withComponentProps,
|
|
52
54
|
withErrorBoundaryProps,
|
|
53
55
|
withHydrateFallbackProps
|
|
54
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-GM3PW4GX.mjs";
|
|
55
57
|
|
|
56
58
|
// lib/dom/ssr/server.tsx
|
|
57
59
|
import * as React from "react";
|
|
@@ -86,7 +88,9 @@ function ServerRouter({
|
|
|
86
88
|
delete context.staticHandlerContext.loaderData[routeId];
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
|
-
let router = createStaticRouter(routes, context.staticHandlerContext
|
|
91
|
+
let router = createStaticRouter(routes, context.staticHandlerContext, {
|
|
92
|
+
branches: context.branches
|
|
93
|
+
});
|
|
90
94
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
91
95
|
FrameworkContext.Provider,
|
|
92
96
|
{
|
|
@@ -137,8 +141,7 @@ function createRoutesStub(routes, _context) {
|
|
|
137
141
|
if (routerRef.current == null) {
|
|
138
142
|
frameworkContextRef.current = {
|
|
139
143
|
future: {
|
|
140
|
-
|
|
141
|
-
unstable_subResourceIntegrity: future?.unstable_subResourceIntegrity === true,
|
|
144
|
+
v8_passThroughRequests: future?.v8_passThroughRequests === true,
|
|
142
145
|
v8_middleware: future?.v8_middleware === true,
|
|
143
146
|
unstable_trailingSlashAwareDataRequests: future?.unstable_trailingSlashAwareDataRequests === true
|
|
144
147
|
},
|
|
@@ -490,29 +493,48 @@ function serializeErrors(errors, serverMode) {
|
|
|
490
493
|
return serialized;
|
|
491
494
|
}
|
|
492
495
|
|
|
496
|
+
// lib/server-runtime/invariant.ts
|
|
497
|
+
function invariant(value, message) {
|
|
498
|
+
if (value === false || value === null || typeof value === "undefined") {
|
|
499
|
+
console.error(
|
|
500
|
+
"The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose"
|
|
501
|
+
);
|
|
502
|
+
throw new Error(message);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
493
506
|
// lib/server-runtime/routeMatching.ts
|
|
494
|
-
function matchServerRoutes(
|
|
495
|
-
let matches =
|
|
496
|
-
|
|
507
|
+
function matchServerRoutes(manifest, dataRoutes, branches, pathname, basename) {
|
|
508
|
+
let matches = matchRoutesImpl(
|
|
509
|
+
dataRoutes,
|
|
497
510
|
pathname,
|
|
498
|
-
basename
|
|
511
|
+
basename ?? "/",
|
|
512
|
+
false,
|
|
513
|
+
branches
|
|
499
514
|
);
|
|
500
515
|
if (!matches) return null;
|
|
501
|
-
return matches.map((match) =>
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
516
|
+
return matches.map((match) => {
|
|
517
|
+
let route = manifest[match.route.id];
|
|
518
|
+
invariant(
|
|
519
|
+
route,
|
|
520
|
+
`Route with id "${match.route.id}" not found in manifest.`
|
|
521
|
+
);
|
|
522
|
+
return {
|
|
523
|
+
params: match.params,
|
|
524
|
+
pathname: match.pathname,
|
|
525
|
+
route
|
|
526
|
+
};
|
|
527
|
+
});
|
|
506
528
|
}
|
|
507
529
|
|
|
508
530
|
// lib/server-runtime/data.ts
|
|
509
531
|
async function callRouteHandler(handler, args, future) {
|
|
510
532
|
let result = await handler({
|
|
511
|
-
request: future.
|
|
512
|
-
|
|
533
|
+
request: future.v8_passThroughRequests ? args.request : stripRoutesParam(stripIndexParam(args.request)),
|
|
534
|
+
url: args.url,
|
|
513
535
|
params: args.params,
|
|
514
536
|
context: args.context,
|
|
515
|
-
|
|
537
|
+
pattern: args.pattern
|
|
516
538
|
});
|
|
517
539
|
if (isDataWithResponseInit(result) && result.init && result.init.status && isRedirectStatusCode(result.init.status)) {
|
|
518
540
|
throw new Response(null, result.init);
|
|
@@ -558,16 +580,6 @@ function stripRoutesParam(request) {
|
|
|
558
580
|
return new Request(url.href, init);
|
|
559
581
|
}
|
|
560
582
|
|
|
561
|
-
// lib/server-runtime/invariant.ts
|
|
562
|
-
function invariant(value, message) {
|
|
563
|
-
if (value === false || value === null || typeof value === "undefined") {
|
|
564
|
-
console.error(
|
|
565
|
-
"The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose"
|
|
566
|
-
);
|
|
567
|
-
throw new Error(message);
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
|
|
571
583
|
// lib/server-runtime/dev.ts
|
|
572
584
|
var globalDevServerHooksKey = "__reactRouterDevServerHooks";
|
|
573
585
|
function setDevServerHooks(devServerHooks) {
|
|
@@ -579,7 +591,7 @@ function getDevServerHooks() {
|
|
|
579
591
|
function getBuildTimeHeader(request, headerName) {
|
|
580
592
|
if (typeof process !== "undefined") {
|
|
581
593
|
try {
|
|
582
|
-
if (process.env
|
|
594
|
+
if (process.env.hasOwnProperty("IS_RR_BUILD_REQUEST") && process.env.IS_RR_BUILD_REQUEST === "yes") {
|
|
583
595
|
return request.headers.get(headerName);
|
|
584
596
|
}
|
|
585
597
|
} catch (e) {
|
|
@@ -602,12 +614,6 @@ function groupRoutesByParentId(manifest) {
|
|
|
602
614
|
});
|
|
603
615
|
return routes;
|
|
604
616
|
}
|
|
605
|
-
function createRoutes(manifest, parentId = "", routesByParentId = groupRoutesByParentId(manifest)) {
|
|
606
|
-
return (routesByParentId[parentId] || []).map((route) => ({
|
|
607
|
-
...route,
|
|
608
|
-
children: createRoutes(manifest, route.id, routesByParentId)
|
|
609
|
-
}));
|
|
610
|
-
}
|
|
611
617
|
function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesByParentId = groupRoutesByParentId(manifest)) {
|
|
612
618
|
return (routesByParentId[parentId] || []).map((route) => {
|
|
613
619
|
let commonRoute = {
|
|
@@ -894,7 +900,7 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand
|
|
|
894
900
|
} catch (e) {
|
|
895
901
|
return handleQueryError(new Error("Bad Request"), 400);
|
|
896
902
|
}
|
|
897
|
-
let handlerRequest = build.future.
|
|
903
|
+
let handlerRequest = build.future.v8_passThroughRequests ? request : new Request(handlerUrl, {
|
|
898
904
|
method: request.method,
|
|
899
905
|
body: request.body,
|
|
900
906
|
headers: request.headers,
|
|
@@ -913,7 +919,7 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand
|
|
|
913
919
|
return handleQueryError(error);
|
|
914
920
|
}
|
|
915
921
|
} : void 0,
|
|
916
|
-
|
|
922
|
+
normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
917
923
|
});
|
|
918
924
|
return handleQueryResult(result);
|
|
919
925
|
} catch (error) {
|
|
@@ -962,7 +968,7 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han
|
|
|
962
968
|
let routesParam = new URL(request.url).searchParams.get("_routes");
|
|
963
969
|
let loadRouteIds = routesParam ? new Set(routesParam.split(",")) : null;
|
|
964
970
|
try {
|
|
965
|
-
let handlerRequest = build.future.
|
|
971
|
+
let handlerRequest = build.future.v8_passThroughRequests ? request : new Request(handlerUrl, {
|
|
966
972
|
headers: request.headers,
|
|
967
973
|
signal: request.signal
|
|
968
974
|
});
|
|
@@ -978,7 +984,7 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han
|
|
|
978
984
|
return handleQueryError(error);
|
|
979
985
|
}
|
|
980
986
|
} : void 0,
|
|
981
|
-
|
|
987
|
+
normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
982
988
|
});
|
|
983
989
|
return handleQueryResult(result);
|
|
984
990
|
} catch (error) {
|
|
@@ -1145,12 +1151,12 @@ function encodeViaTurboStream(data2, requestSignal, streamTimeout, serverMode) {
|
|
|
1145
1151
|
|
|
1146
1152
|
// lib/server-runtime/server.ts
|
|
1147
1153
|
function derive(build, mode) {
|
|
1148
|
-
let routes = createRoutes(build.routes);
|
|
1149
1154
|
let dataRoutes = createStaticHandlerDataRoutes(build.routes, build.future);
|
|
1150
1155
|
let serverMode = isServerMode(mode) ? mode : "production" /* Production */;
|
|
1151
1156
|
let staticHandler = createStaticHandler(dataRoutes, {
|
|
1152
1157
|
basename: build.basename,
|
|
1153
|
-
|
|
1158
|
+
instrumentations: build.entry.module.instrumentations,
|
|
1159
|
+
future: build.future
|
|
1154
1160
|
});
|
|
1155
1161
|
let errorHandler = build.entry.module.handleError || ((error, { request }) => {
|
|
1156
1162
|
if (serverMode !== "test" /* Test */ && !request.signal.aborted) {
|
|
@@ -1247,24 +1253,30 @@ function derive(build, mode) {
|
|
|
1247
1253
|
);
|
|
1248
1254
|
if (requestUrl.pathname === manifestUrl) {
|
|
1249
1255
|
try {
|
|
1250
|
-
let res = await handleManifestRequest(
|
|
1256
|
+
let res = await handleManifestRequest(
|
|
1257
|
+
build,
|
|
1258
|
+
staticHandler.dataRoutes,
|
|
1259
|
+
staticHandler._internalRouteBranches,
|
|
1260
|
+
requestUrl
|
|
1261
|
+
);
|
|
1251
1262
|
return res;
|
|
1252
1263
|
} catch (e) {
|
|
1253
1264
|
handleError(e);
|
|
1254
1265
|
return new Response("Unknown Server Error", { status: 500 });
|
|
1255
1266
|
}
|
|
1256
1267
|
}
|
|
1257
|
-
let matches = matchServerRoutes(
|
|
1268
|
+
let matches = matchServerRoutes(
|
|
1269
|
+
build.routes,
|
|
1270
|
+
staticHandler.dataRoutes,
|
|
1271
|
+
staticHandler._internalRouteBranches,
|
|
1272
|
+
normalizedPathname,
|
|
1273
|
+
build.basename
|
|
1274
|
+
);
|
|
1258
1275
|
if (matches && matches.length > 0) {
|
|
1259
1276
|
Object.assign(params, matches[0].params);
|
|
1260
1277
|
}
|
|
1261
1278
|
let response;
|
|
1262
1279
|
if (requestUrl.pathname.endsWith(".data")) {
|
|
1263
|
-
let singleFetchMatches = matchServerRoutes(
|
|
1264
|
-
routes,
|
|
1265
|
-
normalizedPathname,
|
|
1266
|
-
build.basename
|
|
1267
|
-
);
|
|
1268
1280
|
response = await handleSingleFetchRequest(
|
|
1269
1281
|
serverMode,
|
|
1270
1282
|
build,
|
|
@@ -1285,7 +1297,7 @@ function derive(build, mode) {
|
|
|
1285
1297
|
if (build.entry.module.handleDataRequest) {
|
|
1286
1298
|
response = await build.entry.module.handleDataRequest(response, {
|
|
1287
1299
|
context: loadContext,
|
|
1288
|
-
params:
|
|
1300
|
+
params: matches ? matches[0].params : {},
|
|
1289
1301
|
request
|
|
1290
1302
|
});
|
|
1291
1303
|
if (isRedirectResponse(response)) {
|
|
@@ -1335,15 +1347,13 @@ function derive(build, mode) {
|
|
|
1335
1347
|
}
|
|
1336
1348
|
return response;
|
|
1337
1349
|
};
|
|
1338
|
-
if (build.entry.module.
|
|
1350
|
+
if (build.entry.module.instrumentations) {
|
|
1339
1351
|
requestHandler = instrumentHandler(
|
|
1340
1352
|
requestHandler,
|
|
1341
|
-
build.entry.module.
|
|
1353
|
+
build.entry.module.instrumentations.map((i) => i.handler).filter(Boolean)
|
|
1342
1354
|
);
|
|
1343
1355
|
}
|
|
1344
1356
|
return {
|
|
1345
|
-
routes,
|
|
1346
|
-
dataRoutes,
|
|
1347
1357
|
serverMode,
|
|
1348
1358
|
staticHandler,
|
|
1349
1359
|
errorHandler,
|
|
@@ -1352,7 +1362,6 @@ function derive(build, mode) {
|
|
|
1352
1362
|
}
|
|
1353
1363
|
var createRequestHandler = (build, mode) => {
|
|
1354
1364
|
let _build;
|
|
1355
|
-
let routes;
|
|
1356
1365
|
let serverMode;
|
|
1357
1366
|
let staticHandler;
|
|
1358
1367
|
let errorHandler;
|
|
@@ -1361,14 +1370,12 @@ var createRequestHandler = (build, mode) => {
|
|
|
1361
1370
|
_build = typeof build === "function" ? await build() : build;
|
|
1362
1371
|
if (typeof build === "function") {
|
|
1363
1372
|
let derived = derive(_build, mode);
|
|
1364
|
-
routes = derived.routes;
|
|
1365
1373
|
serverMode = derived.serverMode;
|
|
1366
1374
|
staticHandler = derived.staticHandler;
|
|
1367
1375
|
errorHandler = derived.errorHandler;
|
|
1368
1376
|
_requestHandler = derived.requestHandler;
|
|
1369
|
-
} else if (!
|
|
1377
|
+
} else if (!serverMode || !staticHandler || !errorHandler || !_requestHandler) {
|
|
1370
1378
|
let derived = derive(_build, mode);
|
|
1371
|
-
routes = derived.routes;
|
|
1372
1379
|
serverMode = derived.serverMode;
|
|
1373
1380
|
staticHandler = derived.staticHandler;
|
|
1374
1381
|
errorHandler = derived.errorHandler;
|
|
@@ -1377,7 +1384,7 @@ var createRequestHandler = (build, mode) => {
|
|
|
1377
1384
|
return _requestHandler(request, initialContext);
|
|
1378
1385
|
};
|
|
1379
1386
|
};
|
|
1380
|
-
async function handleManifestRequest(build,
|
|
1387
|
+
async function handleManifestRequest(build, dataRoutes, branches, url) {
|
|
1381
1388
|
if (build.assets.version !== url.searchParams.get("version")) {
|
|
1382
1389
|
return new Response(null, {
|
|
1383
1390
|
status: 204,
|
|
@@ -1386,6 +1393,12 @@ async function handleManifestRequest(build, routes, url) {
|
|
|
1386
1393
|
}
|
|
1387
1394
|
});
|
|
1388
1395
|
}
|
|
1396
|
+
if (url.toString().length > URL_LIMIT) {
|
|
1397
|
+
return new Response(null, {
|
|
1398
|
+
statusText: "Bad Request",
|
|
1399
|
+
status: 400
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1389
1402
|
let patches = {};
|
|
1390
1403
|
if (url.searchParams.has("paths")) {
|
|
1391
1404
|
let paths = /* @__PURE__ */ new Set();
|
|
@@ -1402,7 +1415,13 @@ async function handleManifestRequest(build, routes, url) {
|
|
|
1402
1415
|
});
|
|
1403
1416
|
});
|
|
1404
1417
|
for (let path of paths) {
|
|
1405
|
-
let matches = matchServerRoutes(
|
|
1418
|
+
let matches = matchServerRoutes(
|
|
1419
|
+
build.routes,
|
|
1420
|
+
dataRoutes,
|
|
1421
|
+
branches,
|
|
1422
|
+
path,
|
|
1423
|
+
build.basename
|
|
1424
|
+
);
|
|
1406
1425
|
if (matches) {
|
|
1407
1426
|
for (let match of matches) {
|
|
1408
1427
|
let routeId = match.route.id;
|
|
@@ -1470,7 +1489,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
1470
1489
|
return new Response(null, { status: 500 });
|
|
1471
1490
|
}
|
|
1472
1491
|
} : void 0,
|
|
1473
|
-
|
|
1492
|
+
normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
1474
1493
|
});
|
|
1475
1494
|
if (!isResponse(result)) {
|
|
1476
1495
|
result = await renderHtml(result, isSpaMode);
|
|
@@ -1507,6 +1526,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
1507
1526
|
};
|
|
1508
1527
|
let entryContext = {
|
|
1509
1528
|
manifest: build.assets,
|
|
1529
|
+
branches: staticHandler._internalRouteBranches,
|
|
1510
1530
|
routeModules: createEntryRouteModules(build.routes),
|
|
1511
1531
|
staticHandlerContext: context,
|
|
1512
1532
|
criticalCss,
|
|
@@ -1603,7 +1623,7 @@ async function handleResourceRequest(serverMode, build, staticHandler, routeId,
|
|
|
1603
1623
|
return handleQueryRouteError(error);
|
|
1604
1624
|
}
|
|
1605
1625
|
} : void 0,
|
|
1606
|
-
|
|
1626
|
+
normalizePath: (r) => getNormalizedPath(r, build.basename, build.future)
|
|
1607
1627
|
});
|
|
1608
1628
|
return handleQueryRouteResult(result);
|
|
1609
1629
|
} catch (error) {
|
|
@@ -2430,10 +2450,9 @@ function RSCStaticRouter({ getPayload }) {
|
|
|
2430
2450
|
// These flags have no runtime impact so can always be false. If we add
|
|
2431
2451
|
// flags that drive runtime behavior they'll need to be proxied through.
|
|
2432
2452
|
v8_middleware: false,
|
|
2433
|
-
unstable_subResourceIntegrity: false,
|
|
2434
2453
|
unstable_trailingSlashAwareDataRequests: true,
|
|
2435
2454
|
// always on for RSC
|
|
2436
|
-
|
|
2455
|
+
v8_passThroughRequests: true
|
|
2437
2456
|
// always on for RSC
|
|
2438
2457
|
},
|
|
2439
2458
|
isSpaMode: false,
|