@react-router/dev 7.0.0-pre.6 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -212
- package/dist/cli/index.js +1 -1
- package/dist/config.js +1 -1
- package/dist/routes.js +1 -1
- package/dist/vite/cloudflare.js +1 -1
- package/dist/vite.js +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,84 +1,6 @@
|
|
|
1
|
-
# `@
|
|
1
|
+
# `@react-router/dev`
|
|
2
2
|
|
|
3
|
-
## 7.0.0
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- chore: warn instead of error for min node version in CLI ([#12270](https://github.com/remix-run/react-router/pull/12270))
|
|
8
|
-
- chore: re-enable development warnings through a `development` exports condition. ([#12269](https://github.com/remix-run/react-router/pull/12269))
|
|
9
|
-
- if we are in SAP mode, always render the `index.html` for hydration ([#12268](https://github.com/remix-run/react-router/pull/12268))
|
|
10
|
-
- fix(react-router): (v7) fix static prerender of non-ascii characters ([#12161](https://github.com/remix-run/react-router/pull/12161))
|
|
11
|
-
- Updated dependencies:
|
|
12
|
-
- `@react-router/node@7.0.0-pre.6`
|
|
13
|
-
- `react-router@7.0.0-pre.6`
|
|
14
|
-
- `@react-router/serve@7.0.0-pre.6`
|
|
15
|
-
|
|
16
|
-
## 7.0.0-pre.5
|
|
17
|
-
|
|
18
|
-
### Patch Changes
|
|
19
|
-
|
|
20
|
-
- Updated dependencies:
|
|
21
|
-
- `react-router@7.0.0-pre.5`
|
|
22
|
-
- `@react-router/node@7.0.0-pre.5`
|
|
23
|
-
- `@react-router/serve@7.0.0-pre.5`
|
|
24
|
-
|
|
25
|
-
## 7.0.0-pre.4
|
|
26
|
-
|
|
27
|
-
### Patch Changes
|
|
28
|
-
|
|
29
|
-
- Updated dependencies:
|
|
30
|
-
- `react-router@7.0.0-pre.4`
|
|
31
|
-
- `@react-router/node@7.0.0-pre.4`
|
|
32
|
-
- `@react-router/serve@7.0.0-pre.4`
|
|
33
|
-
|
|
34
|
-
## 7.0.0-pre.3
|
|
35
|
-
|
|
36
|
-
### Patch Changes
|
|
37
|
-
|
|
38
|
-
- Enable prerendering for resource routes ([#12200](https://github.com/remix-run/react-router/pull/12200))
|
|
39
|
-
- resolve config directory relative to flat output file structure ([#12187](https://github.com/remix-run/react-router/pull/12187))
|
|
40
|
-
- Updated dependencies:
|
|
41
|
-
- `react-router@7.0.0-pre.3`
|
|
42
|
-
- `@react-router/node@7.0.0-pre.3`
|
|
43
|
-
- `@react-router/serve@7.0.0-pre.3`
|
|
44
|
-
|
|
45
|
-
## 7.0.0-pre.2
|
|
46
|
-
|
|
47
|
-
### Major Changes
|
|
48
|
-
|
|
49
|
-
- - 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))
|
|
50
|
-
- Examples: `LoaderFunction`, `LoaderFunctionArgs`, `ActionFunction`, `ActionFunctionArgs`, `DataFunctionArgs`, `RouteManifest`, `LinksFunction`, `Route`, `EntryRoute`
|
|
51
|
-
- The `RouteManifest` type used by the "remix" code is now slightly stricter because it is using the former `@remix-run/router` `RouteManifest`
|
|
52
|
-
- `Record<string, Route> -> Record<string, Route | undefined>`
|
|
53
|
-
- Removed `AppData` type in favor of inlining `unknown` in the few locations it was used
|
|
54
|
-
- Removed `ServerRuntimeMeta*` types in favor of the `Meta*` types they were duplicated from
|
|
55
|
-
- Drop support for Node 18, update minimum Node vestion to 20 ([#12171](https://github.com/remix-run/react-router/pull/12171))
|
|
56
|
-
|
|
57
|
-
- Remove `installGlobals()` as this should no longer be necessary
|
|
58
|
-
|
|
59
|
-
### Patch Changes
|
|
60
|
-
|
|
61
|
-
- Updated dependencies:
|
|
62
|
-
- `react-router@7.0.0-pre.2`
|
|
63
|
-
- `@react-router/node@7.0.0-pre.2`
|
|
64
|
-
- `@react-router/serve@7.0.0-pre.2`
|
|
65
|
-
|
|
66
|
-
## 7.0.0-pre.1
|
|
67
|
-
|
|
68
|
-
### Minor Changes
|
|
69
|
-
|
|
70
|
-
- Add `prefix` route config helper to `@react-router/dev/routes` ([#12094](https://github.com/remix-run/react-router/pull/12094))
|
|
71
|
-
|
|
72
|
-
### Patch Changes
|
|
73
|
-
|
|
74
|
-
- - 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))
|
|
75
|
-
- Proxy prerendered loader data into prerender pass for HTML files to avoid double-invocations of the loader at build time
|
|
76
|
-
- Updated dependencies:
|
|
77
|
-
- `react-router@7.0.0-pre.1`
|
|
78
|
-
- `@react-router/serve@7.0.0-pre.1`
|
|
79
|
-
- `@react-router/node@7.0.0-pre.1`
|
|
80
|
-
|
|
81
|
-
## 7.0.0-pre.0
|
|
3
|
+
## 7.0.0
|
|
82
4
|
|
|
83
5
|
### Major Changes
|
|
84
6
|
|
|
@@ -95,35 +17,45 @@
|
|
|
95
17
|
```
|
|
96
18
|
|
|
97
19
|
- Remove single_fetch future flag. ([#11522](https://github.com/remix-run/react-router/pull/11522))
|
|
20
|
+
|
|
98
21
|
- update minimum node version to 18 ([#11690](https://github.com/remix-run/react-router/pull/11690))
|
|
22
|
+
|
|
99
23
|
- Add `exports` field to all packages ([#11675](https://github.com/remix-run/react-router/pull/11675))
|
|
24
|
+
|
|
100
25
|
- node package no longer re-exports from react-router ([#11702](https://github.com/remix-run/react-router/pull/11702))
|
|
26
|
+
|
|
101
27
|
- For Remix consumers migrating to React Router who used the Vite plugin's `buildEnd` hook, the resolved `reactRouterConfig` object no longer contains a `publicPath` property since this belongs to Vite, not React Router. ([#11575](https://github.com/remix-run/react-router/pull/11575))
|
|
28
|
+
|
|
102
29
|
- For Remix consumers migrating to React Router, the Vite plugin's `manifest` option has been removed. ([#11573](https://github.com/remix-run/react-router/pull/11573))
|
|
103
30
|
|
|
104
31
|
The `manifest` option been superseded by the more powerful `buildEnd` hook since it's passed the `buildManifest` argument. You can still write the build manifest to disk if needed, but you'll most likely find it more convenient to write any logic depending on the build manifest within the `buildEnd` hook itself.
|
|
105
32
|
|
|
106
33
|
If you were using the `manifest` option, you can replace it with a `buildEnd` hook that writes the manifest to disk like this:
|
|
107
34
|
|
|
108
|
-
```
|
|
109
|
-
|
|
35
|
+
```ts
|
|
36
|
+
// react-router.config.ts
|
|
37
|
+
import type { Config } from "@react-router/dev/config";
|
|
110
38
|
import { writeFile } from "node:fs/promises";
|
|
111
39
|
|
|
112
40
|
export default {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
}),
|
|
123
|
-
],
|
|
124
|
-
};
|
|
41
|
+
async buildEnd({ buildManifest }) {
|
|
42
|
+
await writeFile(
|
|
43
|
+
"build/manifest.json",
|
|
44
|
+
JSON.stringify(buildManifest, null, 2),
|
|
45
|
+
"utf-8"
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
} satisfies Config;
|
|
125
49
|
```
|
|
126
50
|
|
|
51
|
+
- 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))
|
|
52
|
+
|
|
53
|
+
- Examples: `LoaderFunction`, `LoaderFunctionArgs`, `ActionFunction`, `ActionFunctionArgs`, `DataFunctionArgs`, `RouteManifest`, `LinksFunction`, `Route`, `EntryRoute`
|
|
54
|
+
- The `RouteManifest` type used by the "remix" code is now slightly stricter because it is using the former `@remix-run/router` `RouteManifest`
|
|
55
|
+
- `Record<string, Route> -> Record<string, Route | undefined>`
|
|
56
|
+
- Removed `AppData` type in favor of inlining `unknown` in the few locations it was used
|
|
57
|
+
- Removed `ServerRuntimeMeta*` types in favor of the `Meta*` types they were duplicated from
|
|
58
|
+
|
|
127
59
|
- Update default `isbot` version to v5 and drop support for `isbot@3` ([#11770](https://github.com/remix-run/react-router/pull/11770))
|
|
128
60
|
|
|
129
61
|
- If you have `isbot@4` or `isbot@5` in your `package.json`:
|
|
@@ -134,6 +66,10 @@
|
|
|
134
66
|
- If you have `isbot@3` in your `package.json` and you do not have your own `entry.server.tsx` file in your repo
|
|
135
67
|
- You are using the internal default entry provided by React Router v7 and you will need to upgrade to `isbot@5` in your `package.json`
|
|
136
68
|
|
|
69
|
+
- Drop support for Node 18, update minimum Node vestion to 20 ([#12171](https://github.com/remix-run/react-router/pull/12171))
|
|
70
|
+
|
|
71
|
+
- Remove `installGlobals()` as this should no longer be necessary
|
|
72
|
+
|
|
137
73
|
- For Remix consumers migrating to React Router, Vite manifests (i.e. `.vite/manifest.json`) are now written within each build subdirectory, e.g. `build/client/.vite/manifest.json` and `build/server/.vite/manifest.json` instead of `build/.vite/client-manifest.json` and `build/.vite/server-manifest.json`. This means that the build output is now much closer to what you'd expect from a typical Vite project. ([#11573](https://github.com/remix-run/react-router/pull/11573))
|
|
138
74
|
|
|
139
75
|
Originally the Remix Vite plugin moved all Vite manifests to a root-level `build/.vite` directory to avoid accidentally serving them in production, particularly from the client build. This was later improved with additional logic that deleted these Vite manifest files at the end of the build process unless Vite's `build.manifest` had been enabled within the app's Vite config. This greatly reduced the risk of accidentally serving the Vite manifests in production since they're only present when explicitly asked for. As a result, we can now assume that consumers will know that they need to manage these additional files themselves, and React Router can safely generate a more standard Vite build output.
|
|
@@ -150,6 +86,9 @@
|
|
|
150
86
|
```
|
|
151
87
|
|
|
152
88
|
- Remove internal entry.server.spa.tsx implementation ([#11681](https://github.com/remix-run/react-router/pull/11681))
|
|
89
|
+
|
|
90
|
+
- Add `prefix` route config helper to `@react-router/dev/routes` ([#12094](https://github.com/remix-run/react-router/pull/12094))
|
|
91
|
+
|
|
153
92
|
- ### Typesafety improvements ([#12019](https://github.com/remix-run/react-router/pull/12019))
|
|
154
93
|
|
|
155
94
|
React Router now generates types for each of your route modules.
|
|
@@ -171,16 +110,6 @@
|
|
|
171
110
|
- `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
|
|
172
111
|
- `ActionData` : Action data from `action` and/or `clientAction` within your route module
|
|
173
112
|
|
|
174
|
-
These types are then used to create types for route export args and props:
|
|
175
|
-
|
|
176
|
-
- `LoaderArgs`
|
|
177
|
-
- `ClientLoaderArgs`
|
|
178
|
-
- `ActionArgs`
|
|
179
|
-
- `ClientActionArgs`
|
|
180
|
-
- `HydrateFallbackProps`
|
|
181
|
-
- `ComponentProps` (for the `default` export)
|
|
182
|
-
- `ErrorBoundaryProps`
|
|
183
|
-
|
|
184
113
|
In the future, we plan to add types for the rest of the route module exports: `meta`, `links`, `headers`, `shouldRevalidate`, etc.
|
|
185
114
|
We also plan to generate types for typesafe `Link`s:
|
|
186
115
|
|
|
@@ -190,120 +119,24 @@
|
|
|
190
119
|
// typesafe `to` and `params` based on the available routes in your app
|
|
191
120
|
```
|
|
192
121
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
React Router will generate types into a `.react-router/` directory at the root of your app.
|
|
196
|
-
This directory is fully managed by React Router and is derived based on your route config (`routes.ts`).
|
|
197
|
-
|
|
198
|
-
👉 **Add `.react-router/` to `.gitignore`**
|
|
199
|
-
|
|
200
|
-
```txt
|
|
201
|
-
.react-router
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
You should also ensure that generated types for routes are always present before running typechecking,
|
|
205
|
-
especially for running typechecking in CI.
|
|
206
|
-
|
|
207
|
-
👉 **Add `react-router typegen` to your `typecheck` command in `package.json`**
|
|
208
|
-
|
|
209
|
-
```json
|
|
210
|
-
{
|
|
211
|
-
"scripts": {
|
|
212
|
-
"typecheck": "react-router typegen && tsc"
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
To get TypeScript to use those generated types, you'll need to add them to `include` in `tsconfig.json`.
|
|
218
|
-
And to be able to import them as if they files next to your route modules, you'll also need to configure `rootDirs`.
|
|
219
|
-
|
|
220
|
-
👉 **Configure `tsconfig.json` for generated types**
|
|
221
|
-
|
|
222
|
-
```json
|
|
223
|
-
{
|
|
224
|
-
"include": [".react-router/types/**/*"],
|
|
225
|
-
"compilerOptions": {
|
|
226
|
-
"rootDirs": [".", "./.react-router/types"]
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
#### `typegen` command
|
|
232
|
-
|
|
233
|
-
You can manually generate types with the new `typegen` command:
|
|
234
|
-
|
|
235
|
-
```sh
|
|
236
|
-
react-router typegen
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
However, manual type generation is tedious and types can get out of sync quickly if you ever forget to run `typegen`.
|
|
240
|
-
Instead, we recommend that you setup our new TypeScript plugin which will automatically generate fresh types whenever routes change.
|
|
241
|
-
That way, you'll always have up-to-date types.
|
|
242
|
-
|
|
243
|
-
#### TypeScript plugin
|
|
244
|
-
|
|
245
|
-
To get automatic type generation, you can use our new TypeScript plugin.
|
|
246
|
-
|
|
247
|
-
👉 **Add the TypeScript plugin to `tsconfig.json`**
|
|
248
|
-
|
|
249
|
-
```json
|
|
250
|
-
{
|
|
251
|
-
"compilerOptions": {
|
|
252
|
-
"plugins": [{ "name": "@react-router/dev" }]
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
We plan to add some other goodies to our TypeScript plugin soon, including:
|
|
258
|
-
|
|
259
|
-
- Automatic `jsdoc` for route exports that include links to official docs
|
|
260
|
-
- Autocomplete for route exports
|
|
261
|
-
- Warnings for non-HMR compliant exports
|
|
122
|
+
Check out our docs for more:
|
|
262
123
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
TypeScript looks for plugins registered in `tsconfig.json` in the local `node_modules/`,
|
|
266
|
-
but VSCode ships with its own copy of TypeScript that is installed outside of your project.
|
|
267
|
-
For TypeScript plugins to work, you'll need to tell VSCode to use the local workspace version of TypeScript.
|
|
268
|
-
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.
|
|
269
|
-
|
|
270
|
-
Your project should have a `.vscode/settings.json` with the following settings:
|
|
271
|
-
|
|
272
|
-
```json
|
|
273
|
-
{
|
|
274
|
-
"typescript.tsdk": "node_modules/typescript/lib",
|
|
275
|
-
"typescript.enablePromptUseWorkspaceTsdk": true
|
|
276
|
-
}
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
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.
|
|
280
|
-
|
|
281
|
-
> [!IMPORTANT]
|
|
282
|
-
> You'll need to install dependencies first so that the workspace version of TypeScript is available.
|
|
283
|
-
|
|
284
|
-
👉 **Select "Allow" when VSCode asks if you want to use the workspace version of TypeScript**
|
|
285
|
-
|
|
286
|
-
Otherwise, you can also manually opt-in to the workspace version:
|
|
287
|
-
|
|
288
|
-
1. Open up any TypeScript file in your project
|
|
289
|
-
2. Open up the VSCode Command Palette (<kbd>Cmd</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>)
|
|
290
|
-
3. Search for `Select TypeScript Version`
|
|
291
|
-
4. Choose `Use Workspace Version`
|
|
292
|
-
5. Quit and reopen VSCode
|
|
293
|
-
|
|
294
|
-
##### Troubleshooting
|
|
295
|
-
|
|
296
|
-
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`.
|
|
297
|
-
There should be a log for `[react-router] setup` that indicates that the plugin was resolved correctly.
|
|
298
|
-
Then look for any errors in the log.
|
|
124
|
+
- [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
|
|
125
|
+
- [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
|
|
299
126
|
|
|
300
127
|
### Patch Changes
|
|
301
128
|
|
|
129
|
+
- Enable prerendering for resource routes ([#12200](https://github.com/remix-run/react-router/pull/12200))
|
|
130
|
+
- chore: warn instead of error for min node version in CLI ([#12270](https://github.com/remix-run/react-router/pull/12270))
|
|
131
|
+
- chore: re-enable development warnings through a `development` exports condition. ([#12269](https://github.com/remix-run/react-router/pull/12269))
|
|
302
132
|
- include root "react-dom" module for optimization ([#12060](https://github.com/remix-run/react-router/pull/12060))
|
|
133
|
+
- resolve config directory relative to flat output file structure ([#12187](https://github.com/remix-run/react-router/pull/12187))
|
|
134
|
+
- if we are in SAP mode, always render the `index.html` for hydration ([#12268](https://github.com/remix-run/react-router/pull/12268))
|
|
135
|
+
- fix(react-router): (v7) fix static prerender of non-ascii characters ([#12161](https://github.com/remix-run/react-router/pull/12161))
|
|
303
136
|
- Updated dependencies:
|
|
304
|
-
- `react-router@7.0.0
|
|
305
|
-
- `@react-router/serve@7.0.0
|
|
306
|
-
- `@react-router/node@7.0.0
|
|
137
|
+
- `react-router@7.0.0`
|
|
138
|
+
- `@react-router/serve@7.0.0`
|
|
139
|
+
- `@react-router/node@7.0.0`
|
|
307
140
|
|
|
308
141
|
## 2.9.0
|
|
309
142
|
|
package/dist/cli/index.js
CHANGED
package/dist/config.js
CHANGED
package/dist/routes.js
CHANGED
package/dist/vite/cloudflare.js
CHANGED
package/dist/vite.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-router/dev",
|
|
3
|
-
"version": "7.0.0
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Dev tools and CLI for React Router",
|
|
5
5
|
"homepage": "https://reactrouter.com",
|
|
6
6
|
"bugs": {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"set-cookie-parser": "^2.6.0",
|
|
82
82
|
"valibot": "^0.41.0",
|
|
83
83
|
"vite-node": "^1.6.0",
|
|
84
|
-
"@react-router/node": "7.0.0
|
|
84
|
+
"@react-router/node": "7.0.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@types/babel__core": "^7.20.5",
|
|
@@ -110,15 +110,15 @@
|
|
|
110
110
|
"vite": "^5.1.0",
|
|
111
111
|
"wireit": "0.14.9",
|
|
112
112
|
"wrangler": "^3.28.2",
|
|
113
|
-
"@react-router/serve": "7.0.0
|
|
114
|
-
"react-router": "^7.0.0
|
|
113
|
+
"@react-router/serve": "7.0.0",
|
|
114
|
+
"react-router": "^7.0.0"
|
|
115
115
|
},
|
|
116
116
|
"peerDependencies": {
|
|
117
117
|
"typescript": "^5.1.0",
|
|
118
118
|
"vite": "^5.1.0",
|
|
119
119
|
"wrangler": "^3.28.2",
|
|
120
|
-
"@react-router/serve": "^7.0.0
|
|
121
|
-
"react-router": "^7.0.0
|
|
120
|
+
"@react-router/serve": "^7.0.0",
|
|
121
|
+
"react-router": "^7.0.0"
|
|
122
122
|
},
|
|
123
123
|
"peerDependenciesMeta": {
|
|
124
124
|
"@react-router/serve": {
|