react-router 0.0.0-experimental-7aea711dd → 0.0.0-experimental-f1bb8ea3f
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 +33 -0
- package/dist/development/dom-export.d.ts +2 -1
- package/dist/development/dom-export.js +1 -1
- package/dist/development/index-react-server-client.js +1 -1
- package/dist/development/index-react-server.d.ts +34 -2
- package/dist/development/index-react-server.js +25 -220
- package/dist/development/index.d.ts +4 -3
- package/dist/development/index.js +3 -2
- package/dist/development/lib/actions.js +1 -1
- package/dist/development/lib/await.d.ts +5 -0
- package/dist/development/lib/await.js +59 -0
- package/dist/development/lib/components.js +51 -40
- package/dist/development/lib/context.d.ts +9 -4
- package/dist/development/lib/context.js +1 -1
- package/dist/development/lib/dom/dom.d.ts +3 -0
- package/dist/development/lib/dom/dom.js +1 -1
- package/dist/development/lib/dom/lib.d.ts +33 -8
- package/dist/development/lib/dom/lib.js +15 -4
- package/dist/development/lib/dom/server.js +1 -1
- package/dist/development/lib/dom/ssr/components.js +11 -8
- package/dist/development/lib/dom/ssr/data.js +1 -1
- package/dist/development/lib/dom/ssr/entry.d.ts +2 -0
- package/dist/development/lib/dom/ssr/errorBoundaries.js +1 -1
- package/dist/development/lib/dom/ssr/fallback.js +1 -1
- package/dist/development/lib/dom/ssr/fog-of-war.d.ts +3 -2
- package/dist/development/lib/dom/ssr/fog-of-war.js +44 -20
- package/dist/development/lib/dom/ssr/hydration.js +1 -1
- package/dist/development/lib/dom/ssr/invariant.js +1 -1
- package/dist/development/lib/dom/ssr/links.js +1 -1
- package/dist/development/lib/dom/ssr/markup.js +5 -2
- package/dist/development/lib/dom/ssr/routeModules.js +1 -1
- package/dist/development/lib/dom/ssr/routes-test-stub.js +1 -1
- package/dist/development/lib/dom/ssr/routes.d.ts +2 -2
- package/dist/development/lib/dom/ssr/routes.js +8 -8
- package/dist/development/lib/dom/ssr/server.js +3 -1
- package/dist/development/lib/dom/ssr/single-fetch.d.ts +28 -2
- package/dist/development/lib/dom/ssr/single-fetch.js +80 -71
- package/dist/development/lib/dom-export/dom-router-provider.js +1 -1
- package/dist/development/lib/dom-export/hydrated-router.d.ts +28 -0
- package/dist/development/lib/dom-export/hydrated-router.js +24 -12
- package/dist/development/lib/errors.js +1 -1
- package/dist/development/lib/hooks.d.ts +2 -2
- package/dist/development/lib/hooks.js +8 -6
- package/dist/development/lib/href.js +1 -1
- package/dist/development/lib/router/history.js +1 -1
- package/dist/development/lib/router/instrumentation.js +1 -1
- package/dist/development/lib/router/matcher-route-pattern.d.ts +2 -0
- package/dist/development/lib/router/matcher-route-pattern.js +2 -2
- package/dist/development/lib/router/matcher-route-pattern.preload.d.ts +20 -0
- package/dist/development/lib/router/matcher-route-pattern.preload.js +36 -0
- package/dist/development/lib/router/matcher.js +1 -1
- package/dist/development/lib/router/navigation.js +1 -1
- package/dist/development/lib/router/router.d.ts +5 -0
- package/dist/development/lib/router/router.js +63 -44
- package/dist/development/lib/router/url.js +1 -1
- package/dist/development/lib/router/utils.d.ts +24 -9
- package/dist/development/lib/router/utils.js +2 -2
- package/dist/development/lib/rsc/browser.js +1 -1
- package/dist/development/lib/rsc/errorBoundaries.js +1 -1
- package/dist/development/lib/rsc/html-stream/browser.js +1 -1
- package/dist/development/lib/rsc/html-stream/server.js +2 -4
- package/dist/development/lib/rsc/route-modules.js +1 -1
- package/dist/development/lib/rsc/server.rsc.d.ts +7 -0
- package/dist/development/lib/rsc/server.ssr.js +4 -4
- package/dist/development/lib/server-runtime/build.d.ts +14 -0
- package/dist/development/lib/server-runtime/cookies.js +1 -1
- package/dist/development/lib/server-runtime/crypto.js +1 -1
- package/dist/development/lib/server-runtime/data.js +1 -1
- package/dist/development/lib/server-runtime/dev.js +1 -1
- package/dist/development/lib/server-runtime/entry.js +1 -1
- package/dist/development/lib/server-runtime/errors.js +1 -1
- package/dist/development/lib/server-runtime/headers.js +1 -1
- package/dist/development/lib/server-runtime/invariant.js +1 -1
- package/dist/development/lib/server-runtime/mode.js +1 -1
- package/dist/development/lib/server-runtime/routeMatching.js +1 -1
- package/dist/development/lib/server-runtime/routes.js +1 -1
- package/dist/development/lib/server-runtime/server.js +12 -4
- package/dist/development/lib/server-runtime/serverHandoff.js +1 -1
- package/dist/development/lib/server-runtime/sessions/cookieStorage.js +1 -1
- package/dist/development/lib/server-runtime/sessions/memoryStorage.js +1 -1
- package/dist/development/lib/server-runtime/sessions.js +1 -1
- package/dist/development/lib/server-runtime/single-fetch.js +1 -1
- package/dist/development/lib/server-runtime/urls.js +1 -1
- package/dist/development/lib/server-runtime/warnings.js +1 -1
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/route-pattern.d.ts +3 -0
- package/dist/development/route-pattern.js +12 -0
- package/dist/development/vendor/turbo-stream-v2/flatten.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/unflatten.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/utils.js +1 -1
- package/dist/production/dom-export.d.ts +2 -1
- package/dist/production/dom-export.js +1 -1
- package/dist/production/index-react-server-client.js +1 -1
- package/dist/production/index-react-server.d.ts +34 -2
- package/dist/production/index-react-server.js +25 -220
- package/dist/production/index.d.ts +4 -3
- package/dist/production/index.js +3 -2
- package/dist/production/lib/actions.js +1 -1
- package/dist/production/lib/await.d.ts +5 -0
- package/dist/production/lib/await.js +59 -0
- package/dist/production/lib/components.js +51 -40
- package/dist/production/lib/context.d.ts +9 -4
- package/dist/production/lib/context.js +1 -1
- package/dist/production/lib/dom/dom.d.ts +3 -0
- package/dist/production/lib/dom/dom.js +1 -1
- package/dist/production/lib/dom/lib.d.ts +33 -8
- package/dist/production/lib/dom/lib.js +15 -4
- package/dist/production/lib/dom/server.js +1 -1
- package/dist/production/lib/dom/ssr/components.js +11 -8
- package/dist/production/lib/dom/ssr/data.js +1 -1
- package/dist/production/lib/dom/ssr/entry.d.ts +2 -0
- package/dist/production/lib/dom/ssr/errorBoundaries.js +1 -1
- package/dist/production/lib/dom/ssr/fallback.js +1 -1
- package/dist/production/lib/dom/ssr/fog-of-war.d.ts +3 -2
- package/dist/production/lib/dom/ssr/fog-of-war.js +44 -20
- package/dist/production/lib/dom/ssr/hydration.js +1 -1
- package/dist/production/lib/dom/ssr/invariant.js +1 -1
- package/dist/production/lib/dom/ssr/links.js +1 -1
- package/dist/production/lib/dom/ssr/markup.js +5 -2
- package/dist/production/lib/dom/ssr/routeModules.js +1 -1
- package/dist/production/lib/dom/ssr/routes-test-stub.js +1 -1
- package/dist/production/lib/dom/ssr/routes.d.ts +2 -2
- package/dist/production/lib/dom/ssr/routes.js +8 -8
- package/dist/production/lib/dom/ssr/server.js +3 -1
- package/dist/production/lib/dom/ssr/single-fetch.d.ts +28 -2
- package/dist/production/lib/dom/ssr/single-fetch.js +80 -71
- package/dist/production/lib/dom-export/dom-router-provider.js +1 -1
- package/dist/production/lib/dom-export/hydrated-router.d.ts +28 -0
- package/dist/production/lib/dom-export/hydrated-router.js +24 -12
- package/dist/production/lib/errors.js +1 -1
- package/dist/production/lib/hooks.d.ts +2 -2
- package/dist/production/lib/hooks.js +7 -5
- package/dist/production/lib/href.js +1 -1
- package/dist/production/lib/router/history.js +1 -1
- package/dist/production/lib/router/instrumentation.js +1 -1
- package/dist/production/lib/router/matcher-route-pattern.d.ts +2 -0
- package/dist/production/lib/router/matcher-route-pattern.js +2 -2
- package/dist/production/lib/router/matcher-route-pattern.preload.d.ts +20 -0
- package/dist/production/lib/router/matcher-route-pattern.preload.js +36 -0
- package/dist/production/lib/router/matcher.js +1 -1
- package/dist/production/lib/router/navigation.js +1 -1
- package/dist/production/lib/router/router.d.ts +5 -0
- package/dist/production/lib/router/router.js +63 -44
- package/dist/production/lib/router/url.js +1 -1
- package/dist/production/lib/router/utils.d.ts +24 -9
- package/dist/production/lib/router/utils.js +2 -2
- package/dist/production/lib/rsc/browser.js +1 -1
- package/dist/production/lib/rsc/errorBoundaries.js +1 -1
- package/dist/production/lib/rsc/html-stream/browser.js +1 -1
- package/dist/production/lib/rsc/html-stream/server.js +2 -4
- package/dist/production/lib/rsc/route-modules.js +1 -1
- package/dist/production/lib/rsc/server.rsc.d.ts +7 -0
- package/dist/production/lib/rsc/server.ssr.js +4 -4
- package/dist/production/lib/server-runtime/build.d.ts +14 -0
- package/dist/production/lib/server-runtime/cookies.js +1 -1
- package/dist/production/lib/server-runtime/crypto.js +1 -1
- package/dist/production/lib/server-runtime/data.js +1 -1
- package/dist/production/lib/server-runtime/dev.js +1 -1
- package/dist/production/lib/server-runtime/entry.js +1 -1
- package/dist/production/lib/server-runtime/errors.js +1 -1
- package/dist/production/lib/server-runtime/headers.js +1 -1
- package/dist/production/lib/server-runtime/invariant.js +1 -1
- package/dist/production/lib/server-runtime/mode.js +1 -1
- package/dist/production/lib/server-runtime/routeMatching.js +1 -1
- package/dist/production/lib/server-runtime/routes.js +1 -1
- package/dist/production/lib/server-runtime/server.js +12 -4
- package/dist/production/lib/server-runtime/serverHandoff.js +1 -1
- package/dist/production/lib/server-runtime/sessions/cookieStorage.js +1 -1
- package/dist/production/lib/server-runtime/sessions/memoryStorage.js +1 -1
- package/dist/production/lib/server-runtime/sessions.js +1 -1
- package/dist/production/lib/server-runtime/single-fetch.js +1 -1
- package/dist/production/lib/server-runtime/urls.js +1 -1
- package/dist/production/lib/server-runtime/warnings.js +1 -1
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/route-pattern.d.ts +3 -0
- package/dist/production/route-pattern.js +12 -0
- package/dist/production/vendor/turbo-stream-v2/flatten.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/unflatten.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/utils.js +1 -1
- package/docs/explanation/sessions-and-cookies.md +108 -4
- package/docs/how-to/custom-fetch.md +218 -0
- package/docs/how-to/data-strategy.md +23 -1
- package/docs/how-to/fetchers.md +6 -1
- package/docs/how-to/middleware.md +4 -1
- package/docs/how-to/optimize-revalidation.md +178 -5
- package/docs/how-to/pre-rendering.md +23 -1
- package/docs/how-to/react-server-components.md +26 -3
- package/docs/how-to/resource-routes.md +3 -0
- package/docs/how-to/spa.md +2 -0
- package/docs/how-to/view-transitions.md +80 -13
- package/docs/start/data/actions.md +2 -1
- package/docs/start/data/route-object.md +21 -6
- package/docs/start/framework/actions.md +4 -2
- package/docs/start/framework/navigating.md +5 -9
- package/docs/start/framework/rendering.md +37 -0
- package/docs/start/framework/route-module.md +32 -5
- package/docs/upgrading/future.md +27 -6
- package/package.json +18 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## v8.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Deprecate the `createStaticRouter({ branches })` option ([#15297](https://github.com/remix-run/react-router/pull/15297))
|
|
8
|
+
- `createStaticRouter` now caches route branches internally, ignores `branches`, and logs a deprecation warning when the option is provided
|
|
9
|
+
- The deprecated `EntryContext.branches` property remains available for compatibility but is always an empty array
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Prevent stale route discovery during manifest version-mismatch recovery ([#15489](https://github.com/remix-run/react-router/pull/15489))
|
|
14
|
+
- Keep concurrent manifest responses pending while a document reload is in progress
|
|
15
|
+
- Report a discovery error when a previous reload failed to resolve a version mismatch instead of loading a stale route or reloading repeatedly
|
|
16
|
+
- Fail pending requests if a document reload does not complete within five seconds or the document is restored from the back-forward cache, allowing subsequent requests to recover
|
|
17
|
+
- Preserve lazy route module import errors during SPA navigations instead of replacing them with a missing `dataStrategy` result error ([#15464](https://github.com/remix-run/react-router/pull/15464))
|
|
18
|
+
- Switch to more granular internal router contexts to avoid unnecessary route component re-renders when unrelated data router state changes ([#15376](https://github.com/remix-run/react-router/pull/15376))
|
|
19
|
+
- ⚠️ This contains some breaking changes to exported `UNSAFE_` contexts, so please review carefully if you are using those unsafe exports
|
|
20
|
+
- Correctly escape streamed RSC redirect locations in meta tag attributes ([#15491](https://github.com/remix-run/react-router/pull/15491))
|
|
21
|
+
- Avoid unintended `document.startViewTransition` calls during initial hydration and `router.revalidate()` calls ([#15484](https://github.com/remix-run/react-router/pull/15484))
|
|
22
|
+
- Fix `SingleFetchNoResultError` thrown when a fetcher revalidates against a splat route during lazy route discovery ([#15395](https://github.com/remix-run/react-router/pull/15395))
|
|
23
|
+
- Track discovery per fetcher load so revalidation waits for the current load's discovery, even when the fetcher key is reused, while still restarting interrupted loaders after discovery completes
|
|
24
|
+
- Preserve the underlying decode failure as the `cause` of the `Unable to decode turbo-stream response` error ([#15450](https://github.com/remix-run/react-router/pull/15450))
|
|
25
|
+
|
|
26
|
+
### Unstable Changes
|
|
27
|
+
|
|
28
|
+
⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
|
|
29
|
+
|
|
30
|
+
- Add a Data Mode `future.unstable_routePatternMatching` flag for more efficient route matching powered by `@remix-run/route-pattern` ([#15298](https://github.com/remix-run/react-router/pull/15298))
|
|
31
|
+
- Add an `unstable_validateParams` route field to reject invalid parameter values and continue matching
|
|
32
|
+
- Document access control requirements for RSC Server Functions ([#15490](https://github.com/remix-run/react-router/pull/15490))
|
|
33
|
+
- Treat every Server Function as a public endpoint that must perform all of its own access control checks
|
|
34
|
+
- Recommend route actions when access control should be provided by route middleware
|
|
35
|
+
|
|
3
36
|
## v8.3.1
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { RouterProvider, RouterProviderProps } from "./lib/dom-export/dom-router-provider.js";
|
|
3
3
|
import { DecodeActionFunction, DecodeFormStateFunction, DecodeReplyFunction, RSCManifestPayload, RSCPayload, RSCRenderPayload } from "./lib/rsc/server.rsc.js";
|
|
4
4
|
import { RSCHydratedRouter, createCallServer } from "./lib/rsc/browser.js";
|
|
5
|
+
import { RouterFetch, RouterFetchContext } from "./lib/dom/ssr/single-fetch.js";
|
|
5
6
|
import { HydratedRouter, HydratedRouterProps } from "./lib/dom-export/hydrated-router.js";
|
|
6
7
|
import { getRSCStream } from "./lib/rsc/html-stream/browser.js";
|
|
7
|
-
export { HydratedRouter, type HydratedRouterProps, RouterProvider, type RouterProviderProps, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, RSCHydratedRouter as unstable_RSCHydratedRouter, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, createCallServer as unstable_createCallServer, getRSCStream as unstable_getRSCStream };
|
|
8
|
+
export { HydratedRouter, type HydratedRouterProps, RouterProvider, type RouterProviderProps, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, RSCHydratedRouter as unstable_RSCHydratedRouter, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RouterFetch as unstable_RouterFetch, type RouterFetchContext as unstable_RouterFetchContext, createCallServer as unstable_createCallServer, getRSCStream as unstable_getRSCStream };
|
|
@@ -556,6 +556,11 @@ interface DataStrategyMatch extends RouteMatch<string, DataRouteObject> {
|
|
|
556
556
|
*/
|
|
557
557
|
resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
|
|
558
558
|
}
|
|
559
|
+
/**
|
|
560
|
+
* The operation that initiated a data strategy execution. Static handler
|
|
561
|
+
* executions use `"static"`.
|
|
562
|
+
*/
|
|
563
|
+
type DataStrategyInitiator = "initialization" | "navigation" | "fetcher" | "revalidation" | "static";
|
|
559
564
|
interface DataStrategyFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
|
|
560
565
|
/**
|
|
561
566
|
* Matches for this route extended with Data strategy APIs
|
|
@@ -563,8 +568,23 @@ interface DataStrategyFunctionArgs<Context = DefaultContext> extends DataFunctio
|
|
|
563
568
|
matches: DataStrategyMatch[];
|
|
564
569
|
runClientMiddleware: (cb: DataStrategyFunction<Context>) => Promise<Record<string, DataStrategyResult>>;
|
|
565
570
|
/**
|
|
566
|
-
* The
|
|
567
|
-
*
|
|
571
|
+
* The operation that initiated this data strategy execution
|
|
572
|
+
*
|
|
573
|
+
* This field is experimental and subject to breaking changes.
|
|
574
|
+
*/
|
|
575
|
+
unstable_initiator: DataStrategyInitiator;
|
|
576
|
+
/**
|
|
577
|
+
* The history action (`"PUSH"`, `"REPLACE"`, or `"POP"`) for a navigation-
|
|
578
|
+
* initiated execution, including fetchers reloaded by that navigation.
|
|
579
|
+
* `null` for initialization, fetcher, revalidation, and static executions.
|
|
580
|
+
*
|
|
581
|
+
* This field is experimental and subject to breaking changes.
|
|
582
|
+
*/
|
|
583
|
+
unstable_navigationType: Action | null;
|
|
584
|
+
/**
|
|
585
|
+
* The key of the fetcher targeted by this data strategy execution, otherwise
|
|
586
|
+
* `null`. Fetchers reloaded during a navigation or revalidation retain that
|
|
587
|
+
* `unstable_initiator` while providing their key here.
|
|
568
588
|
*/
|
|
569
589
|
fetcherKey: string | null;
|
|
570
590
|
}
|
|
@@ -1390,6 +1410,7 @@ type HydrationState = Partial<Pick<RouterState, "loaderData" | "actionData" | "e
|
|
|
1390
1410
|
* Future flags to toggle new feature behavior
|
|
1391
1411
|
*/
|
|
1392
1412
|
interface FutureConfig {
|
|
1413
|
+
/** Enables route-pattern matching after calling `unstable_preloadRoutePattern()`. */
|
|
1393
1414
|
unstable_routePatternMatching?: boolean;
|
|
1394
1415
|
}
|
|
1395
1416
|
/**
|
|
@@ -1535,6 +1556,10 @@ type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
|
|
|
1535
1556
|
replace?: boolean;
|
|
1536
1557
|
state?: any;
|
|
1537
1558
|
fromRouteId?: string;
|
|
1559
|
+
/**
|
|
1560
|
+
* @deprecated Use React's `<ViewTransition>` component instead. See the
|
|
1561
|
+
* [migration guide](https://reactrouter.com/how-to/view-transitions).
|
|
1562
|
+
*/
|
|
1538
1563
|
viewTransition?: boolean;
|
|
1539
1564
|
mask?: To;
|
|
1540
1565
|
};
|
|
@@ -2363,6 +2388,13 @@ type RouteDiscovery = {
|
|
|
2363
2388
|
* encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components)
|
|
2364
2389
|
* enabled client router.
|
|
2365
2390
|
*
|
|
2391
|
+
* Treat every React Server Function as a public endpoint. Server Functions are
|
|
2392
|
+
* not inherently associated with a route. Any route middleware that runs is
|
|
2393
|
+
* selected from the URL used to call a Server Function, but the client controls
|
|
2394
|
+
* both the Server Function identifier and the URL. Perform all access control
|
|
2395
|
+
* checks within each Server Function, or use a route action for
|
|
2396
|
+
* middleware-driven access control.
|
|
2397
|
+
*
|
|
2366
2398
|
* @example
|
|
2367
2399
|
* import {
|
|
2368
2400
|
* createTemporaryReferenceSet,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-f1bb8ea3f
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
12
12
|
import * as React from "react";
|
|
13
|
-
import { createMultiMatcher } from "@remix-run/route-pattern/match";
|
|
14
|
-
import { descending } from "@remix-run/route-pattern/specificity";
|
|
15
13
|
import { parse, serialize, splitSetCookieString } from "cookie-es";
|
|
16
14
|
import { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLink, Navigate, Outlet, Outlet as Outlet$1, Route, Router, RouterProvider, Routes, ScrollRestoration, StaticRouter, StaticRouterProvider, UNSAFE_AwaitContextProvider, UNSAFE_WithComponentProps, UNSAFE_WithErrorBoundaryProps, UNSAFE_WithHydrateFallbackProps, unstable_HistoryRouter } from "react-router/internal/react-server-client";
|
|
17
15
|
//#region lib/router/url.ts
|
|
@@ -339,11 +337,11 @@ function convertRouteMatchToUiMatch(match, loaderData) {
|
|
|
339
337
|
};
|
|
340
338
|
}
|
|
341
339
|
function flattenAndRankRoutes(routes) {
|
|
342
|
-
let branches = flattenRoutes
|
|
340
|
+
let branches = flattenRoutes(routes);
|
|
343
341
|
rankRouteBranches(branches);
|
|
344
342
|
return branches;
|
|
345
343
|
}
|
|
346
|
-
function flattenRoutes
|
|
344
|
+
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
|
|
347
345
|
let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
|
|
348
346
|
let meta = {
|
|
349
347
|
relativePath: relativePath === void 0 ? route.path || "" : relativePath,
|
|
@@ -360,7 +358,7 @@ function flattenRoutes$1(routes, branches = [], parentsMeta = [], parentPath = "
|
|
|
360
358
|
let routesMeta = parentsMeta.concat(meta);
|
|
361
359
|
if (route.children && route.children.length > 0) {
|
|
362
360
|
invariant$1(route.index !== true, `Index routes must not have child routes. Please remove all child routes from route path "${path}".`);
|
|
363
|
-
flattenRoutes
|
|
361
|
+
flattenRoutes(route.children, branches, routesMeta, path, hasParentOptionalSegments);
|
|
364
362
|
}
|
|
365
363
|
if (route.path == null && !route.index) return;
|
|
366
364
|
branches.push({
|
|
@@ -551,7 +549,7 @@ function compilePath(path, caseSensitive = false, end = true) {
|
|
|
551
549
|
return "(?:/([^\\/]*))?";
|
|
552
550
|
}
|
|
553
551
|
return "/([^\\/]+)";
|
|
554
|
-
}).replace(/\/([\
|
|
552
|
+
}).replace(/\/((?:[^/?()[\]*^\\]|\\.)+)\?(?=\/|$|\()/g, "(?:/$1)?");
|
|
555
553
|
if (path.endsWith("*")) {
|
|
556
554
|
params.push({ paramName: "*" });
|
|
557
555
|
regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
|
|
@@ -1044,207 +1042,6 @@ function getReadonlyContext(context) {
|
|
|
1044
1042
|
return { get: (ctx) => context.get(ctx) };
|
|
1045
1043
|
}
|
|
1046
1044
|
//#endregion
|
|
1047
|
-
//#region lib/router/matcher-route-pattern.ts
|
|
1048
|
-
var RoutePatternDataRouteMatcher = class {
|
|
1049
|
-
#state;
|
|
1050
|
-
#basename;
|
|
1051
|
-
constructor(basename) {
|
|
1052
|
-
this.#basename = basename;
|
|
1053
|
-
}
|
|
1054
|
-
update(routes) {
|
|
1055
|
-
let branches = flattenRoutes(routes);
|
|
1056
|
-
let matcher = createMultiMatcher({ ignoreCase: true });
|
|
1057
|
-
let partialMatcher = createMultiMatcher({ ignoreCase: true });
|
|
1058
|
-
for (let branch of branches) {
|
|
1059
|
-
let routePattern = convertReactRouterPathToRoutePattern(branch.path);
|
|
1060
|
-
validateRoutePatternSplat(branch.path, routePattern);
|
|
1061
|
-
routePattern = addOptionalTrailingSlash(routePattern);
|
|
1062
|
-
matcher.add(routePattern, branch);
|
|
1063
|
-
if (!branch.routesMeta[branch.routesMeta.length - 1].route.index) partialMatcher.add(routePattern === "/" ? `/*__rr_partial` : `${routePattern}(/*__rr_partial)`, branch);
|
|
1064
|
-
}
|
|
1065
|
-
this.#state = {
|
|
1066
|
-
branches,
|
|
1067
|
-
matcher,
|
|
1068
|
-
partialMatcher
|
|
1069
|
-
};
|
|
1070
|
-
return branches;
|
|
1071
|
-
}
|
|
1072
|
-
match(locationArg, allowPartial = false) {
|
|
1073
|
-
let pathname = stripBasename((typeof locationArg === "string" ? parsePath(locationArg) : locationArg).pathname || "/", this.#basename);
|
|
1074
|
-
if (pathname == null) return null;
|
|
1075
|
-
let decoded = decodePath(pathname);
|
|
1076
|
-
let url = new URL("http://reactrouter.local");
|
|
1077
|
-
url.pathname = pathname;
|
|
1078
|
-
invariant$1(this.#state, "Route pattern routes must be initialized before matching.");
|
|
1079
|
-
let matches = this.#state.matcher.matchAll(url);
|
|
1080
|
-
if (allowPartial) matches.push(...this.#state.partialMatcher.matchAll(url));
|
|
1081
|
-
for (let match of prioritizeValidatedMatches(matches)) {
|
|
1082
|
-
let routeMatches = convertRoutePatternMatchToRouteMatches(match, decoded, allowPartial);
|
|
1083
|
-
if (routeMatches && validateRouteMatchParams(routeMatches)) return routeMatches;
|
|
1084
|
-
}
|
|
1085
|
-
return null;
|
|
1086
|
-
}
|
|
1087
|
-
};
|
|
1088
|
-
function validateRoutePatternSplat(routePath, routePattern) {
|
|
1089
|
-
invariant$1(getRoutePatternSplatIndexes(routePattern).length <= 1 && isTerminalRoutePatternSplat(routePattern), `Route path "${routePath}" is not supported with \`future.unstable_routePatternMatching\` because React Router only supports a single splat at the end of a route path.`);
|
|
1090
|
-
}
|
|
1091
|
-
function getRoutePatternSplatIndexes(routePattern) {
|
|
1092
|
-
let splatIndexes = [];
|
|
1093
|
-
for (let i = 0; i < routePattern.length; i++) {
|
|
1094
|
-
let char = routePattern[i];
|
|
1095
|
-
if (char === "\\") {
|
|
1096
|
-
i++;
|
|
1097
|
-
continue;
|
|
1098
|
-
}
|
|
1099
|
-
if (char === "*") splatIndexes.push(i);
|
|
1100
|
-
}
|
|
1101
|
-
return splatIndexes;
|
|
1102
|
-
}
|
|
1103
|
-
function isTerminalRoutePatternSplat(routePattern) {
|
|
1104
|
-
for (let i = 0; i < routePattern.length; i++) {
|
|
1105
|
-
let char = routePattern[i];
|
|
1106
|
-
if (char === "\\") {
|
|
1107
|
-
i++;
|
|
1108
|
-
continue;
|
|
1109
|
-
}
|
|
1110
|
-
if (char !== "*") continue;
|
|
1111
|
-
let suffix = routePattern.slice(i + 1);
|
|
1112
|
-
return /^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(suffix) || suffix === "";
|
|
1113
|
-
}
|
|
1114
|
-
return true;
|
|
1115
|
-
}
|
|
1116
|
-
function addOptionalTrailingSlash(routePattern) {
|
|
1117
|
-
return routePattern === "/" ? routePattern : `${routePattern.replace(/\/+$/, "")}(/)`;
|
|
1118
|
-
}
|
|
1119
|
-
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "") {
|
|
1120
|
-
routes.forEach((route, index) => {
|
|
1121
|
-
invariant$1(route.caseSensitive !== true, "`caseSensitive` routes are not supported with `future.unstable_routePatternMatching`.");
|
|
1122
|
-
let meta = {
|
|
1123
|
-
relativePath: route.path || "",
|
|
1124
|
-
caseSensitive: false,
|
|
1125
|
-
childrenIndex: index,
|
|
1126
|
-
route
|
|
1127
|
-
};
|
|
1128
|
-
let absolutePath;
|
|
1129
|
-
if (meta.relativePath.startsWith("/")) {
|
|
1130
|
-
absolutePath = meta.relativePath;
|
|
1131
|
-
let parentPathMatch = explodeOptionalSegments(parentPath).find((path) => meta.relativePath.startsWith(path));
|
|
1132
|
-
invariant$1(parentPathMatch != null, `Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`);
|
|
1133
|
-
meta.relativePath = meta.relativePath.slice(parentPathMatch.length);
|
|
1134
|
-
}
|
|
1135
|
-
let routesMeta = parentsMeta.concat(meta);
|
|
1136
|
-
let path = absolutePath ?? (meta.relativePath ? joinPaths([parentPath, meta.relativePath]) : parentPath);
|
|
1137
|
-
if (route.children && route.children.length > 0) {
|
|
1138
|
-
invariant$1(route.index !== true, `Index routes must not have child routes. Please remove all child routes from route path "${path}".`);
|
|
1139
|
-
flattenRoutes(route.children, branches, routesMeta, path);
|
|
1140
|
-
if (route.children?.some((child) => child.index)) return;
|
|
1141
|
-
}
|
|
1142
|
-
if (route.path != null || route.index) branches.push({
|
|
1143
|
-
path,
|
|
1144
|
-
score: 0,
|
|
1145
|
-
routesMeta
|
|
1146
|
-
});
|
|
1147
|
-
});
|
|
1148
|
-
return branches;
|
|
1149
|
-
}
|
|
1150
|
-
function convertReactRouterPathToRoutePattern(path) {
|
|
1151
|
-
warning(path === "*" || !path.endsWith("*") || path.endsWith("/*"), `Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".`);
|
|
1152
|
-
if (path.endsWith("*") && path !== "*" && !path.endsWith("/*")) path = path.replace(/\*$/, "/*");
|
|
1153
|
-
path = path.replace(/^\/*/, "/");
|
|
1154
|
-
if (path === "") return "/";
|
|
1155
|
-
let segments = path.split("/");
|
|
1156
|
-
let pattern = segments.shift() || "";
|
|
1157
|
-
for (let i = 0; i < segments.length;) {
|
|
1158
|
-
let optionalRun = [];
|
|
1159
|
-
while (i < segments.length && isOptionalRouteSegment(segments[i])) {
|
|
1160
|
-
optionalRun.push(convertRouteSegment(segments[i].slice(0, -1)));
|
|
1161
|
-
i++;
|
|
1162
|
-
}
|
|
1163
|
-
if (optionalRun.length > 0) {
|
|
1164
|
-
let nested = optionalRun.reduceRight((child, segment) => `/${segment}${child ? `(${child})` : ""}`, "");
|
|
1165
|
-
pattern += `(${nested})`;
|
|
1166
|
-
continue;
|
|
1167
|
-
}
|
|
1168
|
-
pattern += `/${convertRouteSegment(segments[i])}`;
|
|
1169
|
-
i++;
|
|
1170
|
-
}
|
|
1171
|
-
return pattern || "/";
|
|
1172
|
-
}
|
|
1173
|
-
function isOptionalRouteSegment(segment) {
|
|
1174
|
-
return segment.endsWith("?");
|
|
1175
|
-
}
|
|
1176
|
-
function convertRouteSegment(segment) {
|
|
1177
|
-
if (segment === "*") return "*__rr_splat";
|
|
1178
|
-
let paramMatch = segment.match(/^:([\w-]+)(\?)?(.*)$/);
|
|
1179
|
-
if (paramMatch) {
|
|
1180
|
-
let [, paramName, optional, suffix] = paramMatch;
|
|
1181
|
-
let converted = `:${paramName}${escapeRoutePatternLiteral(suffix)}`;
|
|
1182
|
-
return optional ? `(:${paramName})${escapeRoutePatternLiteral(suffix)}` : converted;
|
|
1183
|
-
}
|
|
1184
|
-
return escapeRoutePatternLiteral(segment);
|
|
1185
|
-
}
|
|
1186
|
-
function escapeRoutePatternLiteral(value) {
|
|
1187
|
-
return value.replace(/[\\():*]/g, "\\$&");
|
|
1188
|
-
}
|
|
1189
|
-
function validateRouteMatchParams(matches) {
|
|
1190
|
-
return matches.every(({ route, params }) => route.unstable_validateParams == null || Object.keys(route.unstable_validateParams).length === 0 || Object.entries(route.unstable_validateParams).every(([param, re]) => params[param] != null ? new RegExp(re.source, re.flags).test(params[param]) : true));
|
|
1191
|
-
}
|
|
1192
|
-
function prioritizeValidatedMatches(matches) {
|
|
1193
|
-
return matches.sort((a, b) => {
|
|
1194
|
-
let specificity = descending(a, b);
|
|
1195
|
-
if (specificity !== 0) return specificity;
|
|
1196
|
-
return Number(hasParamValidators(b)) - Number(hasParamValidators(a));
|
|
1197
|
-
});
|
|
1198
|
-
}
|
|
1199
|
-
function hasParamValidators(match) {
|
|
1200
|
-
return match.data.routesMeta.some((meta) => meta.route.unstable_validateParams != null && Object.keys(meta.route.unstable_validateParams).length > 0);
|
|
1201
|
-
}
|
|
1202
|
-
function convertRoutePatternMatchToRouteMatches(match, pathname, allowPartial) {
|
|
1203
|
-
let result = matchRoutePatternBranch(match.data, pathname, allowPartial, 0, "/", {});
|
|
1204
|
-
if (result == null) return null;
|
|
1205
|
-
for (let routeMatch of result.matches) routeMatch.params = result.params;
|
|
1206
|
-
return result.matches;
|
|
1207
|
-
}
|
|
1208
|
-
function matchRoutePatternBranch(branch, pathname, allowPartial, metaIndex, matchedPathname, matchedParams) {
|
|
1209
|
-
let meta = branch.routesMeta[metaIndex];
|
|
1210
|
-
let end = metaIndex === branch.routesMeta.length - 1;
|
|
1211
|
-
let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
|
|
1212
|
-
for (let relativePath of explodeOptionalSegments(meta.relativePath)) {
|
|
1213
|
-
let pattern = {
|
|
1214
|
-
path: relativePath,
|
|
1215
|
-
caseSensitive: false,
|
|
1216
|
-
end
|
|
1217
|
-
};
|
|
1218
|
-
let pathMatch = matchPath(pattern, remainingPathname);
|
|
1219
|
-
if (!pathMatch && end && allowPartial && !meta.route.index) pathMatch = matchPath({
|
|
1220
|
-
...pattern,
|
|
1221
|
-
end: false
|
|
1222
|
-
}, remainingPathname);
|
|
1223
|
-
if (!pathMatch) continue;
|
|
1224
|
-
let params = {
|
|
1225
|
-
...matchedParams,
|
|
1226
|
-
...pathMatch.params
|
|
1227
|
-
};
|
|
1228
|
-
let routeMatch = {
|
|
1229
|
-
params,
|
|
1230
|
-
pathname: joinPaths([matchedPathname, pathMatch.pathname]),
|
|
1231
|
-
pathnameBase: normalizePathname(joinPaths([matchedPathname, pathMatch.pathnameBase])),
|
|
1232
|
-
route: meta.route
|
|
1233
|
-
};
|
|
1234
|
-
let nextMatchedPathname = pathMatch.pathnameBase === "/" ? matchedPathname : joinPaths([matchedPathname, pathMatch.pathnameBase]);
|
|
1235
|
-
if (end) return {
|
|
1236
|
-
matches: [routeMatch],
|
|
1237
|
-
params
|
|
1238
|
-
};
|
|
1239
|
-
let childResult = matchRoutePatternBranch(branch, pathname, allowPartial, metaIndex + 1, nextMatchedPathname, params);
|
|
1240
|
-
if (childResult) return {
|
|
1241
|
-
matches: [routeMatch, ...childResult.matches],
|
|
1242
|
-
params: childResult.params
|
|
1243
|
-
};
|
|
1244
|
-
}
|
|
1245
|
-
return null;
|
|
1246
|
-
}
|
|
1247
|
-
//#endregion
|
|
1248
1045
|
//#region lib/router/matcher.ts
|
|
1249
1046
|
var V6RegExMatcher = class {
|
|
1250
1047
|
#routes = [];
|
|
@@ -1281,7 +1078,12 @@ const redirectStatusCodes = new Set([
|
|
|
1281
1078
|
]);
|
|
1282
1079
|
const ResetLoaderDataSymbol = Symbol("ResetLoaderData");
|
|
1283
1080
|
function createDataRouteMatcher(future, basename) {
|
|
1284
|
-
|
|
1081
|
+
if (future.unstable_routePatternMatching) {
|
|
1082
|
+
let RoutePatternMatcher = void 0;
|
|
1083
|
+
invariant$1(RoutePatternMatcher, "You must call unstable_preloadRoutePattern() from \"react-router/route-pattern\" before enabling future.unstable_routePatternMatching.");
|
|
1084
|
+
return new RoutePatternMatcher(basename);
|
|
1085
|
+
}
|
|
1086
|
+
return new V6RegExMatcher(basename);
|
|
1285
1087
|
}
|
|
1286
1088
|
/**
|
|
1287
1089
|
* Create a static handler to perform server-side data loading
|
|
@@ -1657,7 +1459,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1657
1459
|
};
|
|
1658
1460
|
}
|
|
1659
1461
|
async function callDataStrategy(request, location, matches, isRouteRequest, requestContext, dataStrategy) {
|
|
1660
|
-
let results = await callDataStrategyImpl(dataStrategy || defaultDataStrategy, request, location, matches, null, requestContext, true);
|
|
1462
|
+
let results = await callDataStrategyImpl(dataStrategy || defaultDataStrategy, request, location, matches, null, "static", requestContext, true);
|
|
1661
1463
|
let dataResults = {};
|
|
1662
1464
|
await Promise.all(matches.map(async (match) => {
|
|
1663
1465
|
if (!(match.route.id in results)) return;
|
|
@@ -2020,7 +1822,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, p
|
|
|
2020
1822
|
return getDataStrategyMatch(mapRouteProperties, manifest, request, path, getRoutePattern(matches), match, lazyRoutePropertiesToSkip, scopedContext, true, shouldRevalidateArgs);
|
|
2021
1823
|
});
|
|
2022
1824
|
}
|
|
2023
|
-
async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fetcherKey, scopedContext, isStaticHandler) {
|
|
1825
|
+
async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fetcherKey, initiator, scopedContext, isStaticHandler, navigationType = null) {
|
|
2024
1826
|
if (matches.some((m) => m._lazyPromises?.middleware)) await Promise.all(matches.map((m) => m._lazyPromises?.middleware));
|
|
2025
1827
|
let dataStrategyArgs = {
|
|
2026
1828
|
request,
|
|
@@ -2028,7 +1830,9 @@ async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fe
|
|
|
2028
1830
|
pattern: getRoutePattern(matches),
|
|
2029
1831
|
params: matches[0].params,
|
|
2030
1832
|
context: scopedContext,
|
|
2031
|
-
matches
|
|
1833
|
+
matches,
|
|
1834
|
+
unstable_initiator: initiator,
|
|
1835
|
+
unstable_navigationType: initiator === "navigation" ? navigationType : null
|
|
2032
1836
|
};
|
|
2033
1837
|
let runClientMiddleware = isStaticHandler ? () => {
|
|
2034
1838
|
throw new Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`");
|
|
@@ -2547,18 +2351,12 @@ const Await = (async ({ children, resolve, errorElement }) => {
|
|
|
2547
2351
|
if (resolved.status === "rejected" && !errorElement) throw resolved.reason;
|
|
2548
2352
|
if (resolved.status === "rejected") return React.createElement(UNSAFE_AwaitContextProvider, {
|
|
2549
2353
|
children: React.createElement(React.Fragment, null, errorElement),
|
|
2550
|
-
value:
|
|
2551
|
-
_tracked: true,
|
|
2552
|
-
_error: resolved.reason
|
|
2553
|
-
}
|
|
2354
|
+
value: resolved
|
|
2554
2355
|
});
|
|
2555
2356
|
const toRender = typeof children === "function" ? children(resolved.value) : children;
|
|
2556
2357
|
return React.createElement(UNSAFE_AwaitContextProvider, {
|
|
2557
2358
|
children: toRender,
|
|
2558
|
-
value:
|
|
2559
|
-
_tracked: true,
|
|
2560
|
-
_data: resolved.value
|
|
2561
|
-
}
|
|
2359
|
+
value: resolved
|
|
2562
2360
|
});
|
|
2563
2361
|
});
|
|
2564
2362
|
/**
|
|
@@ -2568,6 +2366,13 @@ const Await = (async ({ children, resolve, errorElement }) => {
|
|
|
2568
2366
|
* encoding an {@link unstable_RSCPayload} for consumption by an [RSC](https://react.dev/reference/rsc/server-components)
|
|
2569
2367
|
* enabled client router.
|
|
2570
2368
|
*
|
|
2369
|
+
* Treat every React Server Function as a public endpoint. Server Functions are
|
|
2370
|
+
* not inherently associated with a route. Any route middleware that runs is
|
|
2371
|
+
* selected from the URL used to call a Server Function, but the client controls
|
|
2372
|
+
* both the Server Function identifier and the URL. Perform all access control
|
|
2373
|
+
* checks within each Server Function, or use a route action for
|
|
2374
|
+
* middleware-driven access control.
|
|
2375
|
+
*
|
|
2571
2376
|
* @example
|
|
2572
2377
|
* import {
|
|
2573
2378
|
* createTemporaryReferenceSet,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { Action, InitialEntry, Location, Path, To, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, invariant, parsePath } from "./lib/router/history.js";
|
|
3
|
-
import { ActionFunction, ActionFunctionArgs, BaseRouteObject, DataRouteMatch, DataRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, DataWithResponseInit, ErrorResponse, ErrorResponseImpl, FormEncType, FormMethod, HTMLFormMethod, IndexRouteObject, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, MiddlewareFunction, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, PathMatch, PathParam, PathPattern, RedirectFunction, RouteMatch, RouteObject, RouterContext, RouterContextProvider, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, UIMatch, createContext, data, defaultMapRouteProperties, generatePath, isRouteErrorResponse, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath } from "./lib/router/utils.js";
|
|
3
|
+
import { ActionFunction, ActionFunctionArgs, BaseRouteObject, DataRouteMatch, DataRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyInitiator, DataStrategyMatch, DataStrategyResult, DataWithResponseInit, ErrorResponse, ErrorResponseImpl, FormEncType, FormMethod, HTMLFormMethod, IndexRouteObject, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, MiddlewareFunction, NonIndexRouteObject, ParamParseKey, Params, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, PathMatch, PathParam, PathPattern, RedirectFunction, RouteMatch, RouteObject, RouterContext, RouterContextProvider, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, UIMatch, createContext, data, defaultMapRouteProperties, generatePath, isRouteErrorResponse, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath } from "./lib/router/utils.js";
|
|
4
4
|
import { Blocker, BlockerFunction, Fetcher, GetScrollPositionFunction, GetScrollRestorationKeyFunction, HydrationState, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, Navigation, NavigationStates, RelativeRoutingType, RevalidationState, Router, RouterFetchOptions, RouterInit, RouterNavigateOptions, RouterState, RouterSubscriber, StaticHandler, StaticHandlerContext, createRouter, createStaticHandler } from "./lib/router/router.js";
|
|
5
5
|
import { HtmlLinkDescriptor, LinkDescriptor, PageLinkDescriptor } from "./lib/router/links.js";
|
|
6
6
|
import { Await, AwaitProps, ClientOnErrorFunction, IndexRouteProps, LayoutRouteProps, MemoryRouter, MemoryRouterOpts, MemoryRouterProps, Navigate, NavigateProps, Outlet, OutletProps, PathRouteProps, Route, RouteProps, Router as Router$1, RouterProps, RouterProvider, RouterProviderProps, Routes, RoutesProps, WithComponentProps, WithErrorBoundaryProps, WithHydrateFallbackProps, createMemoryRouter, createRoutesFromChildren, createRoutesFromElements, hydrationRouteProperties, renderMatches, withComponentProps, withErrorBoundaryProps, withHydrateFallbackProps } from "./lib/components.js";
|
|
@@ -25,10 +25,11 @@ import { DecodeActionFunction, DecodeFormStateFunction, DecodeReplyFunction, Loa
|
|
|
25
25
|
import { BrowserCreateFromReadableStreamFunction, EncodeReplyFunction, RSCHydratedRouterProps } from "./lib/rsc/browser.js";
|
|
26
26
|
import { RSCStaticRouter, RSCStaticRouterProps, SSRCreateFromReadableStreamFunction, routeRSCServerRequest } from "./lib/rsc/server.ssr.js";
|
|
27
27
|
import { RSCDefaultRootErrorBoundary } from "./lib/rsc/errorBoundaries.js";
|
|
28
|
+
import { primeHydrationPromises } from "./lib/await.js";
|
|
28
29
|
import { RemixErrorBoundary } from "./lib/dom/ssr/errorBoundaries.js";
|
|
30
|
+
import { SingleFetchRedirectSymbol, decodeViaTurboStream, getTurboStreamSingleFetchDataStrategy } from "./lib/dom/ssr/single-fetch.js";
|
|
29
31
|
import { getPatchRoutesOnNavigationFunction, useFogOFWarDiscovery } from "./lib/dom/ssr/fog-of-war.js";
|
|
30
32
|
import { getHydrationData } from "./lib/dom/ssr/hydration.js";
|
|
31
|
-
import { SingleFetchRedirectSymbol, decodeViaTurboStream, getTurboStreamSingleFetchDataStrategy } from "./lib/dom/ssr/single-fetch.js";
|
|
32
33
|
import { ServerMode } from "./lib/server-runtime/mode.js";
|
|
33
34
|
import { ClientActionFunction, ClientActionFunctionArgs, ClientLoaderFunction, ClientLoaderFunctionArgs, HeadersArgs, HeadersFunction, LinksFunction, MetaArgs, MetaDescriptor, MetaFunction, RouteModules } from "./lib/dom/ssr/routeModules.js";
|
|
34
35
|
import { createClientRoutes, createClientRoutesWithHMRRevalidationOptOut, shouldHydrateRouteLoader } from "./lib/dom/ssr/routes.js";
|
|
@@ -41,4 +42,4 @@ import { ClientInstrumentation, InstrumentRequestHandlerFunction, InstrumentRout
|
|
|
41
42
|
declare const unstable_getRequest: typeof getRequest;
|
|
42
43
|
declare const unstable_matchRSCServerRequest: typeof matchRSCServerRequest;
|
|
43
44
|
//#endregion
|
|
44
|
-
export { type ActionFunction, type ActionFunctionArgs, Await, type AwaitProps, type BaseRouteObject, type Blocker, type BlockerFunction, BrowserRouter, type BrowserRouterProps, type ClientActionFunction, type ClientActionFunctionArgs, type ClientInstrumentation, type ClientLoaderFunction, type ClientLoaderFunctionArgs, type ClientOnErrorFunction, type Cookie, type CookieOptions, type CookieParseOptions, type CookieSerializeOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, type DOMRouterOpts, type DataRouteMatch, type DataRouteObject, type Router as DataRouter, type DataStrategyFunction, type DataStrategyFunctionArgs, type DataStrategyMatch, type DataStrategyResult, type DiscoverBehavior, type EntryContext, type ErrorResponse, type Fetcher, type FetcherFormProps, type FetcherSubmitFunction, type FetcherSubmitOptions, type FetcherWithComponents, type FlashSessionData, Form, type FormEncType, type FormMethod, type FormProps, type Future, type GetScrollPositionFunction, type GetScrollRestorationKeyFunction, type HTMLFormMethod, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HashRouter, type HashRouterProps, type HeadersArgs, type HeadersFunction, type HistoryRouterProps, type HtmlLinkDescriptor, type HydrationState, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, type IndexRouteObject, type IndexRouteProps, type InitialEntry, type InstrumentRequestHandlerFunction, type InstrumentRouteFunction, type InstrumentRouterFunction, type InstrumentationClientRouterResult, type InstrumentationHandlerResult, type InstrumentationServerHandlerResult, type IsCookieFunction, type IsSessionFunction, type LayoutRouteProps, type LazyRouteFunction, Link, type LinkDescriptor, type LinkProps, Links, type LinksFunction, type LinksProps, type LoaderFunction, type LoaderFunctionArgs, type Location, MemoryRouter, type MemoryRouterOpts, type MemoryRouterProps, Meta, type MetaArgs, type MetaDescriptor, type MetaFunction, type MiddlewareFunction, NavLink, type NavLinkProps, type NavLinkRenderProps, Navigate, type NavigateFunction, type NavigateOptions, type NavigateProps, type Navigation, type NavigationStates, Action as NavigationType, type Navigator, type NonIndexRouteObject, Outlet, type OutletProps, type PageLinkDescriptor, type ParamKeyValuePair, type ParamParseKey, type Params, type PatchRoutesOnNavigationFunction, type PatchRoutesOnNavigationFunctionArgs, type Path, type PathMatch, type PathParam, type PathPattern, type PathRouteProps, type PrefetchBehavior, PrefetchPageLinks, type RedirectFunction, type Register, type RelativeRoutingType, type RequestHandler, type RevalidationState, Route, type RouteMatch, type RouteObject, type RouteProps, Router$1 as Router, type RouterContext, RouterContextProvider, type RouterFetchOptions, type RouterInit, type RouterNavigateOptions, type RouterProps, RouterProvider, type RouterProviderProps, type RouterState, type RouterSubscriber, Routes, type RoutesProps, type RoutesTestStubProps, Scripts, type ScriptsProps, ScrollRestoration, type ScrollRestorationProps, type ServerBuild, type ServerEntryModule, type ServerInstrumentation, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, type SetURLSearchParams, type ShouldRevalidateFunction, type ShouldRevalidateFunctionArgs, type StaticHandler, type StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, type SubmitFunction, type SubmitOptions, type SubmitTarget, type To, type UIMatch, type AssetsManifest as UNSAFE_AssetsManifest, AwaitContextProvider as UNSAFE_AwaitContextProvider, DataRouterContext as UNSAFE_DataRouterContext, DataRouterDataContext as UNSAFE_DataRouterDataContext, DataRouterNavigationContext as UNSAFE_DataRouterNavigationContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, type DataWithResponseInit as UNSAFE_DataWithResponseInit, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, FetchersContext as UNSAFE_FetchersContext, FrameworkContext as UNSAFE_FrameworkContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteContext as UNSAFE_RouteContext, type RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, ViewTransitionContext as UNSAFE_ViewTransitionContext, WithComponentProps as UNSAFE_WithComponentProps, WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps, WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps, createBrowserHistory as UNSAFE_createBrowserHistory, createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, createHashHistory as UNSAFE_createHashHistory, createMemoryHistory as UNSAFE_createMemoryHistory, createRouter as UNSAFE_createRouter, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, defaultMapRouteProperties as UNSAFE_defaultMapRouteProperties, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, hydrationRouteProperties as UNSAFE_hydrationRouteProperties, invariant as UNSAFE_invariant, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, useScrollRestoration as UNSAFE_useScrollRestoration, withComponentProps as UNSAFE_withComponentProps, withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps, withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps, type URLSearchParamsInit, createBrowserRouter, createContext, createCookie, createCookieSessionStorage, createHashRouter, createMemoryRouter, createMemorySessionStorage, createPath, createRequestHandler, createRoutesFromChildren, createRoutesFromElements, createRoutesStub, createSearchParams, createSession, createSessionStorage, createStaticHandler, createStaticRouter, data, generatePath, href, isCookie, isRouteErrorResponse, isSession, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, replace, resolvePath, type BrowserCreateFromReadableStreamFunction as unstable_BrowserCreateFromReadableStreamFunction, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, type EncodeReplyFunction as unstable_EncodeReplyFunction, HistoryRouter as unstable_HistoryRouter, type LoadServerActionFunction as unstable_LoadServerActionFunction, type RSCHydratedRouterProps as unstable_RSCHydratedRouterProps, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCMatch as unstable_RSCMatch, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RSCRouteConfig as unstable_RSCRouteConfig, type RSCRouteConfigEntry as unstable_RSCRouteConfigEntry, type RSCRouteManifest as unstable_RSCRouteManifest, type RSCRouteMatch as unstable_RSCRouteMatch, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, type unstable_SerializesTo, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, usePrompt as unstable_usePrompt, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useBlocker, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, useSearchParams, useSubmit, useViewTransitionState };
|
|
45
|
+
export { type ActionFunction, type ActionFunctionArgs, Await, type AwaitProps, type BaseRouteObject, type Blocker, type BlockerFunction, BrowserRouter, type BrowserRouterProps, type ClientActionFunction, type ClientActionFunctionArgs, type ClientInstrumentation, type ClientLoaderFunction, type ClientLoaderFunctionArgs, type ClientOnErrorFunction, type Cookie, type CookieOptions, type CookieParseOptions, type CookieSerializeOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, type DOMRouterOpts, type DataRouteMatch, type DataRouteObject, type Router as DataRouter, type DataStrategyFunction, type DataStrategyFunctionArgs, type DataStrategyMatch, type DataStrategyResult, type DiscoverBehavior, type EntryContext, type ErrorResponse, type Fetcher, type FetcherFormProps, type FetcherSubmitFunction, type FetcherSubmitOptions, type FetcherWithComponents, type FlashSessionData, Form, type FormEncType, type FormMethod, type FormProps, type Future, type GetScrollPositionFunction, type GetScrollRestorationKeyFunction, type HTMLFormMethod, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HashRouter, type HashRouterProps, type HeadersArgs, type HeadersFunction, type HistoryRouterProps, type HtmlLinkDescriptor, type HydrationState, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, type IndexRouteObject, type IndexRouteProps, type InitialEntry, type InstrumentRequestHandlerFunction, type InstrumentRouteFunction, type InstrumentRouterFunction, type InstrumentationClientRouterResult, type InstrumentationHandlerResult, type InstrumentationServerHandlerResult, type IsCookieFunction, type IsSessionFunction, type LayoutRouteProps, type LazyRouteFunction, Link, type LinkDescriptor, type LinkProps, Links, type LinksFunction, type LinksProps, type LoaderFunction, type LoaderFunctionArgs, type Location, MemoryRouter, type MemoryRouterOpts, type MemoryRouterProps, Meta, type MetaArgs, type MetaDescriptor, type MetaFunction, type MiddlewareFunction, NavLink, type NavLinkProps, type NavLinkRenderProps, Navigate, type NavigateFunction, type NavigateOptions, type NavigateProps, type Navigation, type NavigationStates, Action as NavigationType, type Navigator, type NonIndexRouteObject, Outlet, type OutletProps, type PageLinkDescriptor, type ParamKeyValuePair, type ParamParseKey, type Params, type PatchRoutesOnNavigationFunction, type PatchRoutesOnNavigationFunctionArgs, type Path, type PathMatch, type PathParam, type PathPattern, type PathRouteProps, type PrefetchBehavior, PrefetchPageLinks, type RedirectFunction, type Register, type RelativeRoutingType, type RequestHandler, type RevalidationState, Route, type RouteMatch, type RouteObject, type RouteProps, Router$1 as Router, type RouterContext, RouterContextProvider, type RouterFetchOptions, type RouterInit, type RouterNavigateOptions, type RouterProps, RouterProvider, type RouterProviderProps, type RouterState, type RouterSubscriber, Routes, type RoutesProps, type RoutesTestStubProps, Scripts, type ScriptsProps, ScrollRestoration, type ScrollRestorationProps, type ServerBuild, type ServerEntryModule, type ServerInstrumentation, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, type SetURLSearchParams, type ShouldRevalidateFunction, type ShouldRevalidateFunctionArgs, type StaticHandler, type StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, type SubmitFunction, type SubmitOptions, type SubmitTarget, type To, type UIMatch, type AssetsManifest as UNSAFE_AssetsManifest, AwaitContextProvider as UNSAFE_AwaitContextProvider, DataRouterContext as UNSAFE_DataRouterContext, DataRouterDataContext as UNSAFE_DataRouterDataContext, DataRouterNavigationContext as UNSAFE_DataRouterNavigationContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, type DataWithResponseInit as UNSAFE_DataWithResponseInit, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, FetchersContext as UNSAFE_FetchersContext, FrameworkContext as UNSAFE_FrameworkContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteContext as UNSAFE_RouteContext, type RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, ViewTransitionContext as UNSAFE_ViewTransitionContext, WithComponentProps as UNSAFE_WithComponentProps, WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps, WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps, createBrowserHistory as UNSAFE_createBrowserHistory, createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, createHashHistory as UNSAFE_createHashHistory, createMemoryHistory as UNSAFE_createMemoryHistory, createRouter as UNSAFE_createRouter, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, defaultMapRouteProperties as UNSAFE_defaultMapRouteProperties, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, hydrationRouteProperties as UNSAFE_hydrationRouteProperties, invariant as UNSAFE_invariant, primeHydrationPromises as UNSAFE_primeHydrationPromises, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, useScrollRestoration as UNSAFE_useScrollRestoration, withComponentProps as UNSAFE_withComponentProps, withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps, withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps, type URLSearchParamsInit, createBrowserRouter, createContext, createCookie, createCookieSessionStorage, createHashRouter, createMemoryRouter, createMemorySessionStorage, createPath, createRequestHandler, createRoutesFromChildren, createRoutesFromElements, createRoutesStub, createSearchParams, createSession, createSessionStorage, createStaticHandler, createStaticRouter, data, generatePath, href, isCookie, isRouteErrorResponse, isSession, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, replace, resolvePath, type BrowserCreateFromReadableStreamFunction as unstable_BrowserCreateFromReadableStreamFunction, type DataStrategyInitiator as unstable_DataStrategyInitiator, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, type EncodeReplyFunction as unstable_EncodeReplyFunction, HistoryRouter as unstable_HistoryRouter, type LoadServerActionFunction as unstable_LoadServerActionFunction, type RSCHydratedRouterProps as unstable_RSCHydratedRouterProps, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCMatch as unstable_RSCMatch, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RSCRouteConfig as unstable_RSCRouteConfig, type RSCRouteConfigEntry as unstable_RSCRouteConfigEntry, type RSCRouteManifest as unstable_RSCRouteManifest, type RSCRouteMatch as unstable_RSCRouteMatch, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, type unstable_SerializesTo, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, usePrompt as unstable_usePrompt, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useBlocker, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, useSearchParams, useSubmit, useViewTransitionState };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-f1bb8ea3f
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -13,6 +13,7 @@ import { Action, createBrowserHistory, createHashHistory, createMemoryHistory, c
|
|
|
13
13
|
import { ErrorResponseImpl, RouterContextProvider, createContext, data, defaultMapRouteProperties, generatePath, isRouteErrorResponse, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath } from "./lib/router/utils.js";
|
|
14
14
|
import { IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, createRouter, createStaticHandler } from "./lib/router/router.js";
|
|
15
15
|
import { AwaitContextProvider, DataRouterContext, DataRouterDataContext, DataRouterNavigationContext, DataRouterStateContext, FetchersContext, LocationContext, NavigationContext, RouteContext, ViewTransitionContext } from "./lib/context.js";
|
|
16
|
+
import { primeHydrationPromises } from "./lib/await.js";
|
|
16
17
|
import { useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRoute, useRouteError, useRouteLoaderData, useRouterState, useRoutes } from "./lib/hooks.js";
|
|
17
18
|
import { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, WithComponentProps, WithErrorBoundaryProps, WithHydrateFallbackProps, createMemoryRouter, createRoutesFromChildren, createRoutesFromElements, hydrationRouteProperties, renderMatches, withComponentProps, withErrorBoundaryProps, withHydrateFallbackProps } from "./lib/components.js";
|
|
18
19
|
import { createSearchParams } from "./lib/dom/dom.js";
|
|
@@ -42,4 +43,4 @@ import { getHydrationData } from "./lib/dom/ssr/hydration.js";
|
|
|
42
43
|
* @mergeModuleWith react-router
|
|
43
44
|
*/
|
|
44
45
|
//#endregion
|
|
45
|
-
export { Await, BrowserRouter, Form, HashRouter, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, Link, Links, MemoryRouter, Meta, NavLink, Navigate, Action as NavigationType, Outlet, PrefetchPageLinks, Route, Router, RouterContextProvider, RouterProvider, Routes, Scripts, ScrollRestoration, ServerRouter, StaticRouter, StaticRouterProvider, AwaitContextProvider as UNSAFE_AwaitContextProvider, DataRouterContext as UNSAFE_DataRouterContext, DataRouterDataContext as UNSAFE_DataRouterDataContext, DataRouterNavigationContext as UNSAFE_DataRouterNavigationContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, FetchersContext as UNSAFE_FetchersContext, FrameworkContext as UNSAFE_FrameworkContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteContext as UNSAFE_RouteContext, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, ViewTransitionContext as UNSAFE_ViewTransitionContext, WithComponentProps as UNSAFE_WithComponentProps, WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps, WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps, createBrowserHistory as UNSAFE_createBrowserHistory, createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, createHashHistory as UNSAFE_createHashHistory, createMemoryHistory as UNSAFE_createMemoryHistory, createRouter as UNSAFE_createRouter, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, defaultMapRouteProperties as UNSAFE_defaultMapRouteProperties, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, hydrationRouteProperties as UNSAFE_hydrationRouteProperties, invariant as UNSAFE_invariant, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, useScrollRestoration as UNSAFE_useScrollRestoration, withComponentProps as UNSAFE_withComponentProps, withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps, withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps, createBrowserRouter, createContext, createCookie, createCookieSessionStorage, createHashRouter, createMemoryRouter, createMemorySessionStorage, createPath, createRequestHandler, createRoutesFromChildren, createRoutesFromElements, createRoutesStub, createSearchParams, createSession, createSessionStorage, createStaticHandler, createStaticRouter, data, generatePath, href, isCookie, isRouteErrorResponse, isSession, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, replace, resolvePath, HistoryRouter as unstable_HistoryRouter, RSCStaticRouter as unstable_RSCStaticRouter, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, usePrompt as unstable_usePrompt, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useBlocker, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, useSearchParams, useSubmit, useViewTransitionState };
|
|
46
|
+
export { Await, BrowserRouter, Form, HashRouter, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, Link, Links, MemoryRouter, Meta, NavLink, Navigate, Action as NavigationType, Outlet, PrefetchPageLinks, Route, Router, RouterContextProvider, RouterProvider, Routes, Scripts, ScrollRestoration, ServerRouter, StaticRouter, StaticRouterProvider, AwaitContextProvider as UNSAFE_AwaitContextProvider, DataRouterContext as UNSAFE_DataRouterContext, DataRouterDataContext as UNSAFE_DataRouterDataContext, DataRouterNavigationContext as UNSAFE_DataRouterNavigationContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, FetchersContext as UNSAFE_FetchersContext, FrameworkContext as UNSAFE_FrameworkContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteContext as UNSAFE_RouteContext, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, ViewTransitionContext as UNSAFE_ViewTransitionContext, WithComponentProps as UNSAFE_WithComponentProps, WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps, WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps, createBrowserHistory as UNSAFE_createBrowserHistory, createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, createHashHistory as UNSAFE_createHashHistory, createMemoryHistory as UNSAFE_createMemoryHistory, createRouter as UNSAFE_createRouter, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, defaultMapRouteProperties as UNSAFE_defaultMapRouteProperties, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, hydrationRouteProperties as UNSAFE_hydrationRouteProperties, invariant as UNSAFE_invariant, primeHydrationPromises as UNSAFE_primeHydrationPromises, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, useScrollRestoration as UNSAFE_useScrollRestoration, withComponentProps as UNSAFE_withComponentProps, withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps, withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps, createBrowserRouter, createContext, createCookie, createCookieSessionStorage, createHashRouter, createMemoryRouter, createMemorySessionStorage, createPath, createRequestHandler, createRoutesFromChildren, createRoutesFromElements, createRoutesStub, createSearchParams, createSession, createSessionStorage, createStaticHandler, createStaticRouter, data, generatePath, href, isCookie, isRouteErrorResponse, isSession, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, replace, resolvePath, HistoryRouter as unstable_HistoryRouter, RSCStaticRouter as unstable_RSCStaticRouter, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, usePrompt as unstable_usePrompt, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useBlocker, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, useSearchParams, useSubmit, useViewTransitionState };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-router v0.0.0-experimental-f1bb8ea3f
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Remix Software Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
//#region lib/await.ts
|
|
12
|
+
let awaitPromises = /* @__PURE__ */ new WeakMap();
|
|
13
|
+
function getAwaitPromise(resolve, onError) {
|
|
14
|
+
let cached = awaitPromises.get(resolve);
|
|
15
|
+
if (!cached) {
|
|
16
|
+
let wrappedPromise = resolve.then((value) => settle({
|
|
17
|
+
status: "fulfilled",
|
|
18
|
+
value
|
|
19
|
+
}), (reason) => {
|
|
20
|
+
cached.onError?.(reason);
|
|
21
|
+
return settle({
|
|
22
|
+
status: "rejected",
|
|
23
|
+
reason
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
function settle(result) {
|
|
27
|
+
Object.assign(wrappedPromise, {
|
|
28
|
+
value: result,
|
|
29
|
+
status: "fulfilled"
|
|
30
|
+
});
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
cached = {
|
|
34
|
+
promise: wrappedPromise,
|
|
35
|
+
onError
|
|
36
|
+
};
|
|
37
|
+
awaitPromises.set(resolve, cached);
|
|
38
|
+
} else if (onError && !cached.onError) {
|
|
39
|
+
cached.onError = onError;
|
|
40
|
+
if (cached.promise.status === "fulfilled" && cached.promise.value?.status === "rejected") resolve.catch(onError);
|
|
41
|
+
}
|
|
42
|
+
return cached.promise;
|
|
43
|
+
}
|
|
44
|
+
function primeHydrationPromises(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
45
|
+
if (value == null || typeof value !== "object" && typeof value !== "function" || seen.has(value)) return;
|
|
46
|
+
seen.add(value);
|
|
47
|
+
if (value instanceof Promise) {
|
|
48
|
+
getAwaitPromise(value);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (value instanceof Map || value instanceof Set) {
|
|
52
|
+
for (let child of value.values()) primeHydrationPromises(child, seen);
|
|
53
|
+
if (value instanceof Map) for (let key of value.keys()) primeHydrationPromises(key, seen);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
for (let child of Object.values(value)) primeHydrationPromises(child, seen);
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { getAwaitPromise, primeHydrationPromises };
|