@react-router/dev 0.0.0-experimental-d82b9430b → 0.0.0-experimental-9398cceaa
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 +62 -0
- package/dist/cli/index.js +8 -3
- package/dist/config.js +1 -1
- package/dist/routes.js +1 -1
- package/dist/vite/cloudflare.js +1 -1
- package/dist/vite.js +15 -3
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,67 @@
|
|
|
1
1
|
# `@react-router/dev`
|
|
2
2
|
|
|
3
|
+
## 7.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Avoid additional `with-props` chunk in Framework Mode by moving route module component prop logic from the Vite plugin to `react-router` ([#13650](https://github.com/remix-run/react-router/pull/13650))
|
|
8
|
+
|
|
9
|
+
- When `future.unstable_viteEnvironmentApi` is enabled and an absolute Vite `base` has been configured, ensure critical CSS is handled correctly during development ([#13598](https://github.com/remix-run/react-router/pull/13598))
|
|
10
|
+
|
|
11
|
+
- Update `vite-node` ([#13673](https://github.com/remix-run/react-router/pull/13673))
|
|
12
|
+
|
|
13
|
+
- Fix typegen for non-{.js,.jsx,.ts,.tsx} routes like .mdx ([#12453](https://github.com/remix-run/react-router/pull/12453))
|
|
14
|
+
|
|
15
|
+
- Fix href types for optional dynamic params ([#13725](https://github.com/remix-run/react-router/pull/13725))
|
|
16
|
+
|
|
17
|
+
7.6.1 introduced fixes for `href` when using optional static segments,
|
|
18
|
+
but those fixes caused regressions with how optional dynamic params worked in 7.6.0:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
// 7.6.0
|
|
22
|
+
href("/users/:id?"); // ✅
|
|
23
|
+
href("/users/:id?", { id: 1 }); // ✅
|
|
24
|
+
|
|
25
|
+
// 7.6.1
|
|
26
|
+
href("/users/:id?"); // ❌
|
|
27
|
+
href("/users/:id?", { id: 1 }); // ❌
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Now, optional static segments are expanded into different paths for `href`, but optional dynamic params are not.
|
|
31
|
+
This way `href` can unambiguously refer to an exact URL path, all while keeping the number of path options to a minimum.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
// 7.6.2
|
|
35
|
+
|
|
36
|
+
// path: /users/:id?/edit?
|
|
37
|
+
href("
|
|
38
|
+
// ^ suggestions when cursor is here:
|
|
39
|
+
//
|
|
40
|
+
// /users/:id?
|
|
41
|
+
// /users/:id?/edit
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Additionally, you can pass `params` from component props without needing to narrow them manually:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
declare const params: { id?: number };
|
|
48
|
+
|
|
49
|
+
// 7.6.0
|
|
50
|
+
href("/users/:id?", params);
|
|
51
|
+
|
|
52
|
+
// 7.6.1
|
|
53
|
+
href("/users/:id?", params); // ❌
|
|
54
|
+
"id" in params ? href("/users/:id", params) : href("/users"); // works... but is annoying
|
|
55
|
+
|
|
56
|
+
// 7.6.2
|
|
57
|
+
href("/users/:id?", params); // restores behavior of 7.6.0
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- Updated dependencies:
|
|
61
|
+
- `react-router@7.6.2`
|
|
62
|
+
- `@react-router/node@7.6.2`
|
|
63
|
+
- `@react-router/serve@7.6.2`
|
|
64
|
+
|
|
3
65
|
## 7.6.1
|
|
4
66
|
|
|
5
67
|
### Patch 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-
|
|
3
|
+
* @react-router/dev v0.0.0-experimental-9398cceaa
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
6
6
|
*
|
|
@@ -1136,9 +1136,13 @@ function getRouteAnnotations({
|
|
|
1136
1136
|
}
|
|
1137
1137
|
function relativeImportSource(from, to) {
|
|
1138
1138
|
let path8 = Path3.relative(Path3.dirname(from), to);
|
|
1139
|
+
let extension = Path3.extname(path8);
|
|
1139
1140
|
path8 = Path3.join(Path3.dirname(path8), Pathe.filename(path8));
|
|
1140
1141
|
if (!path8.startsWith("../")) path8 = "./" + path8;
|
|
1141
|
-
|
|
1142
|
+
if (!extension || /\.(js|ts)x?$/.test(extension)) {
|
|
1143
|
+
extension = ".js";
|
|
1144
|
+
}
|
|
1145
|
+
return path8 + extension;
|
|
1142
1146
|
}
|
|
1143
1147
|
function rootDirsPath(ctx, typesPath) {
|
|
1144
1148
|
const rel = Path3.relative(typesDirectory(ctx), typesPath);
|
|
@@ -1630,7 +1634,7 @@ function resolveEnvironmentsOptions(environmentResolvers, resolverOptions) {
|
|
|
1630
1634
|
function isNonNullable(x) {
|
|
1631
1635
|
return x != null;
|
|
1632
1636
|
}
|
|
1633
|
-
var import_node_crypto, fs4, path6, url, fse, babel2, import_react_router2, import_es_module_lexer, import_pick3, import_jsesc, import_picocolors4, import_kebabCase, CLIENT_NON_COMPONENT_EXPORTS, CLIENT_ROUTE_EXPORTS, BUILD_CLIENT_ROUTE_QUERY_STRING, SSR_BUNDLE_PREFIX, virtualHmrRuntime, virtualInjectHmrRuntime, virtual, getServerBuildDirectory, getClientBuildDirectory, defaultEntriesDir, defaultEntries, REACT_REFRESH_HEADER;
|
|
1637
|
+
var import_node_crypto, fs4, path6, url, fse, babel2, import_react_router2, import_es_module_lexer, import_tinyglobby, import_pick3, import_jsesc, import_picocolors4, import_kebabCase, CLIENT_NON_COMPONENT_EXPORTS, CLIENT_ROUTE_EXPORTS, BUILD_CLIENT_ROUTE_QUERY_STRING, SSR_BUNDLE_PREFIX, virtualHmrRuntime, virtualInjectHmrRuntime, virtual, getServerBuildDirectory, getClientBuildDirectory, defaultEntriesDir, defaultEntries, REACT_REFRESH_HEADER;
|
|
1634
1638
|
var init_plugin = __esm({
|
|
1635
1639
|
"vite/plugin.ts"() {
|
|
1636
1640
|
"use strict";
|
|
@@ -1642,6 +1646,7 @@ var init_plugin = __esm({
|
|
|
1642
1646
|
babel2 = __toESM(require("@babel/core"));
|
|
1643
1647
|
import_react_router2 = require("react-router");
|
|
1644
1648
|
import_es_module_lexer = require("es-module-lexer");
|
|
1649
|
+
import_tinyglobby = require("tinyglobby");
|
|
1645
1650
|
import_pick3 = __toESM(require("lodash/pick"));
|
|
1646
1651
|
import_jsesc = __toESM(require("jsesc"));
|
|
1647
1652
|
import_picocolors4 = __toESM(require("picocolors"));
|
package/dist/config.js
CHANGED
package/dist/routes.js
CHANGED
package/dist/vite/cloudflare.js
CHANGED
package/dist/vite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v0.0.0-experimental-
|
|
2
|
+
* @react-router/dev v0.0.0-experimental-9398cceaa
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -53,6 +53,7 @@ var fse = __toESM(require("fs-extra"));
|
|
|
53
53
|
var babel = __toESM(require("@babel/core"));
|
|
54
54
|
var import_react_router2 = require("react-router");
|
|
55
55
|
var import_es_module_lexer = require("es-module-lexer");
|
|
56
|
+
var import_tinyglobby = require("tinyglobby");
|
|
56
57
|
var import_pick3 = __toESM(require("lodash/pick"));
|
|
57
58
|
var import_jsesc = __toESM(require("jsesc"));
|
|
58
59
|
var import_picocolors3 = __toESM(require("picocolors"));
|
|
@@ -1123,9 +1124,13 @@ function getRouteAnnotations({
|
|
|
1123
1124
|
}
|
|
1124
1125
|
function relativeImportSource(from, to) {
|
|
1125
1126
|
let path6 = Path3.relative(Path3.dirname(from), to);
|
|
1127
|
+
let extension = Path3.extname(path6);
|
|
1126
1128
|
path6 = Path3.join(Path3.dirname(path6), Pathe.filename(path6));
|
|
1127
1129
|
if (!path6.startsWith("../")) path6 = "./" + path6;
|
|
1128
|
-
|
|
1130
|
+
if (!extension || /\.(js|ts)x?$/.test(extension)) {
|
|
1131
|
+
extension = ".js";
|
|
1132
|
+
}
|
|
1133
|
+
return path6 + extension;
|
|
1129
1134
|
}
|
|
1130
1135
|
function rootDirsPath(ctx, typesPath) {
|
|
1131
1136
|
const rel = Path3.relative(typesDirectory(ctx), typesPath);
|
|
@@ -2965,6 +2970,7 @@ var reactRouterVitePlugin = () => {
|
|
|
2965
2970
|
config: async (_viteUserConfig, _viteConfigEnv) => {
|
|
2966
2971
|
await preloadVite();
|
|
2967
2972
|
let vite2 = getVite();
|
|
2973
|
+
let viteMajorVersion = parseInt(vite2.version.split(".")[0], 10);
|
|
2968
2974
|
viteUserConfig = _viteUserConfig;
|
|
2969
2975
|
viteConfigEnv = _viteConfigEnv;
|
|
2970
2976
|
viteCommand = viteConfigEnv.command;
|
|
@@ -3023,7 +3029,13 @@ var reactRouterVitePlugin = () => {
|
|
|
3023
3029
|
...Object.values(ctx.reactRouterConfig.routes).map(
|
|
3024
3030
|
(route) => resolveRelativeRouteFilePath(route, ctx.reactRouterConfig)
|
|
3025
3031
|
)
|
|
3026
|
-
]
|
|
3032
|
+
].map(
|
|
3033
|
+
(entry) => (
|
|
3034
|
+
// In Vite 7, the `optimizeDeps.entries` option only accepts glob patterns.
|
|
3035
|
+
// In prior versions, absolute file paths were treated differently.
|
|
3036
|
+
viteMajorVersion >= 7 ? (0, import_tinyglobby.escapePath)(entry) : entry
|
|
3037
|
+
)
|
|
3038
|
+
) : [],
|
|
3027
3039
|
include: [
|
|
3028
3040
|
// Pre-bundle React dependencies to avoid React duplicates,
|
|
3029
3041
|
// even if React dependencies are not direct dependencies.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-router/dev",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-9398cceaa",
|
|
4
4
|
"description": "Dev tools and CLI for React Router",
|
|
5
5
|
"homepage": "https://reactrouter.com",
|
|
6
6
|
"bugs": {
|
|
@@ -84,9 +84,10 @@
|
|
|
84
84
|
"react-refresh": "^0.14.0",
|
|
85
85
|
"semver": "^7.3.7",
|
|
86
86
|
"set-cookie-parser": "^2.6.0",
|
|
87
|
+
"tinyglobby": "^0.2.14",
|
|
87
88
|
"valibot": "^0.41.0",
|
|
88
89
|
"vite-node": "^3.1.4",
|
|
89
|
-
"@react-router/node": "0.0.0-experimental-
|
|
90
|
+
"@react-router/node": "0.0.0-experimental-9398cceaa"
|
|
90
91
|
},
|
|
91
92
|
"devDependencies": {
|
|
92
93
|
"@types/babel__core": "^7.20.5",
|
|
@@ -110,15 +111,15 @@
|
|
|
110
111
|
"vite": "^6.1.0",
|
|
111
112
|
"wireit": "0.14.9",
|
|
112
113
|
"wrangler": "^4.2.0",
|
|
113
|
-
"react-router": "^0.0.0-experimental-
|
|
114
|
-
"@react-router/serve": "0.0.0-experimental-
|
|
114
|
+
"react-router": "^0.0.0-experimental-9398cceaa",
|
|
115
|
+
"@react-router/serve": "0.0.0-experimental-9398cceaa"
|
|
115
116
|
},
|
|
116
117
|
"peerDependencies": {
|
|
117
118
|
"typescript": "^5.1.0",
|
|
118
|
-
"vite": "^5.1.0 || ^6.0.0",
|
|
119
|
+
"vite": "^5.1.0 || ^6.0.0 || ^7.0.0",
|
|
119
120
|
"wrangler": "^3.28.2 || ^4.0.0",
|
|
120
|
-
"@react-router/serve": "^0.0.0-experimental-
|
|
121
|
-
"react-router": "^0.0.0-experimental-
|
|
121
|
+
"@react-router/serve": "^0.0.0-experimental-9398cceaa",
|
|
122
|
+
"react-router": "^0.0.0-experimental-9398cceaa"
|
|
122
123
|
},
|
|
123
124
|
"peerDependenciesMeta": {
|
|
124
125
|
"@react-router/serve": {
|