@react-router/dev 7.0.0-pre.5 → 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 CHANGED
@@ -1,71 +1,6 @@
1
- # `@remix-run/dev`
1
+ # `@react-router/dev`
2
2
 
3
- ## 7.0.0-pre.5
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies:
8
- - `react-router@7.0.0-pre.5`
9
- - `@react-router/node@7.0.0-pre.5`
10
- - `@react-router/serve@7.0.0-pre.5`
11
-
12
- ## 7.0.0-pre.4
13
-
14
- ### Patch Changes
15
-
16
- - Updated dependencies:
17
- - `react-router@7.0.0-pre.4`
18
- - `@react-router/node@7.0.0-pre.4`
19
- - `@react-router/serve@7.0.0-pre.4`
20
-
21
- ## 7.0.0-pre.3
22
-
23
- ### Patch Changes
24
-
25
- - Enable prerendering for resource routes ([#12200](https://github.com/remix-run/react-router/pull/12200))
26
- - resolve config directory relative to flat output file structure ([#12187](https://github.com/remix-run/react-router/pull/12187))
27
- - Updated dependencies:
28
- - `react-router@7.0.0-pre.3`
29
- - `@react-router/node@7.0.0-pre.3`
30
- - `@react-router/serve@7.0.0-pre.3`
31
-
32
- ## 7.0.0-pre.2
33
-
34
- ### Major Changes
35
-
36
- - - 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))
37
- - Examples: `LoaderFunction`, `LoaderFunctionArgs`, `ActionFunction`, `ActionFunctionArgs`, `DataFunctionArgs`, `RouteManifest`, `LinksFunction`, `Route`, `EntryRoute`
38
- - The `RouteManifest` type used by the "remix" code is now slightly stricter because it is using the former `@remix-run/router` `RouteManifest`
39
- - `Record<string, Route> -> Record<string, Route | undefined>`
40
- - Removed `AppData` type in favor of inlining `unknown` in the few locations it was used
41
- - Removed `ServerRuntimeMeta*` types in favor of the `Meta*` types they were duplicated from
42
- - Drop support for Node 18, update minimum Node vestion to 20 ([#12171](https://github.com/remix-run/react-router/pull/12171))
43
-
44
- - Remove `installGlobals()` as this should no longer be necessary
45
-
46
- ### Patch Changes
47
-
48
- - Updated dependencies:
49
- - `react-router@7.0.0-pre.2`
50
- - `@react-router/node@7.0.0-pre.2`
51
- - `@react-router/serve@7.0.0-pre.2`
52
-
53
- ## 7.0.0-pre.1
54
-
55
- ### Minor Changes
56
-
57
- - Add `prefix` route config helper to `@react-router/dev/routes` ([#12094](https://github.com/remix-run/react-router/pull/12094))
58
-
59
- ### Patch Changes
60
-
61
- - - 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))
62
- - Proxy prerendered loader data into prerender pass for HTML files to avoid double-invocations of the loader at build time
63
- - Updated dependencies:
64
- - `react-router@7.0.0-pre.1`
65
- - `@react-router/serve@7.0.0-pre.1`
66
- - `@react-router/node@7.0.0-pre.1`
67
-
68
- ## 7.0.0-pre.0
3
+ ## 7.0.0
69
4
 
70
5
  ### Major Changes
71
6
 
@@ -82,35 +17,45 @@
82
17
  ```
83
18
 
84
19
  - Remove single_fetch future flag. ([#11522](https://github.com/remix-run/react-router/pull/11522))
20
+
85
21
  - update minimum node version to 18 ([#11690](https://github.com/remix-run/react-router/pull/11690))
22
+
86
23
  - Add `exports` field to all packages ([#11675](https://github.com/remix-run/react-router/pull/11675))
24
+
87
25
  - node package no longer re-exports from react-router ([#11702](https://github.com/remix-run/react-router/pull/11702))
26
+
88
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
+
89
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))
90
30
 
91
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.
92
32
 
93
33
  If you were using the `manifest` option, you can replace it with a `buildEnd` hook that writes the manifest to disk like this:
94
34
 
95
- ```js
96
- import { reactRouter } from "@react-router/dev/vite";
35
+ ```ts
36
+ // react-router.config.ts
37
+ import type { Config } from "@react-router/dev/config";
97
38
  import { writeFile } from "node:fs/promises";
98
39
 
99
40
  export default {
100
- plugins: [
101
- reactRouter({
102
- async buildEnd({ buildManifest }) {
103
- await writeFile(
104
- "build/manifest.json",
105
- JSON.stringify(buildManifest, null, 2),
106
- "utf-8"
107
- );
108
- },
109
- }),
110
- ],
111
- };
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;
112
49
  ```
113
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
+
114
59
  - Update default `isbot` version to v5 and drop support for `isbot@3` ([#11770](https://github.com/remix-run/react-router/pull/11770))
115
60
 
116
61
  - If you have `isbot@4` or `isbot@5` in your `package.json`:
@@ -121,6 +66,10 @@
121
66
  - If you have `isbot@3` in your `package.json` and you do not have your own `entry.server.tsx` file in your repo
122
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`
123
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
+
124
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))
125
74
 
126
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.
@@ -137,6 +86,9 @@
137
86
  ```
138
87
 
139
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
+
140
92
  - ### Typesafety improvements ([#12019](https://github.com/remix-run/react-router/pull/12019))
141
93
 
142
94
  React Router now generates types for each of your route modules.
@@ -158,16 +110,6 @@
158
110
  - `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
159
111
  - `ActionData` : Action data from `action` and/or `clientAction` within your route module
160
112
 
161
- These types are then used to create types for route export args and props:
162
-
163
- - `LoaderArgs`
164
- - `ClientLoaderArgs`
165
- - `ActionArgs`
166
- - `ClientActionArgs`
167
- - `HydrateFallbackProps`
168
- - `ComponentProps` (for the `default` export)
169
- - `ErrorBoundaryProps`
170
-
171
113
  In the future, we plan to add types for the rest of the route module exports: `meta`, `links`, `headers`, `shouldRevalidate`, etc.
172
114
  We also plan to generate types for typesafe `Link`s:
173
115
 
@@ -177,120 +119,24 @@
177
119
  // typesafe `to` and `params` based on the available routes in your app
178
120
  ```
179
121
 
180
- #### Setup
181
-
182
- React Router will generate types into a `.react-router/` directory at the root of your app.
183
- This directory is fully managed by React Router and is derived based on your route config (`routes.ts`).
184
-
185
- 👉 **Add `.react-router/` to `.gitignore`**
186
-
187
- ```txt
188
- .react-router
189
- ```
190
-
191
- You should also ensure that generated types for routes are always present before running typechecking,
192
- especially for running typechecking in CI.
193
-
194
- 👉 **Add `react-router typegen` to your `typecheck` command in `package.json`**
195
-
196
- ```json
197
- {
198
- "scripts": {
199
- "typecheck": "react-router typegen && tsc"
200
- }
201
- }
202
- ```
203
-
204
- To get TypeScript to use those generated types, you'll need to add them to `include` in `tsconfig.json`.
205
- And to be able to import them as if they files next to your route modules, you'll also need to configure `rootDirs`.
206
-
207
- 👉 **Configure `tsconfig.json` for generated types**
208
-
209
- ```json
210
- {
211
- "include": [".react-router/types/**/*"],
212
- "compilerOptions": {
213
- "rootDirs": [".", "./.react-router/types"]
214
- }
215
- }
216
- ```
217
-
218
- #### `typegen` command
219
-
220
- You can manually generate types with the new `typegen` command:
221
-
222
- ```sh
223
- react-router typegen
224
- ```
225
-
226
- However, manual type generation is tedious and types can get out of sync quickly if you ever forget to run `typegen`.
227
- Instead, we recommend that you setup our new TypeScript plugin which will automatically generate fresh types whenever routes change.
228
- That way, you'll always have up-to-date types.
229
-
230
- #### TypeScript plugin
231
-
232
- To get automatic type generation, you can use our new TypeScript plugin.
233
-
234
- 👉 **Add the TypeScript plugin to `tsconfig.json`**
235
-
236
- ```json
237
- {
238
- "compilerOptions": {
239
- "plugins": [{ "name": "@react-router/dev" }]
240
- }
241
- }
242
- ```
243
-
244
- We plan to add some other goodies to our TypeScript plugin soon, including:
245
-
246
- - Automatic `jsdoc` for route exports that include links to official docs
247
- - Autocomplete for route exports
248
- - Warnings for non-HMR compliant exports
249
-
250
- ##### VSCode
251
-
252
- TypeScript looks for plugins registered in `tsconfig.json` in the local `node_modules/`,
253
- but VSCode ships with its own copy of TypeScript that is installed outside of your project.
254
- For TypeScript plugins to work, you'll need to tell VSCode to use the local workspace version of TypeScript.
255
- 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.
256
-
257
- Your project should have a `.vscode/settings.json` with the following settings:
258
-
259
- ```json
260
- {
261
- "typescript.tsdk": "node_modules/typescript/lib",
262
- "typescript.enablePromptUseWorkspaceTsdk": true
263
- }
264
- ```
265
-
266
- 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.
122
+ Check out our docs for more:
267
123
 
268
- > [!IMPORTANT]
269
- > You'll need to install dependencies first so that the workspace version of TypeScript is available.
270
-
271
- 👉 **Select "Allow" when VSCode asks if you want to use the workspace version of TypeScript**
272
-
273
- Otherwise, you can also manually opt-in to the workspace version:
274
-
275
- 1. Open up any TypeScript file in your project
276
- 2. Open up the VSCode Command Palette (<kbd>Cmd</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>)
277
- 3. Search for `Select TypeScript Version`
278
- 4. Choose `Use Workspace Version`
279
- 5. Quit and reopen VSCode
280
-
281
- ##### Troubleshooting
282
-
283
- 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`.
284
- There should be a log for `[react-router] setup` that indicates that the plugin was resolved correctly.
285
- 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)
286
126
 
287
127
  ### Patch Changes
288
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))
289
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))
290
136
  - Updated dependencies:
291
- - `react-router@7.0.0-pre.0`
292
- - `@react-router/serve@7.0.0-pre.0`
293
- - `@react-router/node@7.0.0-pre.0`
137
+ - `react-router@7.0.0`
138
+ - `@react-router/serve@7.0.0`
139
+ - `@react-router/node@7.0.0`
294
140
 
295
141
  ## 2.9.0
296
142