@react-router/dev 7.0.0-pre.0 → 7.0.0-pre.2
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 +38 -2
- package/README.md +3 -9
- package/dist/cli/commands.js +1 -1
- package/dist/cli/detectPackageManager.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/run.js +4 -3
- package/dist/cli/useJavascript.js +1 -1
- package/dist/colors.js +1 -1
- package/dist/config/format.js +1 -1
- package/dist/config/routes.d.ts +17 -13
- package/dist/config/routes.js +36 -8
- package/dist/invariant.js +2 -2
- package/dist/routes.d.ts +1 -1
- package/dist/routes.js +2 -1
- package/dist/typescript/plugin.js +1 -1
- package/dist/typescript/typegen.js +3 -3
- package/dist/vite/babel.js +1 -1
- package/dist/vite/build.js +1 -1
- package/dist/vite/cloudflare-dev-proxy.js +1 -1
- package/dist/vite/cloudflare.js +1 -1
- package/dist/vite/combine-urls.js +1 -1
- package/dist/vite/config.js +1 -1
- package/dist/vite/dev.js +1 -1
- package/dist/vite/import-vite-esm-sync.js +1 -1
- package/dist/vite/node-adapter.js +10 -2
- package/dist/vite/plugin.js +26 -15
- package/dist/vite/profiler.js +1 -1
- package/dist/vite/remove-exports.js +1 -1
- package/dist/vite/resolve-file-url.js +1 -1
- package/dist/vite/static/refresh-utils.cjs +3 -3
- package/dist/vite/styles.js +7 -5
- package/dist/vite/vite-node.js +1 -1
- package/dist/vite/vmod.js +1 -1
- package/dist/vite/with-props.js +1 -1
- package/dist/vite.js +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# `@remix-run/dev`
|
|
2
2
|
|
|
3
|
+
## 7.0.0-pre.2
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- - 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))
|
|
8
|
+
- Examples: `LoaderFunction`, `LoaderFunctionArgs`, `ActionFunction`, `ActionFunctionArgs`, `DataFunctionArgs`, `RouteManifest`, `LinksFunction`, `Route`, `EntryRoute`
|
|
9
|
+
- The `RouteManifest` type used by the "remix" code is now slightly stricter because it is using the former `@remix-run/router` `RouteManifest`
|
|
10
|
+
- `Record<string, Route> -> Record<string, Route | undefined>`
|
|
11
|
+
- Removed `AppData` type in favor of inlining `unknown` in the few locations it was used
|
|
12
|
+
- Removed `ServerRuntimeMeta*` types in favor of the `Meta*` types they were duplicated from
|
|
13
|
+
- Drop support for Node 18, update minimum Node vestion to 20 ([#12171](https://github.com/remix-run/react-router/pull/12171))
|
|
14
|
+
|
|
15
|
+
- Remove `installGlobals()` as this should no longer be necessary
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies:
|
|
20
|
+
- `react-router@7.0.0-pre.2`
|
|
21
|
+
- `@react-router/node@7.0.0-pre.2`
|
|
22
|
+
- `@react-router/serve@7.0.0-pre.2`
|
|
23
|
+
|
|
24
|
+
## 7.0.0-pre.1
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- Add `prefix` route config helper to `@react-router/dev/routes` ([#12094](https://github.com/remix-run/react-router/pull/12094))
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- - 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))
|
|
33
|
+
- Proxy prerendered loader data into prerender pass for HTML files to avoid double-invocations of the loader at build time
|
|
34
|
+
- Updated dependencies:
|
|
35
|
+
- `react-router@7.0.0-pre.1`
|
|
36
|
+
- `@react-router/serve@7.0.0-pre.1`
|
|
37
|
+
- `@react-router/node@7.0.0-pre.1`
|
|
38
|
+
|
|
3
39
|
## 7.0.0-pre.0
|
|
4
40
|
|
|
5
41
|
### Major Changes
|
|
@@ -75,12 +111,12 @@
|
|
|
75
111
|
- ### Typesafety improvements ([#12019](https://github.com/remix-run/react-router/pull/12019))
|
|
76
112
|
|
|
77
113
|
React Router now generates types for each of your route modules.
|
|
78
|
-
You can access those types by importing them from `./+types
|
|
114
|
+
You can access those types by importing them from `./+types.<route filename without extension>`.
|
|
79
115
|
For example:
|
|
80
116
|
|
|
81
117
|
```ts
|
|
82
118
|
// app/routes/product.tsx
|
|
83
|
-
import type * as Route from "./+types
|
|
119
|
+
import type * as Route from "./+types.product";
|
|
84
120
|
|
|
85
121
|
export function loader({ params }: Route.LoaderArgs) {}
|
|
86
122
|
|
package/README.md
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @react-router/dev
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
|
|
5
|
-
To get started, open a new shell and run:
|
|
3
|
+
Dev tools and CLI for [React Router.](https://github.com/remix-run/react-router)
|
|
6
4
|
|
|
7
5
|
```sh
|
|
8
|
-
|
|
6
|
+
npm install @react-router/dev
|
|
9
7
|
```
|
|
10
|
-
|
|
11
|
-
Then follow the prompts you see in your terminal.
|
|
12
|
-
|
|
13
|
-
For more information about Remix, [visit remix.run](https://remix.run)!
|
package/dist/cli/commands.js
CHANGED
package/dist/cli/index.js
CHANGED
package/dist/cli/run.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.0.0-pre.
|
|
2
|
+
* @react-router/dev v7.0.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -98,8 +98,9 @@ ${colors.logoBlue("react-router")}
|
|
|
98
98
|
async function run(argv = process.argv.slice(2)) {
|
|
99
99
|
// Check the node version
|
|
100
100
|
let versions = process.versions;
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
let MINIMUM_NODE_VERSION = 20;
|
|
102
|
+
if (versions && versions.node && semver__default["default"].major(versions.node) < MINIMUM_NODE_VERSION) {
|
|
103
|
+
throw new Error(`️🚨 Oops, Node v${versions.node} detected. react-router requires ` + `a Node version greater than ${MINIMUM_NODE_VERSION}.`);
|
|
103
104
|
}
|
|
104
105
|
let isBooleanFlag = arg => {
|
|
105
106
|
let index = argv.indexOf(arg);
|
package/dist/colors.js
CHANGED
package/dist/config/format.js
CHANGED
package/dist/config/routes.d.ts
CHANGED
|
@@ -91,35 +91,39 @@ type CreateRouteOptions = Pick<RouteConfigEntry, (typeof createConfigRouteOption
|
|
|
91
91
|
* Helper function for creating a route config entry, for use within
|
|
92
92
|
* `routes.ts`.
|
|
93
93
|
*/
|
|
94
|
-
declare function
|
|
95
|
-
declare function
|
|
94
|
+
declare function route(path: string | null | undefined, file: string, children?: RouteConfigEntry[]): RouteConfigEntry;
|
|
95
|
+
declare function route(path: string | null | undefined, file: string, options: CreateRouteOptions, children?: RouteConfigEntry[]): RouteConfigEntry;
|
|
96
96
|
declare const createIndexOptionKeys: ["id"];
|
|
97
97
|
type CreateIndexOptions = Pick<RouteConfigEntry, (typeof createIndexOptionKeys)[number]>;
|
|
98
98
|
/**
|
|
99
99
|
* Helper function for creating a route config entry for an index route, for use
|
|
100
100
|
* within `routes.ts`.
|
|
101
101
|
*/
|
|
102
|
-
declare function
|
|
102
|
+
declare function index(file: string, options?: CreateIndexOptions): RouteConfigEntry;
|
|
103
103
|
declare const createLayoutOptionKeys: ["id"];
|
|
104
104
|
type CreateLayoutOptions = Pick<RouteConfigEntry, (typeof createLayoutOptionKeys)[number]>;
|
|
105
105
|
/**
|
|
106
106
|
* Helper function for creating a route config entry for a layout route, for use
|
|
107
107
|
* within `routes.ts`.
|
|
108
108
|
*/
|
|
109
|
-
declare function
|
|
110
|
-
declare function
|
|
111
|
-
export declare const route: typeof createRoute;
|
|
112
|
-
export declare const index: typeof createIndex;
|
|
113
|
-
export declare const layout: typeof createLayout;
|
|
109
|
+
declare function layout(file: string, children?: RouteConfigEntry[]): RouteConfigEntry;
|
|
110
|
+
declare function layout(file: string, options: CreateLayoutOptions, children?: RouteConfigEntry[]): RouteConfigEntry;
|
|
114
111
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* splitting route config into multiple files within different directories.
|
|
112
|
+
* Helper function for adding a path prefix to a set of routes without needing
|
|
113
|
+
* to introduce a parent route file, for use within `routes.ts`.
|
|
118
114
|
*/
|
|
119
|
-
|
|
115
|
+
declare function prefix(prefixPath: string, routes: RouteConfigEntry[]): RouteConfigEntry[];
|
|
116
|
+
declare const helpers: {
|
|
120
117
|
route: typeof route;
|
|
121
118
|
index: typeof index;
|
|
122
119
|
layout: typeof layout;
|
|
120
|
+
prefix: typeof prefix;
|
|
123
121
|
};
|
|
122
|
+
export { route, index, layout, prefix };
|
|
123
|
+
/**
|
|
124
|
+
* Creates a set of route config helpers that resolve file paths relative to the
|
|
125
|
+
* given directory, for use within `routes.ts`. This is designed to support
|
|
126
|
+
* splitting route config into multiple files within different directories.
|
|
127
|
+
*/
|
|
128
|
+
export declare function relative(directory: string): typeof helpers;
|
|
124
129
|
export declare function configRoutesToRouteManifest(routes: RouteConfigEntry[], rootId?: string): RouteManifest;
|
|
125
|
-
export {};
|
package/dist/config/routes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.0.0-pre.
|
|
2
|
+
* @react-router/dev v7.0.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -97,7 +97,7 @@ function validateRouteConfig({
|
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
const createConfigRouteOptionKeys = ["id", "index", "caseSensitive"];
|
|
100
|
-
function
|
|
100
|
+
function route(path, file, optionsOrChildren, children) {
|
|
101
101
|
let options = {};
|
|
102
102
|
if (Array.isArray(optionsOrChildren) || !optionsOrChildren) {
|
|
103
103
|
children = optionsOrChildren;
|
|
@@ -116,7 +116,7 @@ const createIndexOptionKeys = ["id"];
|
|
|
116
116
|
* Helper function for creating a route config entry for an index route, for use
|
|
117
117
|
* within `routes.ts`.
|
|
118
118
|
*/
|
|
119
|
-
function
|
|
119
|
+
function index(file, options) {
|
|
120
120
|
return {
|
|
121
121
|
file,
|
|
122
122
|
index: true,
|
|
@@ -124,7 +124,7 @@ function createIndex(file, options) {
|
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
const createLayoutOptionKeys = ["id"];
|
|
127
|
-
function
|
|
127
|
+
function layout(file, optionsOrChildren, children) {
|
|
128
128
|
let options = {};
|
|
129
129
|
if (Array.isArray(optionsOrChildren) || !optionsOrChildren) {
|
|
130
130
|
children = optionsOrChildren;
|
|
@@ -137,9 +137,27 @@ function createLayout(file, optionsOrChildren, children) {
|
|
|
137
137
|
...pick__default["default"](options, createLayoutOptionKeys)
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Helper function for adding a path prefix to a set of routes without needing
|
|
142
|
+
* to introduce a parent route file, for use within `routes.ts`.
|
|
143
|
+
*/
|
|
144
|
+
function prefix(prefixPath, routes) {
|
|
145
|
+
return routes.map(route => {
|
|
146
|
+
if (route.index || typeof route.path === "string") {
|
|
147
|
+
return {
|
|
148
|
+
...route,
|
|
149
|
+
path: route.path ? joinRoutePaths(prefixPath, route.path) : prefixPath,
|
|
150
|
+
children: route.children
|
|
151
|
+
};
|
|
152
|
+
} else if (route.children) {
|
|
153
|
+
return {
|
|
154
|
+
...route,
|
|
155
|
+
children: prefix(prefixPath, route.children)
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
return route;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
143
161
|
/**
|
|
144
162
|
* Creates a set of route config helpers that resolve file paths relative to the
|
|
145
163
|
* given directory, for use within `routes.ts`. This is designed to support
|
|
@@ -173,7 +191,10 @@ function relative(directory) {
|
|
|
173
191
|
*/
|
|
174
192
|
layout: (file, ...rest) => {
|
|
175
193
|
return layout(path.resolve(directory, file), ...rest);
|
|
176
|
-
}
|
|
194
|
+
},
|
|
195
|
+
// Passthrough of helper functions that don't need relative scoping so that
|
|
196
|
+
// a complete API is still provided.
|
|
197
|
+
prefix
|
|
177
198
|
};
|
|
178
199
|
}
|
|
179
200
|
function configRoutesToRouteManifest(routes, rootId = "root") {
|
|
@@ -212,11 +233,18 @@ function normalizeSlashes(file) {
|
|
|
212
233
|
function stripFileExtension(file) {
|
|
213
234
|
return file.replace(/\.[a-z0-9]+$/i, "");
|
|
214
235
|
}
|
|
236
|
+
function joinRoutePaths(path1, path2) {
|
|
237
|
+
return [path1.replace(/\/+$/, ""),
|
|
238
|
+
// Remove trailing slashes
|
|
239
|
+
path2.replace(/^\/+/, "") // Remove leading slashes
|
|
240
|
+
].join("/");
|
|
241
|
+
}
|
|
215
242
|
|
|
216
243
|
exports.configRoutesToRouteManifest = configRoutesToRouteManifest;
|
|
217
244
|
exports.getAppDirectory = getAppDirectory;
|
|
218
245
|
exports.index = index;
|
|
219
246
|
exports.layout = layout;
|
|
247
|
+
exports.prefix = prefix;
|
|
220
248
|
exports.relative = relative;
|
|
221
249
|
exports.resolvedRouteConfigSchema = resolvedRouteConfigSchema;
|
|
222
250
|
exports.route = route;
|
package/dist/invariant.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.0.0-pre.
|
|
2
|
+
* @react-router/dev v7.0.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
function invariant(value, message) {
|
|
14
14
|
if (value === false || value === null || typeof value === "undefined") {
|
|
15
|
-
console.error("The following error is a bug in
|
|
15
|
+
console.error("The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose");
|
|
16
16
|
throw new Error(message);
|
|
17
17
|
}
|
|
18
18
|
}
|
package/dist/routes.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { RouteConfig, RouteConfigEntry } from "./config/routes";
|
|
2
|
-
export { route, index, layout, relative, getAppDirectory, } from "./config/routes";
|
|
2
|
+
export { route, index, layout, prefix, relative, getAppDirectory, } from "./config/routes";
|
package/dist/routes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.0.0-pre.
|
|
2
|
+
* @react-router/dev v7.0.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -19,5 +19,6 @@ var routes = require('./config/routes.js');
|
|
|
19
19
|
exports.getAppDirectory = routes.getAppDirectory;
|
|
20
20
|
exports.index = routes.index;
|
|
21
21
|
exports.layout = routes.layout;
|
|
22
|
+
exports.prefix = routes.prefix;
|
|
22
23
|
exports.relative = routes.relative;
|
|
23
24
|
exports.route = routes.route;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.0.0-pre.
|
|
2
|
+
* @react-router/dev v7.0.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -74,10 +74,10 @@ async function watch(rootDirectory) {
|
|
|
74
74
|
}
|
|
75
75
|
routesViteNodeContext.devServer.moduleGraph.invalidateAll();
|
|
76
76
|
routesViteNodeContext.runner.moduleCache.clear();
|
|
77
|
-
const
|
|
77
|
+
const routeConfig = (await routesViteNodeContext.runner.executeFile(routesTsPath)).routes;
|
|
78
78
|
return {
|
|
79
79
|
...routes$1,
|
|
80
|
-
...routes.configRoutesToRouteManifest(
|
|
80
|
+
...routes.configRoutesToRouteManifest(await routeConfig)
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
const ctx = {
|
package/dist/vite/babel.js
CHANGED
package/dist/vite/build.js
CHANGED
package/dist/vite/cloudflare.js
CHANGED
package/dist/vite/config.js
CHANGED
package/dist/vite/dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.0.0-pre.
|
|
2
|
+
* @react-router/dev v7.0.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -41,12 +41,20 @@ function fromNodeRequest(nodeReq, nodeRes) {
|
|
|
41
41
|
let url = new URL(nodeReq.originalUrl, origin);
|
|
42
42
|
// Abort action/loaders once we can no longer write a response
|
|
43
43
|
let controller = new AbortController();
|
|
44
|
-
nodeRes.on("close", () => controller.abort());
|
|
45
44
|
let init = {
|
|
46
45
|
method: nodeReq.method,
|
|
47
46
|
headers: fromNodeHeaders(nodeReq.headers),
|
|
48
47
|
signal: controller.signal
|
|
49
48
|
};
|
|
49
|
+
// Abort action/loaders once we can no longer write a response iff we have
|
|
50
|
+
// not yet sent a response (i.e., `close` without `finish`)
|
|
51
|
+
// `finish` -> done rendering the response
|
|
52
|
+
// `close` -> response can no longer be written to
|
|
53
|
+
nodeRes.on("finish", () => controller = null);
|
|
54
|
+
nodeRes.on("close", () => {
|
|
55
|
+
var _controller;
|
|
56
|
+
return (_controller = controller) === null || _controller === void 0 ? void 0 : _controller.abort();
|
|
57
|
+
});
|
|
50
58
|
if (nodeReq.method !== "GET" && nodeReq.method !== "HEAD") {
|
|
51
59
|
init.body = node.createReadableStreamFromReadable(nodeReq);
|
|
52
60
|
init.duplex = "half";
|
package/dist/vite/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.0.0-pre.
|
|
2
|
+
* @react-router/dev v7.0.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1155,20 +1155,28 @@ async function handlePrerender(viteConfig, reactRouterConfig, serverBuildDirecto
|
|
|
1155
1155
|
} else {
|
|
1156
1156
|
routesToPrerender = reactRouterConfig.prerender || ["/"];
|
|
1157
1157
|
}
|
|
1158
|
-
let
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
"X-React-Router-Prerender": "yes"
|
|
1163
|
-
}
|
|
1158
|
+
let headers = {
|
|
1159
|
+
// Header that can be used in the loader to know if you're running at
|
|
1160
|
+
// build time or runtime
|
|
1161
|
+
"X-React-Router-Prerender": "yes"
|
|
1164
1162
|
};
|
|
1165
1163
|
for (let path of routesToPrerender) {
|
|
1166
1164
|
var _matchRoutes;
|
|
1167
1165
|
let hasLoaders = (_matchRoutes = reactRouter.matchRoutes(routes, path)) === null || _matchRoutes === void 0 ? void 0 : _matchRoutes.some(m => m.route.loader);
|
|
1166
|
+
let data;
|
|
1168
1167
|
if (hasLoaders) {
|
|
1169
|
-
await prerenderData(handler, path, clientBuildDirectory, reactRouterConfig, viteConfig,
|
|
1168
|
+
data = await prerenderData(handler, path, clientBuildDirectory, reactRouterConfig, viteConfig, {
|
|
1169
|
+
headers
|
|
1170
|
+
});
|
|
1170
1171
|
}
|
|
1171
|
-
await prerenderRoute(handler, path, clientBuildDirectory, reactRouterConfig, viteConfig,
|
|
1172
|
+
await prerenderRoute(handler, path, clientBuildDirectory, reactRouterConfig, viteConfig, data ? {
|
|
1173
|
+
headers: {
|
|
1174
|
+
...headers,
|
|
1175
|
+
"X-React-Router-Prerender-Data": data
|
|
1176
|
+
}
|
|
1177
|
+
} : {
|
|
1178
|
+
headers
|
|
1179
|
+
});
|
|
1172
1180
|
}
|
|
1173
1181
|
await prerenderManifest(build, clientBuildDirectory, reactRouterConfig, viteConfig);
|
|
1174
1182
|
}
|
|
@@ -1194,8 +1202,8 @@ function determineStaticPrerenderRoutes(routes, viteConfig, isBooleanUsage = fal
|
|
|
1194
1202
|
}
|
|
1195
1203
|
}
|
|
1196
1204
|
recurse(routes);
|
|
1197
|
-
if (isBooleanUsage && paramRoutes) {
|
|
1198
|
-
viteConfig.logger.warn("
|
|
1205
|
+
if (isBooleanUsage && paramRoutes.length > 0) {
|
|
1206
|
+
viteConfig.logger.warn(["⚠️ Paths with dynamic/splat params cannot be prerendered when using `prerender: true`.", "You may want to use the `prerender()` API to prerender the following paths:", ...paramRoutes.map(p => " - " + p)].join("\n"));
|
|
1199
1207
|
}
|
|
1200
1208
|
// Clean double slashes and remove trailing slashes
|
|
1201
1209
|
return paths.map(p => p.replace(/\/\/+/g, "/").replace(/(.+)\/$/, "$1"));
|
|
@@ -1212,6 +1220,7 @@ async function prerenderData(handler, prerenderPath, clientBuildDirectory, react
|
|
|
1212
1220
|
await fse__namespace.ensureDir(path__namespace.dirname(outfile));
|
|
1213
1221
|
await fse__namespace.outputFile(outfile, data);
|
|
1214
1222
|
viteConfig.logger.info(`Prerender: Generated ${colors__default["default"].bold(outfile)}`);
|
|
1223
|
+
return data;
|
|
1215
1224
|
}
|
|
1216
1225
|
async function prerenderRoute(handler, prerenderPath, clientBuildDirectory, reactRouterConfig, viteConfig, requestInit) {
|
|
1217
1226
|
let normalizedPath = `${reactRouterConfig.basename}${prerenderPath}/`.replace(/\/\/+/g, "/");
|
|
@@ -1252,11 +1261,13 @@ function validatePrerenderedHtml(html, prefix) {
|
|
|
1252
1261
|
function groupRoutesByParentId(manifest) {
|
|
1253
1262
|
let routes = {};
|
|
1254
1263
|
Object.values(manifest).forEach(route => {
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
routes[parentId]
|
|
1264
|
+
if (route) {
|
|
1265
|
+
let parentId = route.parentId || "";
|
|
1266
|
+
if (!routes[parentId]) {
|
|
1267
|
+
routes[parentId] = [];
|
|
1268
|
+
}
|
|
1269
|
+
routes[parentId].push(route);
|
|
1258
1270
|
}
|
|
1259
|
-
routes[parentId].push(route);
|
|
1260
1271
|
});
|
|
1261
1272
|
return routes;
|
|
1262
1273
|
}
|
package/dist/vite/profiler.js
CHANGED
|
@@ -49,21 +49,21 @@ const enqueueUpdate = debounce(async () => {
|
|
|
49
49
|
.map((route) => route.id)
|
|
50
50
|
);
|
|
51
51
|
|
|
52
|
-
let routes =
|
|
52
|
+
let routes = __reactRouterDataRouter.createRoutesForHMR(
|
|
53
53
|
needsRevalidation,
|
|
54
54
|
manifest.routes,
|
|
55
55
|
window.__reactRouterRouteModules,
|
|
56
56
|
window.__reactRouterContext.future,
|
|
57
57
|
window.__reactRouterContext.isSpaMode
|
|
58
58
|
);
|
|
59
|
-
|
|
59
|
+
__reactRouterDataRouter._internalSetRoutes(routes);
|
|
60
60
|
routeUpdates.clear();
|
|
61
61
|
window.__reactRouterRouteModuleUpdates.clear();
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
try {
|
|
65
65
|
window.__reactRouterHdrActive = true;
|
|
66
|
-
await
|
|
66
|
+
await __reactRouterDataRouter.revalidate();
|
|
67
67
|
} finally {
|
|
68
68
|
window.__reactRouterHdrActive = false;
|
|
69
69
|
}
|
package/dist/vite/styles.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.0.0-pre.
|
|
2
|
+
* @react-router/dev v7.0.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -147,11 +147,13 @@ const findDeps = async (vite, node, deps) => {
|
|
|
147
147
|
const groupRoutesByParentId = manifest => {
|
|
148
148
|
let routes = {};
|
|
149
149
|
Object.values(manifest).forEach(route => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
routes[parentId]
|
|
150
|
+
if (route) {
|
|
151
|
+
let parentId = route.parentId || "";
|
|
152
|
+
if (!routes[parentId]) {
|
|
153
|
+
routes[parentId] = [];
|
|
154
|
+
}
|
|
155
|
+
routes[parentId].push(route);
|
|
153
156
|
}
|
|
154
|
-
routes[parentId].push(route);
|
|
155
157
|
});
|
|
156
158
|
return routes;
|
|
157
159
|
};
|
package/dist/vite/vite-node.js
CHANGED
package/dist/vite/vmod.js
CHANGED
package/dist/vite/with-props.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-pre.
|
|
3
|
+
"version": "7.0.0-pre.2",
|
|
4
4
|
"description": "Dev tools and CLI for React Router",
|
|
5
5
|
"homepage": "https://reactrouter.com",
|
|
6
6
|
"bugs": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"set-cookie-parser": "^2.6.0",
|
|
62
62
|
"valibot": "^0.41.0",
|
|
63
63
|
"vite-node": "^1.6.0",
|
|
64
|
-
"@react-router/node": "7.0.0-pre.
|
|
64
|
+
"@react-router/node": "7.0.0-pre.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/babel__core": "^7.20.5",
|
|
@@ -87,15 +87,15 @@
|
|
|
87
87
|
"tiny-invariant": "^1.2.0",
|
|
88
88
|
"vite": "^5.1.0",
|
|
89
89
|
"wrangler": "^3.28.2",
|
|
90
|
-
"@react-router/serve": "7.0.0-pre.
|
|
91
|
-
"react-router": "^7.0.0-pre.
|
|
90
|
+
"@react-router/serve": "7.0.0-pre.2",
|
|
91
|
+
"react-router": "^7.0.0-pre.2"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"typescript": "^5.1.0",
|
|
95
95
|
"vite": "^5.1.0",
|
|
96
96
|
"wrangler": "^3.28.2",
|
|
97
|
-
"@react-router/serve": "^7.0.0-pre.
|
|
98
|
-
"react-router": "^7.0.0-pre.
|
|
97
|
+
"@react-router/serve": "^7.0.0-pre.2",
|
|
98
|
+
"react-router": "^7.0.0-pre.2"
|
|
99
99
|
},
|
|
100
100
|
"peerDependenciesMeta": {
|
|
101
101
|
"@react-router/serve": {
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
111
|
"engines": {
|
|
112
|
-
"node": ">=
|
|
112
|
+
"node": ">=20.0.0"
|
|
113
113
|
},
|
|
114
114
|
"files": [
|
|
115
115
|
"dist/",
|