react-router 7.0.0-pre.0 → 7.0.0-pre.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -2
- package/dist/dom-export.mjs +11 -3
- package/dist/dom-export.mjs.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.mjs +1504 -356
- package/dist/index.mjs.map +1 -1
- package/dist/lib/components.d.ts +6 -6
- package/dist/lib/dom/global.d.ts +1 -1
- package/dist/lib/dom/lib.d.ts +3 -2
- package/dist/lib/dom/ssr/components.d.ts +0 -1
- package/dist/lib/dom/ssr/data.d.ts +0 -5
- package/dist/lib/dom/ssr/entry.d.ts +2 -1
- package/dist/lib/dom/ssr/routeModules.d.ts +64 -22
- package/dist/lib/dom/ssr/routes.d.ts +2 -5
- package/dist/lib/hooks.d.ts +4 -3
- package/dist/lib/router/router.d.ts +4 -0
- package/dist/lib/router/utils.d.ts +1 -9
- package/dist/lib/server-runtime/build.d.ts +1 -1
- package/dist/lib/server-runtime/cookies.d.ts +5 -5
- package/dist/lib/server-runtime/data.d.ts +1 -5
- package/dist/lib/server-runtime/routeModules.d.ts +3 -175
- package/dist/lib/server-runtime/routes.d.ts +2 -22
- package/dist/lib/server-runtime/sessions.d.ts +4 -4
- package/dist/lib/types.d.ts +21 -9
- package/dist/lib/types.mjs +1 -1
- package/dist/main-dom-export.js +1 -1
- package/dist/main.js +1 -1
- package/dist/react-router-dom.development.js +3 -3
- package/dist/react-router-dom.development.js.map +1 -1
- package/dist/react-router-dom.production.min.js +2 -2
- package/dist/react-router-dom.production.min.js.map +1 -1
- package/dist/react-router.development.js +318 -295
- package/dist/react-router.development.js.map +1 -1
- package/dist/react-router.production.min.js +2 -2
- package/dist/react-router.production.min.js.map +1 -1
- package/dist/umd/react-router-dom.development.js +3 -3
- package/dist/umd/react-router-dom.development.js.map +1 -1
- package/dist/umd/react-router-dom.production.min.js +2 -2
- package/dist/umd/react-router-dom.production.min.js.map +1 -1
- package/dist/umd/react-router.development.js +327 -317
- package/dist/umd/react-router.development.js.map +1 -1
- package/dist/umd/react-router.production.min.js +2 -2
- package/dist/umd/react-router.production.min.js.map +1 -1
- package/package.json +4 -4
- package/dist/lib/server-runtime/jsonify.d.ts +0 -33
- package/dist/lib/server-runtime/responses.d.ts +0 -37
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## 7.0.0-pre.2
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Migrate Remix type generics to React Router ([#12180](https://github.com/remix-run/react-router/pull/12180))
|
|
8
|
+
|
|
9
|
+
- These generics are provided for Remix v2 migration purposes
|
|
10
|
+
- These generics and the APIs they exist on should be considered informally deprecated in favor of the new `Route.*` types
|
|
11
|
+
- Anyone migrating from React Router v6 should probably not leverage these new generics and should migrate straight to the `Route.*` types
|
|
12
|
+
- For React Router v6 users, these generics are new and should not impact your app, with one exception
|
|
13
|
+
- `useFetcher` previously had an optional generic (used primarily by Remix v2) that expected the data type
|
|
14
|
+
- This has been updated in v7 to expect the type of the function that generates the data (i.e., `typeof loader`/`typeof action`)
|
|
15
|
+
- Therefore, you should update your usages:
|
|
16
|
+
- ❌ `useFetcher<LoaderData>()`
|
|
17
|
+
- ✅ `useFetcher<typeof loader>()`
|
|
18
|
+
|
|
19
|
+
- - Consolidate types previously duplicated across `@remix-run/router`, `@remix-run/server-runtime`, and `@remix-run/react` now that they all live in `react-router` ([#12177](https://github.com/remix-run/react-router/pull/12177))
|
|
20
|
+
- Examples: `LoaderFunction`, `LoaderFunctionArgs`, `ActionFunction`, `ActionFunctionArgs`, `DataFunctionArgs`, `RouteManifest`, `LinksFunction`, `Route`, `EntryRoute`
|
|
21
|
+
- The `RouteManifest` type used by the "remix" code is now slightly stricter because it is using the former `@remix-run/router` `RouteManifest`
|
|
22
|
+
- `Record<string, Route> -> Record<string, Route | undefined>`
|
|
23
|
+
- Removed `AppData` type in favor of inlining `unknown` in the few locations it was used
|
|
24
|
+
- Removed `ServerRuntimeMeta*` types in favor of the `Meta*` types they were duplicated from
|
|
25
|
+
- Drop support for Node 18, update minimum Node vestion to 20 ([#12171](https://github.com/remix-run/react-router/pull/12171))
|
|
26
|
+
|
|
27
|
+
- Remove `installGlobals()` as this should no longer be necessary
|
|
28
|
+
|
|
29
|
+
- Update `cookie` dependency to `^1.0.1` - please see the [release notes](https://github.com/jshttp/cookie/releases) for any breaking changes ([#12172](https://github.com/remix-run/react-router/pull/12172))
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Replace `substr` with `substring` ([#12080](https://github.com/remix-run/react-router/pull/12080))
|
|
34
|
+
- Remove the deprecated `json` utility ([#12146](https://github.com/remix-run/react-router/pull/12146))
|
|
35
|
+
|
|
36
|
+
- You can use [`Response.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static) if you still need to construct JSON responses in your app
|
|
37
|
+
|
|
38
|
+
- Updated dependencies:
|
|
39
|
+
- `react-router@7.0.0-pre.2`
|
|
40
|
+
|
|
41
|
+
## 7.0.0-pre.1
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- Fix typegen for routes with a client loader but no server loader ([#12117](https://github.com/remix-run/react-router/pull/12117))
|
|
46
|
+
- - Fix `react-router-serve` handling of prerendered HTML files by removing the `redirect: false` option so it now falls back on the default `redirect: true` behavior of redirecting from `/folder` -> `/folder/` which will then pick up `/folder/index.html` from disk. See https://expressjs.com/en/resources/middleware/serve-static.html ([#12071](https://github.com/remix-run/react-router/pull/12071))
|
|
47
|
+
- Proxy prerendered loader data into prerender pass for HTML files to avoid double-invocations of the loader at build time
|
|
48
|
+
- Updated dependencies:
|
|
49
|
+
- `react-router@7.0.0-pre.1`
|
|
50
|
+
|
|
3
51
|
## 7.0.0-pre.0
|
|
4
52
|
|
|
5
53
|
### Major Changes
|
|
@@ -152,12 +200,12 @@
|
|
|
152
200
|
- ### Typesafety improvements ([#12019](https://github.com/remix-run/react-router/pull/12019))
|
|
153
201
|
|
|
154
202
|
React Router now generates types for each of your route modules.
|
|
155
|
-
You can access those types by importing them from `./+types
|
|
203
|
+
You can access those types by importing them from `./+types.<route filename without extension>`.
|
|
156
204
|
For example:
|
|
157
205
|
|
|
158
206
|
```ts
|
|
159
207
|
// app/routes/product.tsx
|
|
160
|
-
import type * as Route from "./+types
|
|
208
|
+
import type * as Route from "./+types.product";
|
|
161
209
|
|
|
162
210
|
export function loader({ params }: Route.LoaderArgs) {}
|
|
163
211
|
|
package/dist/dom-export.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Router v7.0.0-pre.
|
|
2
|
+
* React Router v7.0.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -46,8 +46,10 @@ function createHydratedRouter() {
|
|
|
46
46
|
if (!ssrInfo) {
|
|
47
47
|
throw new Error("You must be using the SSR features of React Router in order to skip " + "passing a `router` prop to `<RouterProvider>`");
|
|
48
48
|
}
|
|
49
|
+
|
|
49
50
|
// We need to suspend until the initial state snapshot is decoded into
|
|
50
51
|
// window.__reactRouterContext.state
|
|
52
|
+
|
|
51
53
|
let localSsrInfo = ssrInfo;
|
|
52
54
|
// Note: `stateDecodingPromise` is not coupled to `router` - we'll reach this
|
|
53
55
|
// code potentially many times waiting for our state to arrive, but we'll
|
|
@@ -92,7 +94,7 @@ function createHydratedRouter() {
|
|
|
92
94
|
// route opted into clientLoader hydration and either:
|
|
93
95
|
// * gave us a HydrateFallback
|
|
94
96
|
// * or doesn't have a server loader and we have no data to render
|
|
95
|
-
if (route && UNSAFE_shouldHydrateRouteLoader(manifestRoute, route, ssrInfo.context.isSpaMode) && (route.HydrateFallback || !manifestRoute.hasLoader)) {
|
|
97
|
+
if (route && manifestRoute && UNSAFE_shouldHydrateRouteLoader(manifestRoute, route, ssrInfo.context.isSpaMode) && (route.HydrateFallback || !manifestRoute.hasLoader)) {
|
|
96
98
|
delete hydrationData.loaderData[routeId];
|
|
97
99
|
} else if (manifestRoute && !manifestRoute.hasLoader) {
|
|
98
100
|
// Since every Remix route gets a `loader` on the client side to load
|
|
@@ -110,6 +112,7 @@ function createHydratedRouter() {
|
|
|
110
112
|
hydrationData.errors = UNSAFE_deserializeErrors(hydrationData.errors);
|
|
111
113
|
}
|
|
112
114
|
}
|
|
115
|
+
|
|
113
116
|
// We don't use createBrowserRouter here because we need fine-grained control
|
|
114
117
|
// over initialization to support synchronous `clientLoader` flows.
|
|
115
118
|
let router = UNSAFE_createRouter({
|
|
@@ -122,18 +125,21 @@ function createHydratedRouter() {
|
|
|
122
125
|
patchRoutesOnNavigation: UNSAFE_getPatchRoutesOnNavigationFunction(ssrInfo.manifest, ssrInfo.routeModules, ssrInfo.context.isSpaMode, ssrInfo.context.basename)
|
|
123
126
|
});
|
|
124
127
|
ssrInfo.router = router;
|
|
128
|
+
|
|
125
129
|
// We can call initialize() immediately if the router doesn't have any
|
|
126
130
|
// loaders to run on hydration
|
|
127
131
|
if (router.state.initialized) {
|
|
128
132
|
ssrInfo.routerInitialized = true;
|
|
129
133
|
router.initialize();
|
|
130
134
|
}
|
|
135
|
+
|
|
131
136
|
// @ts-ignore
|
|
132
137
|
router.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
|
|
133
138
|
UNSAFE_createClientRoutesWithHMRRevalidationOptOut;
|
|
134
|
-
window.
|
|
139
|
+
window.__reactRouterDataRouter = router;
|
|
135
140
|
return router;
|
|
136
141
|
}
|
|
142
|
+
|
|
137
143
|
/**
|
|
138
144
|
* @category Router Components
|
|
139
145
|
*/
|
|
@@ -142,6 +148,7 @@ function HydratedRouter() {
|
|
|
142
148
|
if (!router) {
|
|
143
149
|
router = createHydratedRouter();
|
|
144
150
|
}
|
|
151
|
+
|
|
145
152
|
// Critical CSS can become stale after code changes, e.g. styles might be
|
|
146
153
|
// removed from a component, but the styles will still be present in the
|
|
147
154
|
// server HTML. This allows our HMR logic to clear the critical CSS state.
|
|
@@ -171,6 +178,7 @@ function HydratedRouter() {
|
|
|
171
178
|
}, [location]);
|
|
172
179
|
!ssrInfo ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "ssrInfo unavailable for HydratedRouter") : UNSAFE_invariant(false) : void 0;
|
|
173
180
|
UNSAFE_useFogOFWarDiscovery(router, ssrInfo.manifest, ssrInfo.routeModules, ssrInfo.context.isSpaMode);
|
|
181
|
+
|
|
174
182
|
// We need to include a wrapper RemixErrorBoundary here in case the root error
|
|
175
183
|
// boundary also throws and we need to bubble up outside of the router entirely.
|
|
176
184
|
// Then we need a stateful location here so the user can back-button navigate
|
package/dist/dom-export.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom-export.mjs","sources":["../../lib/dom-export/hydrated-router.tsx","../../lib/dom-export/dom-router-provider.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport type {\n UNSAFE_AssetsManifest as AssetsManifest,\n UNSAFE_RouteModules as RouteModules,\n DataRouter,\n HydrationState,\n} from \"react-router\";\nimport {\n UNSAFE_invariant as invariant,\n UNSAFE_FrameworkContext as FrameworkContext,\n UNSAFE_decodeViaTurboStream as decodeViaTurboStream,\n UNSAFE_RemixErrorBoundary as RemixErrorBoundary,\n UNSAFE_createBrowserHistory as createBrowserHistory,\n UNSAFE_createClientRoutes as createClientRoutes,\n UNSAFE_createRouter as createRouter,\n UNSAFE_deserializeErrors as deserializeErrors,\n UNSAFE_getSingleFetchDataStrategy as getSingleFetchDataStrategy,\n UNSAFE_getPatchRoutesOnNavigationFunction as getPatchRoutesOnNavigationFunction,\n UNSAFE_shouldHydrateRouteLoader as shouldHydrateRouteLoader,\n UNSAFE_useFogOFWarDiscovery as useFogOFWarDiscovery,\n UNSAFE_mapRouteProperties as mapRouteProperties,\n UNSAFE_createClientRoutesWithHMRRevalidationOptOut as createClientRoutesWithHMRRevalidationOptOut,\n matchRoutes,\n} from \"react-router\";\nimport { RouterProvider } from \"./dom-router-provider\";\n\ntype SSRInfo = {\n context: NonNullable<(typeof window)[\"__reactRouterContext\"]>;\n routeModules: RouteModules;\n manifest: AssetsManifest;\n stateDecodingPromise:\n | (Promise<void> & {\n value?: unknown;\n error?: unknown;\n })\n | undefined;\n router: DataRouter | undefined;\n routerInitialized: boolean;\n};\n\nlet ssrInfo: SSRInfo | null = null;\nlet router: DataRouter | null = null;\n\nfunction initSsrInfo(): void {\n if (\n !ssrInfo &&\n window.__reactRouterContext &&\n window.__reactRouterManifest &&\n window.__reactRouterRouteModules\n ) {\n ssrInfo = {\n context: window.__reactRouterContext,\n manifest: window.__reactRouterManifest,\n routeModules: window.__reactRouterRouteModules,\n stateDecodingPromise: undefined,\n router: undefined,\n routerInitialized: false,\n };\n }\n}\n\nfunction createHydratedRouter(): DataRouter {\n initSsrInfo();\n\n if (!ssrInfo) {\n throw new Error(\n \"You must be using the SSR features of React Router in order to skip \" +\n \"passing a `router` prop to `<RouterProvider>`\"\n );\n }\n\n // We need to suspend until the initial state snapshot is decoded into\n // window.__reactRouterContext.state\n\n let localSsrInfo = ssrInfo;\n // Note: `stateDecodingPromise` is not coupled to `router` - we'll reach this\n // code potentially many times waiting for our state to arrive, but we'll\n // then only get past here and create the `router` one time\n if (!ssrInfo.stateDecodingPromise) {\n let stream = ssrInfo.context.stream;\n invariant(stream, \"No stream found for single fetch decoding\");\n ssrInfo.context.stream = undefined;\n ssrInfo.stateDecodingPromise = decodeViaTurboStream(stream, window)\n .then((value) => {\n ssrInfo!.context.state =\n value.value as typeof localSsrInfo.context.state;\n localSsrInfo.stateDecodingPromise!.value = true;\n })\n .catch((e) => {\n localSsrInfo.stateDecodingPromise!.error = e;\n });\n }\n if (ssrInfo.stateDecodingPromise.error) {\n throw ssrInfo.stateDecodingPromise.error;\n }\n if (!ssrInfo.stateDecodingPromise.value) {\n throw ssrInfo.stateDecodingPromise;\n }\n\n let routes = createClientRoutes(\n ssrInfo.manifest.routes,\n ssrInfo.routeModules,\n ssrInfo.context.state,\n ssrInfo.context.isSpaMode\n );\n\n let hydrationData: HydrationState | undefined = undefined;\n if (!ssrInfo.context.isSpaMode) {\n // Create a shallow clone of `loaderData` we can mutate for partial hydration.\n // When a route exports a `clientLoader` and a `HydrateFallback`, the SSR will\n // render the fallback so we need the client to do the same for hydration.\n // The server loader data has already been exposed to these route `clientLoader`'s\n // in `createClientRoutes` above, so we need to clear out the version we pass to\n // `createBrowserRouter` so it initializes and runs the client loaders.\n hydrationData = {\n ...ssrInfo.context.state,\n loaderData: { ...ssrInfo.context.state.loaderData },\n };\n let initialMatches = matchRoutes(\n routes,\n window.location,\n window.__reactRouterContext?.basename\n );\n if (initialMatches) {\n for (let match of initialMatches) {\n let routeId = match.route.id;\n let route = ssrInfo.routeModules[routeId];\n let manifestRoute = ssrInfo.manifest.routes[routeId];\n // Clear out the loaderData to avoid rendering the route component when the\n // route opted into clientLoader hydration and either:\n // * gave us a HydrateFallback\n // * or doesn't have a server loader and we have no data to render\n if (\n route &&\n shouldHydrateRouteLoader(\n manifestRoute,\n route,\n ssrInfo.context.isSpaMode\n ) &&\n (route.HydrateFallback || !manifestRoute.hasLoader)\n ) {\n delete hydrationData.loaderData![routeId];\n } else if (manifestRoute && !manifestRoute.hasLoader) {\n // Since every Remix route gets a `loader` on the client side to load\n // the route JS module, we need to add a `null` value to `loaderData`\n // for any routes that don't have server loaders so our partial\n // hydration logic doesn't kick off the route module loaders during\n // hydration\n hydrationData.loaderData![routeId] = null;\n }\n }\n }\n\n if (hydrationData && hydrationData.errors) {\n // TODO: De-dup this or remove entirely in v7 where single fetch is the\n // only approach and we have already serialized or deserialized on the server\n hydrationData.errors = deserializeErrors(hydrationData.errors);\n }\n }\n\n // We don't use createBrowserRouter here because we need fine-grained control\n // over initialization to support synchronous `clientLoader` flows.\n let router = createRouter({\n routes,\n history: createBrowserHistory(),\n basename: ssrInfo.context.basename,\n hydrationData,\n mapRouteProperties,\n dataStrategy: getSingleFetchDataStrategy(\n ssrInfo.manifest,\n ssrInfo.routeModules,\n () => router\n ),\n patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(\n ssrInfo.manifest,\n ssrInfo.routeModules,\n ssrInfo.context.isSpaMode,\n ssrInfo.context.basename\n ),\n });\n ssrInfo.router = router;\n\n // We can call initialize() immediately if the router doesn't have any\n // loaders to run on hydration\n if (router.state.initialized) {\n ssrInfo.routerInitialized = true;\n router.initialize();\n }\n\n // @ts-ignore\n router.createRoutesForHMR =\n /* spacer so ts-ignore does not affect the right hand of the assignment */\n createClientRoutesWithHMRRevalidationOptOut;\n window.__reactRouterInstance = router;\n\n return router;\n}\n\n/**\n * @category Router Components\n */\nexport function HydratedRouter() {\n if (!router) {\n router = createHydratedRouter();\n }\n\n // Critical CSS can become stale after code changes, e.g. styles might be\n // removed from a component, but the styles will still be present in the\n // server HTML. This allows our HMR logic to clear the critical CSS state.\n let [criticalCss, setCriticalCss] = React.useState(\n process.env.NODE_ENV === \"development\"\n ? ssrInfo?.context.criticalCss\n : undefined\n );\n if (process.env.NODE_ENV === \"development\") {\n if (ssrInfo) {\n window.__reactRouterClearCriticalCss = () => setCriticalCss(undefined);\n }\n }\n\n let [location, setLocation] = React.useState(router.state.location);\n\n React.useLayoutEffect(() => {\n // If we had to run clientLoaders on hydration, we delay initialization until\n // after we've hydrated to avoid hydration issues from synchronous client loaders\n if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {\n ssrInfo.routerInitialized = true;\n ssrInfo.router.initialize();\n }\n }, []);\n\n React.useLayoutEffect(() => {\n if (ssrInfo && ssrInfo.router) {\n return ssrInfo.router.subscribe((newState) => {\n if (newState.location !== location) {\n setLocation(newState.location);\n }\n });\n }\n }, [location]);\n\n invariant(ssrInfo, \"ssrInfo unavailable for HydratedRouter\");\n\n useFogOFWarDiscovery(\n router,\n ssrInfo.manifest,\n ssrInfo.routeModules,\n ssrInfo.context.isSpaMode\n );\n\n // We need to include a wrapper RemixErrorBoundary here in case the root error\n // boundary also throws and we need to bubble up outside of the router entirely.\n // Then we need a stateful location here so the user can back-button navigate\n // out of there\n return (\n // This fragment is important to ensure we match the <ServerRouter> JSX\n // structure so that useId values hydrate correctly\n <>\n <FrameworkContext.Provider\n value={{\n manifest: ssrInfo.manifest,\n routeModules: ssrInfo.routeModules,\n future: ssrInfo.context.future,\n criticalCss,\n isSpaMode: ssrInfo.context.isSpaMode,\n }}\n >\n <RemixErrorBoundary location={location}>\n <RouterProvider router={router} />\n </RemixErrorBoundary>\n </FrameworkContext.Provider>\n {/*\n This fragment is important to ensure we match the <ServerRouter> JSX\n structure so that useId values hydrate correctly\n */}\n <></>\n </>\n );\n}\n","import * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\n\nimport type { RouterProviderProps as BaseRouterProviderProps } from \"react-router\";\nimport { RouterProvider as BaseRouterProvider } from \"react-router\";\n\nexport { HydratedRouter } from \"./hydrated-router\";\n\nexport type RouterProviderProps = Omit<BaseRouterProviderProps, \"flushSync\">;\n\nexport function RouterProvider(props: Omit<RouterProviderProps, \"flushSync\">) {\n return <BaseRouterProvider flushSync={ReactDOM.flushSync} {...props} />;\n}\n"],"names":["ssrInfo","router","initSsrInfo","window","__reactRouterContext","__reactRouterManifest","__reactRouterRouteModules","context","manifest","routeModules","stateDecodingPromise","undefined","routerInitialized","createHydratedRouter","Error","localSsrInfo","stream","process","env","NODE_ENV","invariant","decodeViaTurboStream","then","value","state","catch","e","error","routes","createClientRoutes","isSpaMode","hydrationData","_window$__reactRouter","_extends","loaderData","initialMatches","matchRoutes","location","basename","match","routeId","route","id","manifestRoute","shouldHydrateRouteLoader","HydrateFallback","hasLoader","errors","deserializeErrors","createRouter","history","createBrowserHistory","mapRouteProperties","dataStrategy","getSingleFetchDataStrategy","patchRoutesOnNavigation","getPatchRoutesOnNavigationFunction","initialized","initialize","createRoutesForHMR","createClientRoutesWithHMRRevalidationOptOut","__reactRouterInstance","HydratedRouter","_ssrInfo","criticalCss","setCriticalCss","React","useState","__reactRouterClearCriticalCss","setLocation","useLayoutEffect","subscribe","newState","useFogOFWarDiscovery","createElement","Fragment","FrameworkContext","Provider","future","RemixErrorBoundary","RouterProvider","props","BaseRouterProvider","flushSync","ReactDOM"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAIA,OAAO,GAAmB,IAAI,CAAA;AAClC,IAAIC,MAAM,GAAsB,IAAI,CAAA;AAEpC,SAASC,WAAWA,GAAA;AAClB,EAAA,IACE,CAACF,OAAO,IACRG,MAAM,CAACC,oBAAoB,IAC3BD,MAAM,CAACE,qBAAqB,IAC5BF,MAAM,CAACG,yBAAyB,EAChC;AACAN,IAAAA,OAAO,GAAG;MACRO,OAAO,EAAEJ,MAAM,CAACC,oBAAoB;MACpCI,QAAQ,EAAEL,MAAM,CAACE,qBAAqB;MACtCI,YAAY,EAAEN,MAAM,CAACG,yBAAyB;AAC9CI,MAAAA,oBAAoB,EAAEC,SAAS;AAC/BV,MAAAA,MAAM,EAAEU,SAAS;AACjBC,MAAAA,iBAAiB,EAAE,KAAA;KACpB,CAAA;AACH,GAAA;AACF,CAAA;AAEA,SAASC,oBAAoBA,GAAA;AAC3BX,EAAAA,WAAW,EAAE,CAAA;EAEb,IAAI,CAACF,OAAO,EAAE;AACZ,IAAA,MAAM,IAAIc,KAAK,CACb,sEAAsE,GACpE,+CAA+C,CAClD,CAAA;AACH,GAAA;AAEA;AACA;EAEA,IAAIC,YAAY,GAAGf,OAAO,CAAA;AAC1B;AACA;AACA;AACA,EAAA,IAAI,CAACA,OAAO,CAACU,oBAAoB,EAAE;AACjC,IAAA,IAAIM,MAAM,GAAGhB,OAAO,CAACO,OAAO,CAACS,MAAM,CAAA;AACnC,IAAA,CAAUA,MAAM,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,KAAA,YAAA,GAAhBC,gBAAS,CAAA,KAAA,EAAS,2CAA2C,C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AAA;AAETqD,EAAAA,2BAAoB,CAClBxE,MAAM,EACND,OAAO,CAACQ,QAAQ,EAChBR,OAAO,CAACS,YAAY,EACpBT,OAAO,CAACO,OAAO,CAACuB,SAAS,CAC1B,CAAA;AAED;AACA;AACA;AACA;AACA,EAAA;AAAA;AACE;AACA;AACAoC,IAAAA,KAAA,CAAAQ,aAAA,CAAAR,KAAA,CAAAS,QAAA,EAAA,IAAA,eACET,KAAA,CAAAQ,aAAA,CAACE,uBAAgB,CAACC,QAAQ,EAAA;AACxBtD,MAAAA,KAAK,EAAE;QACLf,QAAQ,EAAER,OAAO,CAACQ,QAAQ;QAC1BC,YAAY,EAAET,OAAO,CAACS,YAAY;AAClCqE,QAAAA,MAAM,EAAE9E,OAAO,CAACO,OAAO,CAACuE,MAAM;QAC9Bd,WAAW;AACXlC,QAAAA,SAAS,EAAE9B,OAAO,CAACO,OAAO,CAACuB,SAAAA;AAC5B,OAAA;AAAA,KAAA,eAEDoC,KAAA,CAAAQ,aAAA,CAACK,yBAAkB,EAAA;AAAC1C,MAAAA,QAAQ,EAAEA,QAAAA;AAAQ,KAAA,eACpC6B,KAAA,CAAAQ,aAAA,CAACM,cAAc,EAAC;AAAA/E,MAAAA,MAAM,EAAEA,MAAAA;AAAM,KAAA,CAAI,CACf,CACK,eAK5BiE,KAAK,CAAAQ,aAAA,CAAAR,KAAA,CAAAS,QAAA,EAAA,IAAA,CAAA,CAAA;AACJ,IAAA;AAEP;;AC7QM,SAAUK,cAAcA,CAACC,KAA6C,EAAA;AAC1E,EAAA,oBAAOf,KAAA,CAAAQ,aAAA,CAACQ,gBAAkB,EAAAjD,QAAA,CAAA;IAACkD,SAAS,EAAEC,QAAQ,CAACD,SAAAA;GAAeF,EAAAA,KAAK,CAAA,CAAI,CAAA;AACzE;;;;"}
|
|
1
|
+
{"version":3,"file":"dom-export.mjs","sources":["../lib/dom-export/hydrated-router.tsx","../lib/dom-export/dom-router-provider.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport type {\n UNSAFE_AssetsManifest as AssetsManifest,\n UNSAFE_RouteModules as RouteModules,\n DataRouter,\n HydrationState,\n} from \"react-router\";\nimport {\n UNSAFE_invariant as invariant,\n UNSAFE_FrameworkContext as FrameworkContext,\n UNSAFE_decodeViaTurboStream as decodeViaTurboStream,\n UNSAFE_RemixErrorBoundary as RemixErrorBoundary,\n UNSAFE_createBrowserHistory as createBrowserHistory,\n UNSAFE_createClientRoutes as createClientRoutes,\n UNSAFE_createRouter as createRouter,\n UNSAFE_deserializeErrors as deserializeErrors,\n UNSAFE_getSingleFetchDataStrategy as getSingleFetchDataStrategy,\n UNSAFE_getPatchRoutesOnNavigationFunction as getPatchRoutesOnNavigationFunction,\n UNSAFE_shouldHydrateRouteLoader as shouldHydrateRouteLoader,\n UNSAFE_useFogOFWarDiscovery as useFogOFWarDiscovery,\n UNSAFE_mapRouteProperties as mapRouteProperties,\n UNSAFE_createClientRoutesWithHMRRevalidationOptOut as createClientRoutesWithHMRRevalidationOptOut,\n matchRoutes,\n} from \"react-router\";\nimport { RouterProvider } from \"./dom-router-provider\";\n\ntype SSRInfo = {\n context: NonNullable<(typeof window)[\"__reactRouterContext\"]>;\n routeModules: RouteModules;\n manifest: AssetsManifest;\n stateDecodingPromise:\n | (Promise<void> & {\n value?: unknown;\n error?: unknown;\n })\n | undefined;\n router: DataRouter | undefined;\n routerInitialized: boolean;\n};\n\nlet ssrInfo: SSRInfo | null = null;\nlet router: DataRouter | null = null;\n\nfunction initSsrInfo(): void {\n if (\n !ssrInfo &&\n window.__reactRouterContext &&\n window.__reactRouterManifest &&\n window.__reactRouterRouteModules\n ) {\n ssrInfo = {\n context: window.__reactRouterContext,\n manifest: window.__reactRouterManifest,\n routeModules: window.__reactRouterRouteModules,\n stateDecodingPromise: undefined,\n router: undefined,\n routerInitialized: false,\n };\n }\n}\n\nfunction createHydratedRouter(): DataRouter {\n initSsrInfo();\n\n if (!ssrInfo) {\n throw new Error(\n \"You must be using the SSR features of React Router in order to skip \" +\n \"passing a `router` prop to `<RouterProvider>`\"\n );\n }\n\n // We need to suspend until the initial state snapshot is decoded into\n // window.__reactRouterContext.state\n\n let localSsrInfo = ssrInfo;\n // Note: `stateDecodingPromise` is not coupled to `router` - we'll reach this\n // code potentially many times waiting for our state to arrive, but we'll\n // then only get past here and create the `router` one time\n if (!ssrInfo.stateDecodingPromise) {\n let stream = ssrInfo.context.stream;\n invariant(stream, \"No stream found for single fetch decoding\");\n ssrInfo.context.stream = undefined;\n ssrInfo.stateDecodingPromise = decodeViaTurboStream(stream, window)\n .then((value) => {\n ssrInfo!.context.state =\n value.value as typeof localSsrInfo.context.state;\n localSsrInfo.stateDecodingPromise!.value = true;\n })\n .catch((e) => {\n localSsrInfo.stateDecodingPromise!.error = e;\n });\n }\n if (ssrInfo.stateDecodingPromise.error) {\n throw ssrInfo.stateDecodingPromise.error;\n }\n if (!ssrInfo.stateDecodingPromise.value) {\n throw ssrInfo.stateDecodingPromise;\n }\n\n let routes = createClientRoutes(\n ssrInfo.manifest.routes,\n ssrInfo.routeModules,\n ssrInfo.context.state,\n ssrInfo.context.isSpaMode\n );\n\n let hydrationData: HydrationState | undefined = undefined;\n if (!ssrInfo.context.isSpaMode) {\n // Create a shallow clone of `loaderData` we can mutate for partial hydration.\n // When a route exports a `clientLoader` and a `HydrateFallback`, the SSR will\n // render the fallback so we need the client to do the same for hydration.\n // The server loader data has already been exposed to these route `clientLoader`'s\n // in `createClientRoutes` above, so we need to clear out the version we pass to\n // `createBrowserRouter` so it initializes and runs the client loaders.\n hydrationData = {\n ...ssrInfo.context.state,\n loaderData: { ...ssrInfo.context.state.loaderData },\n };\n let initialMatches = matchRoutes(\n routes,\n window.location,\n window.__reactRouterContext?.basename\n );\n if (initialMatches) {\n for (let match of initialMatches) {\n let routeId = match.route.id;\n let route = ssrInfo.routeModules[routeId];\n let manifestRoute = ssrInfo.manifest.routes[routeId];\n // Clear out the loaderData to avoid rendering the route component when the\n // route opted into clientLoader hydration and either:\n // * gave us a HydrateFallback\n // * or doesn't have a server loader and we have no data to render\n if (\n route &&\n manifestRoute &&\n shouldHydrateRouteLoader(\n manifestRoute,\n route,\n ssrInfo.context.isSpaMode\n ) &&\n (route.HydrateFallback || !manifestRoute.hasLoader)\n ) {\n delete hydrationData.loaderData![routeId];\n } else if (manifestRoute && !manifestRoute.hasLoader) {\n // Since every Remix route gets a `loader` on the client side to load\n // the route JS module, we need to add a `null` value to `loaderData`\n // for any routes that don't have server loaders so our partial\n // hydration logic doesn't kick off the route module loaders during\n // hydration\n hydrationData.loaderData![routeId] = null;\n }\n }\n }\n\n if (hydrationData && hydrationData.errors) {\n // TODO: De-dup this or remove entirely in v7 where single fetch is the\n // only approach and we have already serialized or deserialized on the server\n hydrationData.errors = deserializeErrors(hydrationData.errors);\n }\n }\n\n // We don't use createBrowserRouter here because we need fine-grained control\n // over initialization to support synchronous `clientLoader` flows.\n let router = createRouter({\n routes,\n history: createBrowserHistory(),\n basename: ssrInfo.context.basename,\n hydrationData,\n mapRouteProperties,\n dataStrategy: getSingleFetchDataStrategy(\n ssrInfo.manifest,\n ssrInfo.routeModules,\n () => router\n ),\n patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(\n ssrInfo.manifest,\n ssrInfo.routeModules,\n ssrInfo.context.isSpaMode,\n ssrInfo.context.basename\n ),\n });\n ssrInfo.router = router;\n\n // We can call initialize() immediately if the router doesn't have any\n // loaders to run on hydration\n if (router.state.initialized) {\n ssrInfo.routerInitialized = true;\n router.initialize();\n }\n\n // @ts-ignore\n router.createRoutesForHMR =\n /* spacer so ts-ignore does not affect the right hand of the assignment */\n createClientRoutesWithHMRRevalidationOptOut;\n window.__reactRouterDataRouter = router;\n\n return router;\n}\n\n/**\n * @category Router Components\n */\nexport function HydratedRouter() {\n if (!router) {\n router = createHydratedRouter();\n }\n\n // Critical CSS can become stale after code changes, e.g. styles might be\n // removed from a component, but the styles will still be present in the\n // server HTML. This allows our HMR logic to clear the critical CSS state.\n let [criticalCss, setCriticalCss] = React.useState(\n process.env.NODE_ENV === \"development\"\n ? ssrInfo?.context.criticalCss\n : undefined\n );\n if (process.env.NODE_ENV === \"development\") {\n if (ssrInfo) {\n window.__reactRouterClearCriticalCss = () => setCriticalCss(undefined);\n }\n }\n\n let [location, setLocation] = React.useState(router.state.location);\n\n React.useLayoutEffect(() => {\n // If we had to run clientLoaders on hydration, we delay initialization until\n // after we've hydrated to avoid hydration issues from synchronous client loaders\n if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {\n ssrInfo.routerInitialized = true;\n ssrInfo.router.initialize();\n }\n }, []);\n\n React.useLayoutEffect(() => {\n if (ssrInfo && ssrInfo.router) {\n return ssrInfo.router.subscribe((newState) => {\n if (newState.location !== location) {\n setLocation(newState.location);\n }\n });\n }\n }, [location]);\n\n invariant(ssrInfo, \"ssrInfo unavailable for HydratedRouter\");\n\n useFogOFWarDiscovery(\n router,\n ssrInfo.manifest,\n ssrInfo.routeModules,\n ssrInfo.context.isSpaMode\n );\n\n // We need to include a wrapper RemixErrorBoundary here in case the root error\n // boundary also throws and we need to bubble up outside of the router entirely.\n // Then we need a stateful location here so the user can back-button navigate\n // out of there\n return (\n // This fragment is important to ensure we match the <ServerRouter> JSX\n // structure so that useId values hydrate correctly\n <>\n <FrameworkContext.Provider\n value={{\n manifest: ssrInfo.manifest,\n routeModules: ssrInfo.routeModules,\n future: ssrInfo.context.future,\n criticalCss,\n isSpaMode: ssrInfo.context.isSpaMode,\n }}\n >\n <RemixErrorBoundary location={location}>\n <RouterProvider router={router} />\n </RemixErrorBoundary>\n </FrameworkContext.Provider>\n {/*\n This fragment is important to ensure we match the <ServerRouter> JSX\n structure so that useId values hydrate correctly\n */}\n <></>\n </>\n );\n}\n","import * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\n\nimport type { RouterProviderProps as BaseRouterProviderProps } from \"react-router\";\nimport { RouterProvider as BaseRouterProvider } from \"react-router\";\n\nexport { HydratedRouter } from \"./hydrated-router\";\n\nexport type RouterProviderProps = Omit<BaseRouterProviderProps, \"flushSync\">;\n\nexport function RouterProvider(props: Omit<RouterProviderProps, \"flushSync\">) {\n return <BaseRouterProvider flushSync={ReactDOM.flushSync} {...props} />;\n}\n"],"names":["ssrInfo","router","initSsrInfo","window","__reactRouterContext","__reactRouterManifest","__reactRouterRouteModules","context","manifest","routeModules","stateDecodingPromise","undefined","routerInitialized","createHydratedRouter","Error","localSsrInfo","stream","process","env","NODE_ENV","invariant","decodeViaTurboStream","then","value","state","catch","e","error","routes","createClientRoutes","isSpaMode","hydrationData","_window$__reactRouter","_extends","loaderData","initialMatches","matchRoutes","location","basename","match","routeId","route","id","manifestRoute","shouldHydrateRouteLoader","HydrateFallback","hasLoader","errors","deserializeErrors","createRouter","history","createBrowserHistory","mapRouteProperties","dataStrategy","getSingleFetchDataStrategy","patchRoutesOnNavigation","getPatchRoutesOnNavigationFunction","initialized","initialize","createRoutesForHMR","createClientRoutesWithHMRRevalidationOptOut","__reactRouterDataRouter","HydratedRouter","_ssrInfo","criticalCss","setCriticalCss","React","useState","__reactRouterClearCriticalCss","setLocation","useLayoutEffect","subscribe","newState","useFogOFWarDiscovery","createElement","Fragment","FrameworkContext","Provider","future","RemixErrorBoundary","RouterProvider","props","BaseRouterProvider","flushSync","ReactDOM"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAIA,OAAuB,GAAG,IAAI,CAAA;AAClC,IAAIC,MAAyB,GAAG,IAAI,CAAA;AAEpC,SAASC,WAAWA,GAAS;AAC3B,EAAA,IACE,CAACF,OAAO,IACRG,MAAM,CAACC,oBAAoB,IAC3BD,MAAM,CAACE,qBAAqB,IAC5BF,MAAM,CAACG,yBAAyB,EAChC;AACAN,IAAAA,OAAO,GAAG;MACRO,OAAO,EAAEJ,MAAM,CAACC,oBAAoB;MACpCI,QAAQ,EAAEL,MAAM,CAACE,qBAAqB;MACtCI,YAAY,EAAEN,MAAM,CAACG,yBAAyB;AAC9CI,MAAAA,oBAAoB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AA,CAAAQ,aAAA,CAACK,yBAAkB,EAAA;AAAC1C,MAAAA,QAAQ,EAAEA,QAAAA;AAAS,KAAA,eACrC6B,KAAA,CAAAQ,aAAA,CAACM,cAAc,EAAA;AAAC/E,MAAAA,MAAM,EAAEA,MAAAA;AAAO,KAAE,CACf,CACK,CAAC,eAK5BiE,KAAA,CAAAQ,aAAA,CAAAR,KAAA,CAAAS,QAAA,EAAA,IAAI,CACJ,CAAA;AAAC,IAAA;AAEP;;AC9QO,SAASK,cAAcA,CAACC,KAA6C,EAAE;AAC5E,EAAA,oBAAOf,KAAA,CAAAQ,aAAA,CAACQ,gBAAkB,EAAAjD,QAAA,CAAA;IAACkD,SAAS,EAAEC,QAAQ,CAACD,SAAAA;GAAeF,EAAAA,KAAK,CAAG,CAAC,CAAA;AACzE;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export type { InitialEntry, Location, Path, To } from "./lib/router/history";
|
|
2
2
|
export type { HydrationState, StaticHandler, GetScrollPositionFunction, GetScrollRestorationKeyFunction, StaticHandlerContext, Fetcher, Navigation, NavigationStates, RelativeRoutingType, Blocker, BlockerFunction, Router as DataRouter, RouterState, RouterInit, RouterSubscriber, RouterNavigateOptions, RouterFetchOptions, RevalidationState, } from "./lib/router/router";
|
|
3
|
-
export type { ActionFunction, ActionFunctionArgs, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, DataWithResponseInit as UNSAFE_DataWithResponseInit, ErrorResponse, FormEncType, FormMethod, HTMLFormMethod,
|
|
3
|
+
export type { ActionFunction, ActionFunctionArgs, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, DataWithResponseInit as UNSAFE_DataWithResponseInit, ErrorResponse, FormEncType, FormMethod, HTMLFormMethod, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, UIMatch, } from "./lib/router/utils";
|
|
4
4
|
export { Action as NavigationType, createPath, parsePath, } from "./lib/router/history";
|
|
5
5
|
export { IDLE_NAVIGATION, IDLE_FETCHER, IDLE_BLOCKER, } from "./lib/router/router";
|
|
6
|
-
export { data, generatePath, isRouteErrorResponse,
|
|
6
|
+
export { data, generatePath, isRouteErrorResponse, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath, } from "./lib/router/utils";
|
|
7
7
|
export type { DataRouteMatch, DataRouteObject, IndexRouteObject, NavigateOptions, Navigator, NonIndexRouteObject, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, RouteMatch, RouteObject, } from "./lib/context";
|
|
8
8
|
export type { AwaitProps, IndexRouteProps, LayoutRouteProps, MemoryRouterProps, NavigateProps, OutletProps, PathRouteProps, RouteProps, RouterProps, RouterProviderProps, RoutesProps, } from "./lib/components";
|
|
9
9
|
export type { NavigateFunction } from "./lib/hooks";
|
|
@@ -36,8 +36,7 @@ export type { HandleDataRequestFunction, HandleDocumentRequestFunction, HandleEr
|
|
|
36
36
|
export type { Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, } from "./lib/server-runtime/cookies";
|
|
37
37
|
export type { AppLoadContext } from "./lib/server-runtime/data";
|
|
38
38
|
export type { PageLinkDescriptor, HtmlLinkDescriptor, LinkDescriptor, } from "./lib/router/links";
|
|
39
|
-
export type {
|
|
40
|
-
export type { DataFunctionArgs, HeadersArgs, HeadersFunction, } from "./lib/server-runtime/routeModules";
|
|
39
|
+
export type { HeadersArgs, HeadersFunction, } from "./lib/server-runtime/routeModules";
|
|
41
40
|
export type { RequestHandler } from "./lib/server-runtime/server";
|
|
42
41
|
export type { Session, SessionData, SessionIdStorageStrategy, SessionStorage, FlashSessionData, } from "./lib/server-runtime/sessions";
|
|
43
42
|
/** @internal */
|