react-router 0.0.0-experimental-4b431ca46 → 0.0.0-experimental-3be88c6fb
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 +0 -306
- package/README.md +14 -1
- package/dist/index.d.ts +29 -74
- package/dist/index.js +1467 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/components.d.ts +34 -249
- package/dist/lib/context.d.ts +5 -18
- package/dist/lib/hooks.d.ts +55 -284
- package/dist/main.js +1 -1
- package/dist/react-router.development.js +1141 -12283
- 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.development.js +1268 -12503
- 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 +6 -35
- package/dist/dom-export.d.ts +0 -3
- package/dist/dom-export.mjs +0 -205
- package/dist/dom-export.mjs.map +0 -1
- package/dist/index.mjs +0 -11551
- package/dist/index.mjs.map +0 -1
- package/dist/lib/dom/dom.d.ts +0 -123
- package/dist/lib/dom/global.d.ts +0 -40
- package/dist/lib/dom/lib.d.ts +0 -940
- package/dist/lib/dom/server.d.ts +0 -41
- package/dist/lib/dom/ssr/components.d.ts +0 -123
- package/dist/lib/dom/ssr/data.d.ts +0 -7
- package/dist/lib/dom/ssr/entry.d.ts +0 -47
- package/dist/lib/dom/ssr/errorBoundaries.d.ts +0 -36
- package/dist/lib/dom/ssr/errors.d.ts +0 -2
- package/dist/lib/dom/ssr/fallback.d.ts +0 -2
- package/dist/lib/dom/ssr/fog-of-war.d.ts +0 -28
- package/dist/lib/dom/ssr/invariant.d.ts +0 -2
- package/dist/lib/dom/ssr/links.d.ts +0 -25
- package/dist/lib/dom/ssr/markup.d.ts +0 -5
- package/dist/lib/dom/ssr/routeModules.d.ts +0 -141
- package/dist/lib/dom/ssr/routes-test-stub.d.ts +0 -59
- package/dist/lib/dom/ssr/routes.d.ts +0 -32
- package/dist/lib/dom/ssr/server.d.ts +0 -16
- package/dist/lib/dom/ssr/single-fetch.d.ts +0 -37
- package/dist/lib/dom-export/dom-router-provider.d.ts +0 -5
- package/dist/lib/dom-export/hydrated-router.d.ts +0 -5
- package/dist/lib/dom-export.d.ts +0 -3
- package/dist/lib/router/history.d.ts +0 -253
- package/dist/lib/router/links.d.ts +0 -104
- package/dist/lib/router/router.d.ts +0 -540
- package/dist/lib/router/utils.d.ts +0 -505
- package/dist/lib/server-runtime/build.d.ts +0 -38
- package/dist/lib/server-runtime/cookies.d.ts +0 -62
- package/dist/lib/server-runtime/crypto.d.ts +0 -2
- package/dist/lib/server-runtime/data.d.ts +0 -15
- package/dist/lib/server-runtime/dev.d.ts +0 -8
- package/dist/lib/server-runtime/entry.d.ts +0 -3
- package/dist/lib/server-runtime/errors.d.ts +0 -51
- package/dist/lib/server-runtime/headers.d.ts +0 -3
- package/dist/lib/server-runtime/invariant.d.ts +0 -2
- package/dist/lib/server-runtime/jsonify.d.ts +0 -33
- package/dist/lib/server-runtime/markup.d.ts +0 -1
- package/dist/lib/server-runtime/mode.d.ts +0 -9
- package/dist/lib/server-runtime/responses.d.ts +0 -37
- package/dist/lib/server-runtime/routeMatching.d.ts +0 -8
- package/dist/lib/server-runtime/routeModules.d.ts +0 -212
- package/dist/lib/server-runtime/routes.d.ts +0 -31
- package/dist/lib/server-runtime/server.d.ts +0 -5
- package/dist/lib/server-runtime/serverHandoff.d.ts +0 -11
- package/dist/lib/server-runtime/sessions/cookieStorage.d.ts +0 -19
- package/dist/lib/server-runtime/sessions/memoryStorage.d.ts +0 -17
- package/dist/lib/server-runtime/sessions.d.ts +0 -140
- package/dist/lib/server-runtime/single-fetch.d.ts +0 -30
- package/dist/lib/server-runtime/typecheck.d.ts +0 -4
- package/dist/lib/server-runtime/warnings.d.ts +0 -1
- package/dist/lib/types.d.ts +0 -71
- package/dist/lib/types.mjs +0 -10
- package/dist/main-dom-export.js +0 -19
- package/dist/react-router-dom.development.js +0 -199
- package/dist/react-router-dom.development.js.map +0 -1
- package/dist/react-router-dom.production.min.js +0 -12
- package/dist/react-router-dom.production.min.js.map +0 -1
- package/dist/umd/react-router-dom.development.js +0 -241
- package/dist/umd/react-router-dom.development.js.map +0 -1
- package/dist/umd/react-router-dom.production.min.js +0 -12
- package/dist/umd/react-router-dom.production.min.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,311 +1,5 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
-
## 7.0.0-pre.0
|
|
4
|
-
|
|
5
|
-
### Major Changes
|
|
6
|
-
|
|
7
|
-
- Remove the original `defer` implementation in favor of using raw promises via single fetch and `turbo-stream`. This removes these exports from React Router: ([#11744](https://github.com/remix-run/react-router/pull/11744))
|
|
8
|
-
|
|
9
|
-
- `defer`
|
|
10
|
-
- `AbortedDeferredError`
|
|
11
|
-
- `type TypedDeferredData`
|
|
12
|
-
- `UNSAFE_DeferredData`
|
|
13
|
-
- `UNSAFE_DEFERRED_SYMBOL`,
|
|
14
|
-
|
|
15
|
-
- - Collapse `@remix-run/router` into `react-router` ([#11505](https://github.com/remix-run/react-router/pull/11505))
|
|
16
|
-
- Collapse `react-router-dom` into `react-router`
|
|
17
|
-
- Collapse `@remix-run/server-runtime` into `react-router`
|
|
18
|
-
- Collapse `@remix-run/testing` into `react-router`
|
|
19
|
-
- Remove single_fetch future flag. ([#11522](https://github.com/remix-run/react-router/pull/11522))
|
|
20
|
-
- Drop support for Node 16, React Router SSR now requires Node 18 or higher ([#11391](https://github.com/remix-run/react-router/pull/11391))
|
|
21
|
-
- Remove `future.v7_startTransition` flag ([#11696](https://github.com/remix-run/react-router/pull/11696))
|
|
22
|
-
- - Expose the underlying router promises from the following APIs for compsition in React 19 APIs: ([#11521](https://github.com/remix-run/react-router/pull/11521))
|
|
23
|
-
- `useNavigate()`
|
|
24
|
-
- `useSubmit`
|
|
25
|
-
- `useFetcher().load`
|
|
26
|
-
- `useFetcher().submit`
|
|
27
|
-
- `useRevalidator.revalidate`
|
|
28
|
-
- Remove `future.v7_normalizeFormMethod` future flag ([#11697](https://github.com/remix-run/react-router/pull/11697))
|
|
29
|
-
- For Remix consumers migrating to React Router, the `crypto` global from the [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) is now required when using cookie and session APIs. This means that the following APIs are provided from `react-router` rather than platform-specific packages: ([#11837](https://github.com/remix-run/react-router/pull/11837))
|
|
30
|
-
|
|
31
|
-
- `createCookie`
|
|
32
|
-
- `createCookieSessionStorage`
|
|
33
|
-
- `createMemorySessionStorage`
|
|
34
|
-
- `createSessionStorage`
|
|
35
|
-
|
|
36
|
-
For consumers running older versions of Node, the `installGlobals` function from `@remix-run/node` has been updated to define `globalThis.crypto`, using [Node's `require('node:crypto').webcrypto` implementation.](https://nodejs.org/api/webcrypto.html)
|
|
37
|
-
|
|
38
|
-
Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
|
|
39
|
-
|
|
40
|
-
- `createCookieFactory`
|
|
41
|
-
- `createSessionStorageFactory`
|
|
42
|
-
- `createCookieSessionStorageFactory`
|
|
43
|
-
- `createMemorySessionStorageFactory`
|
|
44
|
-
|
|
45
|
-
- Imports/Exports cleanup ([#11840](https://github.com/remix-run/react-router/pull/11840))
|
|
46
|
-
|
|
47
|
-
- Removed the following exports that were previously public API from `@remix-run/router`
|
|
48
|
-
- types
|
|
49
|
-
- `AgnosticDataIndexRouteObject`
|
|
50
|
-
- `AgnosticDataNonIndexRouteObject`
|
|
51
|
-
- `AgnosticDataRouteMatch`
|
|
52
|
-
- `AgnosticDataRouteObject`
|
|
53
|
-
- `AgnosticIndexRouteObject`
|
|
54
|
-
- `AgnosticNonIndexRouteObject`
|
|
55
|
-
- `AgnosticRouteMatch`
|
|
56
|
-
- `AgnosticRouteObject`
|
|
57
|
-
- `TrackedPromise`
|
|
58
|
-
- `unstable_AgnosticPatchRoutesOnMissFunction`
|
|
59
|
-
- `Action` -> exported as `NavigationType` via `react-router`
|
|
60
|
-
- `Router` exported as `RemixRouter` to differentiate from RR's `<Router>`
|
|
61
|
-
- API
|
|
62
|
-
- `getToPathname` (`@private`)
|
|
63
|
-
- `joinPaths` (`@private`)
|
|
64
|
-
- `normalizePathname` (`@private`)
|
|
65
|
-
- `resolveTo` (`@private`)
|
|
66
|
-
- `stripBasename` (`@private`)
|
|
67
|
-
- `createBrowserHistory` -> in favor of `createBrowserRouter`
|
|
68
|
-
- `createHashHistory` -> in favor of `createHashRouter`
|
|
69
|
-
- `createMemoryHistory` -> in favor of `createMemoryRouter`
|
|
70
|
-
- `createRouter`
|
|
71
|
-
- `createStaticHandler` -> in favor of wrapper `createStaticHandler` in RR Dom
|
|
72
|
-
- `getStaticContextFromError`
|
|
73
|
-
- Removed the following exports that were previously public API from `react-router`
|
|
74
|
-
- `Hash`
|
|
75
|
-
- `Pathname`
|
|
76
|
-
- `Search`
|
|
77
|
-
|
|
78
|
-
- update minimum node version to 18 ([#11690](https://github.com/remix-run/react-router/pull/11690))
|
|
79
|
-
- Remove `future.v7_prependBasename` from the ionternalized `@remix-run/router` package ([#11726](https://github.com/remix-run/react-router/pull/11726))
|
|
80
|
-
- Remove `future.v7_throwAbortReason` from internalized `@remix-run/router` package ([#11728](https://github.com/remix-run/react-router/pull/11728))
|
|
81
|
-
- Add `exports` field to all packages ([#11675](https://github.com/remix-run/react-router/pull/11675))
|
|
82
|
-
- node package no longer re-exports from react-router ([#11702](https://github.com/remix-run/react-router/pull/11702))
|
|
83
|
-
- renamed RemixContext to FrameworkContext ([#11705](https://github.com/remix-run/react-router/pull/11705))
|
|
84
|
-
- updates the minimum React version to 18 ([#11689](https://github.com/remix-run/react-router/pull/11689))
|
|
85
|
-
- PrefetchPageDescriptor replaced by PageLinkDescriptor ([#11960](https://github.com/remix-run/react-router/pull/11960))
|
|
86
|
-
- - Remove the `future.v7_partialHydration` flag ([#11725](https://github.com/remix-run/react-router/pull/11725))
|
|
87
|
-
- This also removes the `<RouterProvider fallbackElement>` prop
|
|
88
|
-
- To migrate, move the `fallbackElement` to a `hydrateFallbackElement`/`HydrateFallback` on your root route
|
|
89
|
-
- Also worth nothing there is a related breaking changer with this future flag:
|
|
90
|
-
- Without `future.v7_partialHydration` (when using `fallbackElement`), `state.navigation` was populated during the initial load
|
|
91
|
-
- With `future.v7_partialHydration`, `state.navigation` remains in an `"idle"` state during the initial load
|
|
92
|
-
- Remove `v7_relativeSplatPath` future flag ([#11695](https://github.com/remix-run/react-router/pull/11695))
|
|
93
|
-
- Remove remaining future flags ([#11820](https://github.com/remix-run/react-router/pull/11820))
|
|
94
|
-
|
|
95
|
-
- React Router `v7_skipActionErrorRevalidation`
|
|
96
|
-
- Remix `v3_fetcherPersist`, `v3_relativeSplatPath`, `v3_throwAbortReason`
|
|
97
|
-
|
|
98
|
-
- rename createRemixStub to createRoutesStub ([#11692](https://github.com/remix-run/react-router/pull/11692))
|
|
99
|
-
- Remove `@remix-run/router` deprecated `detectErrorBoundary` option in favor of `mapRouteProperties` ([#11751](https://github.com/remix-run/react-router/pull/11751))
|
|
100
|
-
- Add `react-router/dom` subpath export to properly enable `react-dom` as an optional `peerDependency` ([#11851](https://github.com/remix-run/react-router/pull/11851))
|
|
101
|
-
|
|
102
|
-
- This ensures that we don't blindly `import ReactDOM from "react-dom"` in `<RouterProvider>` in order to access `ReactDOM.flushSync()`, since that would break `createMemoryRouter` use cases in non-DOM environments
|
|
103
|
-
- DOM environments should import from `react-router/dom` to get the proper component that makes `ReactDOM.flushSync()` available:
|
|
104
|
-
- If you are using the Vite plugin, use this in your `entry.client.tsx`:
|
|
105
|
-
- `import { HydratedRouter } from 'react-router/dom'`
|
|
106
|
-
- If you are not using the Vite plugin and are manually calling `createBrowserRouter`/`createHashRouter`:
|
|
107
|
-
- `import { RouterProvider } from "react-router/dom"`
|
|
108
|
-
|
|
109
|
-
- Remove `future.v7_fetcherPersist` flag ([#11731](https://github.com/remix-run/react-router/pull/11731))
|
|
110
|
-
|
|
111
|
-
### Minor Changes
|
|
112
|
-
|
|
113
|
-
- - Add support for `prerender` config in the React Router vite plugin, to support existing SSG use-cases ([#11539](https://github.com/remix-run/react-router/pull/11539))
|
|
114
|
-
- You can use the `prerender` config to pre-render your `.html` and `.data` files at build time and then serve them statically at runtime (either from a running server or a CDN)
|
|
115
|
-
- `prerender` can either be an array of string paths, or a function (sync or async) that returns an array of strings so that you can dynamically generate the paths by talking to your CMS, etc.
|
|
116
|
-
|
|
117
|
-
```ts
|
|
118
|
-
export default defineConfig({
|
|
119
|
-
plugins: [
|
|
120
|
-
reactRouter({
|
|
121
|
-
async prerender() {
|
|
122
|
-
let slugs = await fakeGetSlugsFromCms();
|
|
123
|
-
// Prerender these paths into `.html` files at build time, and `.data`
|
|
124
|
-
// files if they have loaders
|
|
125
|
-
return ["/", "/about", ...slugs.map((slug) => `/product/${slug}`)];
|
|
126
|
-
},
|
|
127
|
-
}),
|
|
128
|
-
tsconfigPaths(),
|
|
129
|
-
],
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
async function fakeGetSlugsFromCms() {
|
|
133
|
-
await new Promise((r) => setTimeout(r, 1000));
|
|
134
|
-
return ["shirt", "hat"];
|
|
135
|
-
}
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
- [REMOVE] Allow returning undefined from loaders/actions part 2 ([#12057](https://github.com/remix-run/react-router/pull/12057))
|
|
139
|
-
|
|
140
|
-
- This is a follow up to #11680 which missed some of the Remix codepaths
|
|
141
|
-
|
|
142
|
-
- Params, loader data, and action data as props for route component exports ([#11961](https://github.com/remix-run/react-router/pull/11961))
|
|
143
|
-
|
|
144
|
-
```tsx
|
|
145
|
-
export default function Component({ params, loaderData, actionData }) {}
|
|
146
|
-
|
|
147
|
-
export function HydrateFallback({ params }) {}
|
|
148
|
-
export function ErrorBoundary({ params, loaderData, actionData }) {}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
- Remove duplicate `RouterProvider` impliementations ([#11679](https://github.com/remix-run/react-router/pull/11679))
|
|
152
|
-
- ### Typesafety improvements ([#12019](https://github.com/remix-run/react-router/pull/12019))
|
|
153
|
-
|
|
154
|
-
React Router now generates types for each of your route modules.
|
|
155
|
-
You can access those types by importing them from `./+types/<route filename without extension>`.
|
|
156
|
-
For example:
|
|
157
|
-
|
|
158
|
-
```ts
|
|
159
|
-
// app/routes/product.tsx
|
|
160
|
-
import type * as Route from "./+types/product";
|
|
161
|
-
|
|
162
|
-
export function loader({ params }: Route.LoaderArgs) {}
|
|
163
|
-
|
|
164
|
-
export default function Component({ loaderData }: Route.ComponentProps) {}
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
This initial implementation targets type inference for:
|
|
168
|
-
|
|
169
|
-
- `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
|
|
170
|
-
- `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
|
|
171
|
-
- `ActionData` : Action data from `action` and/or `clientAction` within your route module
|
|
172
|
-
|
|
173
|
-
These types are then used to create types for route export args and props:
|
|
174
|
-
|
|
175
|
-
- `LoaderArgs`
|
|
176
|
-
- `ClientLoaderArgs`
|
|
177
|
-
- `ActionArgs`
|
|
178
|
-
- `ClientActionArgs`
|
|
179
|
-
- `HydrateFallbackProps`
|
|
180
|
-
- `ComponentProps` (for the `default` export)
|
|
181
|
-
- `ErrorBoundaryProps`
|
|
182
|
-
|
|
183
|
-
In the future, we plan to add types for the rest of the route module exports: `meta`, `links`, `headers`, `shouldRevalidate`, etc.
|
|
184
|
-
We also plan to generate types for typesafe `Link`s:
|
|
185
|
-
|
|
186
|
-
```tsx
|
|
187
|
-
<Link to="/products/:id" params={{ id: 1 }} />
|
|
188
|
-
// ^^^^^^^^^^^^^ ^^^^^^^^^
|
|
189
|
-
// typesafe `to` and `params` based on the available routes in your app
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
#### Setup
|
|
193
|
-
|
|
194
|
-
React Router will generate types into a `.react-router/` directory at the root of your app.
|
|
195
|
-
This directory is fully managed by React Router and is derived based on your route config (`routes.ts`).
|
|
196
|
-
|
|
197
|
-
👉 **Add `.react-router/` to `.gitignore`**
|
|
198
|
-
|
|
199
|
-
```txt
|
|
200
|
-
.react-router
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
You should also ensure that generated types for routes are always present before running typechecking,
|
|
204
|
-
especially for running typechecking in CI.
|
|
205
|
-
|
|
206
|
-
👉 **Add `react-router typegen` to your `typecheck` command in `package.json`**
|
|
207
|
-
|
|
208
|
-
```json
|
|
209
|
-
{
|
|
210
|
-
"scripts": {
|
|
211
|
-
"typecheck": "react-router typegen && tsc"
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
To get TypeScript to use those generated types, you'll need to add them to `include` in `tsconfig.json`.
|
|
217
|
-
And to be able to import them as if they files next to your route modules, you'll also need to configure `rootDirs`.
|
|
218
|
-
|
|
219
|
-
👉 **Configure `tsconfig.json` for generated types**
|
|
220
|
-
|
|
221
|
-
```json
|
|
222
|
-
{
|
|
223
|
-
"include": [".react-router/types/**/*"],
|
|
224
|
-
"compilerOptions": {
|
|
225
|
-
"rootDirs": [".", "./.react-router/types"]
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
#### `typegen` command
|
|
231
|
-
|
|
232
|
-
You can manually generate types with the new `typegen` command:
|
|
233
|
-
|
|
234
|
-
```sh
|
|
235
|
-
react-router typegen
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
However, manual type generation is tedious and types can get out of sync quickly if you ever forget to run `typegen`.
|
|
239
|
-
Instead, we recommend that you setup our new TypeScript plugin which will automatically generate fresh types whenever routes change.
|
|
240
|
-
That way, you'll always have up-to-date types.
|
|
241
|
-
|
|
242
|
-
#### TypeScript plugin
|
|
243
|
-
|
|
244
|
-
To get automatic type generation, you can use our new TypeScript plugin.
|
|
245
|
-
|
|
246
|
-
👉 **Add the TypeScript plugin to `tsconfig.json`**
|
|
247
|
-
|
|
248
|
-
```json
|
|
249
|
-
{
|
|
250
|
-
"compilerOptions": {
|
|
251
|
-
"plugins": [{ "name": "@react-router/dev" }]
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
We plan to add some other goodies to our TypeScript plugin soon, including:
|
|
257
|
-
|
|
258
|
-
- Automatic `jsdoc` for route exports that include links to official docs
|
|
259
|
-
- Autocomplete for route exports
|
|
260
|
-
- Warnings for non-HMR compliant exports
|
|
261
|
-
|
|
262
|
-
##### VSCode
|
|
263
|
-
|
|
264
|
-
TypeScript looks for plugins registered in `tsconfig.json` in the local `node_modules/`,
|
|
265
|
-
but VSCode ships with its own copy of TypeScript that is installed outside of your project.
|
|
266
|
-
For TypeScript plugins to work, you'll need to tell VSCode to use the local workspace version of TypeScript.
|
|
267
|
-
For security reasons, [VSCode won't use the workspace version of TypeScript](https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-the-workspace-version-of-typescript) until you manually opt-in.
|
|
268
|
-
|
|
269
|
-
Your project should have a `.vscode/settings.json` with the following settings:
|
|
270
|
-
|
|
271
|
-
```json
|
|
272
|
-
{
|
|
273
|
-
"typescript.tsdk": "node_modules/typescript/lib",
|
|
274
|
-
"typescript.enablePromptUseWorkspaceTsdk": true
|
|
275
|
-
}
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
That way [VSCode will ask you](https://code.visualstudio.com/updates/v1_45#_prompt-users-to-switch-to-the-workspace-version-of-typescript) if you want to use the workspace version of TypeScript the first time you open a TS file in that project.
|
|
279
|
-
|
|
280
|
-
> [!IMPORTANT]
|
|
281
|
-
> You'll need to install dependencies first so that the workspace version of TypeScript is available.
|
|
282
|
-
|
|
283
|
-
👉 **Select "Allow" when VSCode asks if you want to use the workspace version of TypeScript**
|
|
284
|
-
|
|
285
|
-
Otherwise, you can also manually opt-in to the workspace version:
|
|
286
|
-
|
|
287
|
-
1. Open up any TypeScript file in your project
|
|
288
|
-
2. Open up the VSCode Command Palette (<kbd>Cmd</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>)
|
|
289
|
-
3. Search for `Select TypeScript Version`
|
|
290
|
-
4. Choose `Use Workspace Version`
|
|
291
|
-
5. Quit and reopen VSCode
|
|
292
|
-
|
|
293
|
-
##### Troubleshooting
|
|
294
|
-
|
|
295
|
-
In VSCode, open up any TypeScript file in your project and then use <kbd>CMD</kbd>+<kbd>SHIFT</kbd>+<kbd>P</kbd> to select `Open TS Server log`.
|
|
296
|
-
There should be a log for `[react-router] setup` that indicates that the plugin was resolved correctly.
|
|
297
|
-
Then look for any errors in the log.
|
|
298
|
-
|
|
299
|
-
- Stabilize `unstable_dataStrategy` ([#11969](https://github.com/remix-run/react-router/pull/11969))
|
|
300
|
-
- Stabilize `unstable_patchRoutesOnNavigation` ([#11970](https://github.com/remix-run/react-router/pull/11970))
|
|
301
|
-
|
|
302
|
-
### Patch Changes
|
|
303
|
-
|
|
304
|
-
- Remove unstable upload handler. ([#12015](https://github.com/remix-run/react-router/pull/12015))
|
|
305
|
-
- Fix redirects returned from loaders/actions using `data()` ([#12021](https://github.com/remix-run/react-router/pull/12021))
|
|
306
|
-
- Updated dependencies:
|
|
307
|
-
- `react-router@7.0.0-pre.0`
|
|
308
|
-
|
|
309
3
|
## 6.26.2
|
|
310
4
|
|
|
311
5
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
# React Router
|
|
2
2
|
|
|
3
|
-
The `react-router` package is the heart of [React Router](https://github.com/remix-run/react-router) and provides all
|
|
3
|
+
The `react-router` package is the heart of [React Router](https://github.com/remix-run/react-router) and provides all
|
|
4
|
+
the core functionality for both
|
|
5
|
+
[`react-router-dom`](https://github.com/remix-run/react-router/tree/main/packages/react-router-dom)
|
|
6
|
+
and
|
|
7
|
+
[`react-router-native`](https://github.com/remix-run/react-router/tree/main/packages/react-router-native).
|
|
8
|
+
|
|
9
|
+
If you're using React Router, you should never `import` anything directly from
|
|
10
|
+
the `react-router` package, but you should have everything you need in either
|
|
11
|
+
`react-router-dom` or `react-router-native`. Both of those packages re-export
|
|
12
|
+
everything from `react-router`.
|
|
13
|
+
|
|
14
|
+
If you'd like to extend React Router and you know what you're doing, you should
|
|
15
|
+
add `react-router` **as a peer dependency, not a regular dependency** in your
|
|
16
|
+
package.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,74 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export type {
|
|
13
|
-
export {
|
|
14
|
-
export type
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
export { createMemorySessionStorage } from "./lib/server-runtime/sessions/memoryStorage";
|
|
31
|
-
export { setDevServerHooks as unstable_setDevServerHooks } from "./lib/server-runtime/dev";
|
|
32
|
-
export type { IsCookieFunction } from "./lib/server-runtime/cookies";
|
|
33
|
-
export type { CreateRequestHandlerFunction } from "./lib/server-runtime/server";
|
|
34
|
-
export type { IsSessionFunction } from "./lib/server-runtime/sessions";
|
|
35
|
-
export type { HandleDataRequestFunction, HandleDocumentRequestFunction, HandleErrorFunction, ServerBuild, ServerEntryModule, } from "./lib/server-runtime/build";
|
|
36
|
-
export type { Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, } from "./lib/server-runtime/cookies";
|
|
37
|
-
export type { AppLoadContext } from "./lib/server-runtime/data";
|
|
38
|
-
export type { PageLinkDescriptor, HtmlLinkDescriptor, LinkDescriptor, } from "./lib/router/links";
|
|
39
|
-
export type { TypedResponse } from "./lib/server-runtime/responses";
|
|
40
|
-
export type { DataFunctionArgs, HeadersArgs, HeadersFunction, } from "./lib/server-runtime/routeModules";
|
|
41
|
-
export type { RequestHandler } from "./lib/server-runtime/server";
|
|
42
|
-
export type { Session, SessionData, SessionIdStorageStrategy, SessionStorage, FlashSessionData, } from "./lib/server-runtime/sessions";
|
|
43
|
-
/** @internal */
|
|
44
|
-
export { createBrowserHistory as UNSAFE_createBrowserHistory, invariant as UNSAFE_invariant, } from "./lib/router/history";
|
|
45
|
-
/** @internal */
|
|
46
|
-
export { createRouter as UNSAFE_createRouter } from "./lib/router/router";
|
|
47
|
-
/** @internal */
|
|
48
|
-
export { ErrorResponseImpl as UNSAFE_ErrorResponseImpl } from "./lib/router/utils";
|
|
49
|
-
/** @internal */
|
|
50
|
-
export { DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, FetchersContext as UNSAFE_FetchersContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, ViewTransitionContext as UNSAFE_ViewTransitionContext, } from "./lib/context";
|
|
51
|
-
/** @internal */
|
|
52
|
-
export { mapRouteProperties as UNSAFE_mapRouteProperties } from "./lib/components";
|
|
53
|
-
/** @internal */
|
|
54
|
-
export { FrameworkContext as UNSAFE_FrameworkContext } from "./lib/dom/ssr/components";
|
|
55
|
-
/** @internal */
|
|
56
|
-
export type { AssetsManifest as UNSAFE_AssetsManifest } from "./lib/dom/ssr/entry";
|
|
57
|
-
/** @internal */
|
|
58
|
-
export { deserializeErrors as UNSAFE_deserializeErrors } from "./lib/dom/ssr/errors";
|
|
59
|
-
/** @internal */
|
|
60
|
-
export { RemixErrorBoundary as UNSAFE_RemixErrorBoundary } from "./lib/dom/ssr/errorBoundaries";
|
|
61
|
-
/** @internal */
|
|
62
|
-
export { getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, } from "./lib/dom/ssr/fog-of-war";
|
|
63
|
-
/** @internal */
|
|
64
|
-
export type { RouteModules as UNSAFE_RouteModules } from "./lib/dom/ssr/routeModules";
|
|
65
|
-
/** @internal */
|
|
66
|
-
export { createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, } from "./lib/dom/ssr/routes";
|
|
67
|
-
/** @internal */
|
|
68
|
-
export { getSingleFetchDataStrategy as UNSAFE_getSingleFetchDataStrategy } from "./lib/dom/ssr/single-fetch";
|
|
69
|
-
/** @internal */
|
|
70
|
-
export { decodeViaTurboStream as UNSAFE_decodeViaTurboStream, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, } from "./lib/dom/ssr/single-fetch";
|
|
71
|
-
/** @internal */
|
|
72
|
-
export { ServerMode as UNSAFE_ServerMode } from "./lib/server-runtime/mode";
|
|
73
|
-
/** @internal */
|
|
74
|
-
export { useScrollRestoration as UNSAFE_useScrollRestoration } from "./lib/dom/lib";
|
|
1
|
+
import type { ActionFunction, ActionFunctionArgs, AgnosticPatchRoutesOnNavigationFunction, AgnosticPatchRoutesOnNavigationFunctionArgs, Blocker, BlockerFunction, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, ErrorResponse, Fetcher, HydrationState, InitialEntry, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, Navigation, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, RedirectFunction, RelativeRoutingType, Router as RemixRouter, FutureConfig as RouterFutureConfig, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch } from "@remix-run/router";
|
|
2
|
+
import { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, replace, resolvePath } from "@remix-run/router";
|
|
3
|
+
import type { AwaitProps, FutureConfig, IndexRouteProps, LayoutRouteProps, MemoryRouterProps, NavigateProps, OutletProps, PathRouteProps, RouteProps, RouterProps, RouterProviderProps, RoutesProps } from "./lib/components";
|
|
4
|
+
import { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, createRoutesFromChildren, renderMatches } from "./lib/components";
|
|
5
|
+
import type { DataRouteMatch, DataRouteObject, IndexRouteObject, NavigateOptions, Navigator, NonIndexRouteObject, RouteMatch, RouteObject } from "./lib/context";
|
|
6
|
+
import { DataRouterContext, DataRouterStateContext, LocationContext, NavigationContext, RouteContext } from "./lib/context";
|
|
7
|
+
import type { NavigateFunction } from "./lib/hooks";
|
|
8
|
+
import { useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteId, useRouteLoaderData, useRoutes, useRoutesImpl } from "./lib/hooks";
|
|
9
|
+
type Hash = string;
|
|
10
|
+
type Pathname = string;
|
|
11
|
+
type Search = string;
|
|
12
|
+
export type { ActionFunction, ActionFunctionArgs, AwaitProps, DataRouteMatch, DataRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, ErrorResponse, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, PathRouteProps, Pathname, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, Blocker, BlockerFunction, };
|
|
13
|
+
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, createPath, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, replace, renderMatches, resolvePath, useBlocker, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, };
|
|
14
|
+
export type PatchRoutesOnNavigationFunctionArgs = AgnosticPatchRoutesOnNavigationFunctionArgs<RouteObject, RouteMatch>;
|
|
15
|
+
export type PatchRoutesOnNavigationFunction = AgnosticPatchRoutesOnNavigationFunction<RouteObject, RouteMatch>;
|
|
16
|
+
declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
|
|
17
|
+
hasErrorBoundary: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare function createMemoryRouter(routes: RouteObject[], opts?: {
|
|
20
|
+
basename?: string;
|
|
21
|
+
future?: Partial<Omit<RouterFutureConfig, "v7_prependBasename">>;
|
|
22
|
+
hydrationData?: HydrationState;
|
|
23
|
+
initialEntries?: InitialEntry[];
|
|
24
|
+
initialIndex?: number;
|
|
25
|
+
dataStrategy?: DataStrategyFunction;
|
|
26
|
+
patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
|
|
27
|
+
}): RemixRouter;
|
|
28
|
+
/** @internal */
|
|
29
|
+
export { DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, mapRouteProperties as UNSAFE_mapRouteProperties, useRouteId as UNSAFE_useRouteId, useRoutesImpl as UNSAFE_useRoutesImpl, };
|