@react-router/dev 0.0.0-experimental-e87ed2fd4 → 0.0.0-experimental-e7eb25a7b

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,5 +1,121 @@
1
1
  # `@react-router/dev`
2
2
 
3
+ ## 7.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Prevent typegen with route files are outside the app directory ([#12996](https://github.com/remix-run/react-router/pull/12996))
8
+
9
+ - Fix typegen when same route is used at multiple paths ([#13574](https://github.com/remix-run/react-router/pull/13574))
10
+
11
+ For example, `routes/route.tsx` is used at 4 different paths here:
12
+
13
+ ```ts
14
+ import { type RouteConfig, route } from "@react-router/dev/routes";
15
+ export default [
16
+ route("base/:base", "routes/base.tsx", [
17
+ route("home/:home", "routes/route.tsx", { id: "home" }),
18
+ route("changelog/:changelog", "routes/route.tsx", { id: "changelog" }),
19
+ route("splat/*", "routes/route.tsx", { id: "splat" }),
20
+ ]),
21
+ route("other/:other", "routes/route.tsx", { id: "other" }),
22
+ ] satisfies RouteConfig;
23
+ ```
24
+
25
+ Previously, typegen would arbitrarily pick one of these paths to be the "winner" and generate types for the route module based on that path.
26
+ Now, typegen creates unions as necessary for alternate paths for the same route file.
27
+
28
+ - Add additional logging to `build` command output when cleaning assets from server build ([#13547](https://github.com/remix-run/react-router/pull/13547))
29
+
30
+ - Better types for `params` ([#13543](https://github.com/remix-run/react-router/pull/13543))
31
+
32
+ For example:
33
+
34
+ ```ts
35
+ // routes.ts
36
+ import { type RouteConfig, route } from "@react-router/dev/routes";
37
+
38
+ export default [
39
+ route("parent/:p", "routes/parent.tsx", [
40
+ route("layout/:l", "routes/layout.tsx", [
41
+ route("child1/:c1a/:c1b", "routes/child1.tsx"),
42
+ route("child2/:c2a/:c2b", "routes/child2.tsx"),
43
+ ]),
44
+ ]),
45
+ ] satisfies RouteConfig;
46
+ ```
47
+
48
+ Previously, `params` for the `routes/layout.tsx` route were calculated as `{ p: string, l: string }`.
49
+ This incorrectly ignores params that could come from child routes.
50
+ If visiting `/parent/1/layout/2/child1/3/4`, the actual params passed to `routes/layout.tsx` will have a type of `{ p: string, l: string, c1a: string, c1b: string }`.
51
+
52
+ Now, `params` are aware of child routes and autocompletion will include child params as optionals:
53
+
54
+ ```ts
55
+ params.|
56
+ // ^ cursor is here and you ask for autocompletion
57
+ // p: string
58
+ // l: string
59
+ // c1a?: string
60
+ // c1b?: string
61
+ // c2a?: string
62
+ // c2b?: string
63
+ ```
64
+
65
+ You can also narrow the types for `params` as it is implemented as a normalized union of params for each page that includes `routes/layout.tsx`:
66
+
67
+ ```ts
68
+ if (typeof params.c1a === 'string') {
69
+ params.|
70
+ // ^ cursor is here and you ask for autocompletion
71
+ // p: string
72
+ // l: string
73
+ // c1a: string
74
+ // c1b: string
75
+ }
76
+ ```
77
+
78
+ ***
79
+
80
+ UNSTABLE: renamed internal `react-router/route-module` export to `react-router/internal`
81
+ UNSTABLE: removed `Info` export from generated `+types/*` files
82
+
83
+ - \[UNSTABLE] Normalize dirent entry path across node versions when generating SRI manifest ([#13591](https://github.com/remix-run/react-router/pull/13591))
84
+
85
+ - Don't clean assets from server build when `build.ssrEmitAssets` has been enabled in Vite config ([#13547](https://github.com/remix-run/react-router/pull/13547))
86
+
87
+ - Fix `href` for optional segments ([#13595](https://github.com/remix-run/react-router/pull/13595))
88
+
89
+ Type generation now expands paths with optionals into their corresponding non-optional paths.
90
+ For example, the path `/user/:id?` gets expanded into `/user` and `/user/:id` to more closely model visitable URLs.
91
+ `href` then uses these expanded (non-optional) paths to construct type-safe paths for your app:
92
+
93
+ ```ts
94
+ // original: /user/:id?
95
+ // expanded: /user & /user/:id
96
+ href("/user"); // ✅
97
+ href("/user/:id", { id: 1 }); // ✅
98
+ ```
99
+
100
+ This becomes even more important for static optional paths where there wasn't a good way to indicate whether the optional should be included in the resulting path:
101
+
102
+ ```ts
103
+ // original: /products/:id/detail?
104
+
105
+ // before
106
+ href("/products/:id/detail?"); // ❌ How can we tell `href` to include or omit `detail?` segment with a complex API?
107
+
108
+ // now
109
+ // expanded: /products/:id & /products/:id/detail
110
+ href("/product/:id"); // ✅
111
+ href("/product/:id/detail"); // ✅
112
+ ```
113
+
114
+ - Updated dependencies:
115
+ - `react-router@7.6.1`
116
+ - `@react-router/node@7.6.1`
117
+ - `@react-router/serve@7.6.1`
118
+
3
119
  ## 7.6.0
4
120
 
5
121
  ### Minor Changes
package/dist/cli/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * @react-router/dev v0.0.0-experimental-e87ed2fd4
3
+ * @react-router/dev v0.0.0-experimental-e7eb25a7b
4
4
  *
5
5
  * Copyright (c) Remix Software Inc.
6
6
  *
package/dist/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-e87ed2fd4
2
+ * @react-router/dev v0.0.0-experimental-e7eb25a7b
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/routes.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-e87ed2fd4
2
+ * @react-router/dev v0.0.0-experimental-e7eb25a7b
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,6 +1,6 @@
1
1
  import { UNSAFE_MiddlewareEnabled, unstable_InitialContext, AppLoadContext } from 'react-router';
2
2
  import { Plugin } from 'vite';
3
- import { GetPlatformProxyOptions, PlatformProxy } from 'wrangler';
3
+ import { PlatformProxy, GetPlatformProxyOptions } from 'wrangler';
4
4
 
5
5
  type MaybePromise<T> = T | Promise<T>;
6
6
  type CfProperties = Record<string, unknown>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-e87ed2fd4
2
+ * @react-router/dev v0.0.0-experimental-e7eb25a7b
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/vite.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/dev v0.0.0-experimental-e87ed2fd4
2
+ * @react-router/dev v0.0.0-experimental-e7eb25a7b
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-router/dev",
3
- "version": "0.0.0-experimental-e87ed2fd4",
3
+ "version": "0.0.0-experimental-e7eb25a7b",
4
4
  "description": "Dev tools and CLI for React Router",
5
5
  "homepage": "https://reactrouter.com",
6
6
  "bugs": {
@@ -85,8 +85,8 @@
85
85
  "semver": "^7.3.7",
86
86
  "set-cookie-parser": "^2.6.0",
87
87
  "valibot": "^0.41.0",
88
- "vite-node": "3.0.0-beta.2",
89
- "@react-router/node": "0.0.0-experimental-e87ed2fd4"
88
+ "vite-node": "^3.1.4",
89
+ "@react-router/node": "0.0.0-experimental-e7eb25a7b"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@types/babel__core": "^7.20.5",
@@ -110,15 +110,15 @@
110
110
  "vite": "^6.1.0",
111
111
  "wireit": "0.14.9",
112
112
  "wrangler": "^4.2.0",
113
- "@react-router/serve": "0.0.0-experimental-e87ed2fd4",
114
- "react-router": "^0.0.0-experimental-e87ed2fd4"
113
+ "react-router": "^0.0.0-experimental-e7eb25a7b",
114
+ "@react-router/serve": "0.0.0-experimental-e7eb25a7b"
115
115
  },
116
116
  "peerDependencies": {
117
117
  "typescript": "^5.1.0",
118
118
  "vite": "^5.1.0 || ^6.0.0",
119
119
  "wrangler": "^3.28.2 || ^4.0.0",
120
- "@react-router/serve": "^0.0.0-experimental-e87ed2fd4",
121
- "react-router": "^0.0.0-experimental-e87ed2fd4"
120
+ "@react-router/serve": "^0.0.0-experimental-e7eb25a7b",
121
+ "react-router": "^0.0.0-experimental-e7eb25a7b"
122
122
  },
123
123
  "peerDependenciesMeta": {
124
124
  "@react-router/serve": {