@react-router/dev 0.0.0-experimental-3d7dcee → 0.0.0-experimental-7ed11be
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 +10 -0
- package/dist/cli/index.js +11 -3
- package/dist/config/defaults/entry.server.node.tsx +17 -7
- package/dist/config.js +1 -1
- package/dist/internal.js +44 -5
- package/dist/routes.js +1 -1
- package/dist/vite/cloudflare.js +1 -1
- package/dist/vite.js +30 -18
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# `@react-router/dev`
|
|
2
2
|
|
|
3
|
+
## 7.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Update generated `Route.MetaArgs` type so `loaderData` is only potentially undefined when an `ErrorBoundary` export is present ([#14173](https://github.com/remix-run/react-router/pull/14173))
|
|
8
|
+
- Updated dependencies:
|
|
9
|
+
- `react-router@7.8.1`
|
|
10
|
+
- `@react-router/node@7.8.1`
|
|
11
|
+
- `@react-router/serve@7.8.1`
|
|
12
|
+
|
|
3
13
|
## 7.8.0
|
|
4
14
|
|
|
5
15
|
### 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-7ed11be
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
6
6
|
*
|
|
@@ -1417,6 +1417,13 @@ var init_with_props = __esm({
|
|
|
1417
1417
|
}
|
|
1418
1418
|
});
|
|
1419
1419
|
|
|
1420
|
+
// vite/plugins/validate-plugin-order.ts
|
|
1421
|
+
var init_validate_plugin_order = __esm({
|
|
1422
|
+
"vite/plugins/validate-plugin-order.ts"() {
|
|
1423
|
+
"use strict";
|
|
1424
|
+
}
|
|
1425
|
+
});
|
|
1426
|
+
|
|
1420
1427
|
// vite/plugin.ts
|
|
1421
1428
|
async function resolveViteConfig({
|
|
1422
1429
|
configFile,
|
|
@@ -1685,6 +1692,7 @@ var init_plugin = __esm({
|
|
|
1685
1692
|
init_vite();
|
|
1686
1693
|
init_config();
|
|
1687
1694
|
init_with_props();
|
|
1695
|
+
init_validate_plugin_order();
|
|
1688
1696
|
CLIENT_NON_COMPONENT_EXPORTS = [
|
|
1689
1697
|
"clientAction",
|
|
1690
1698
|
"clientLoader",
|
|
@@ -1824,7 +1832,7 @@ async function viteAppBuild(root, {
|
|
|
1824
1832
|
},
|
|
1825
1833
|
configResolved(config) {
|
|
1826
1834
|
let hasReactRouterPlugin = config.plugins.find(
|
|
1827
|
-
(plugin) => plugin.name === "react-router" || plugin.name === "react-router/rsc
|
|
1835
|
+
(plugin) => plugin.name === "react-router" || plugin.name === "react-router/rsc"
|
|
1828
1836
|
);
|
|
1829
1837
|
if (!hasReactRouterPlugin) {
|
|
1830
1838
|
throw new Error(
|
|
@@ -1964,7 +1972,7 @@ async function dev(root, {
|
|
|
1964
1972
|
logLevel
|
|
1965
1973
|
});
|
|
1966
1974
|
if (!server.config.plugins.find(
|
|
1967
|
-
(plugin) => plugin.name === "react-router" || plugin.name === "react-router/rsc
|
|
1975
|
+
(plugin) => plugin.name === "react-router" || plugin.name === "react-router/rsc"
|
|
1968
1976
|
)) {
|
|
1969
1977
|
console.error(
|
|
1970
1978
|
import_picocolors6.default.red("React Router Vite plugin not found in Vite config")
|
|
@@ -29,24 +29,38 @@ export default function handleRequest(
|
|
|
29
29
|
? "onAllReady"
|
|
30
30
|
: "onShellReady";
|
|
31
31
|
|
|
32
|
+
// Abort the rendering stream after the `streamTimeout` so it has time to
|
|
33
|
+
// flush down the rejected boundaries
|
|
34
|
+
let timeoutId: ReturnType<typeof setTimeout> | undefined = setTimeout(
|
|
35
|
+
() => abort(),
|
|
36
|
+
streamTimeout + 1000,
|
|
37
|
+
);
|
|
38
|
+
|
|
32
39
|
const { pipe, abort } = renderToPipeableStream(
|
|
33
40
|
<ServerRouter context={routerContext} url={request.url} />,
|
|
34
41
|
{
|
|
35
42
|
[readyOption]() {
|
|
36
43
|
shellRendered = true;
|
|
37
|
-
const body = new PassThrough(
|
|
44
|
+
const body = new PassThrough({
|
|
45
|
+
final(callback) {
|
|
46
|
+
// Clear the timeout to prevent retaining the closure and memory leak
|
|
47
|
+
clearTimeout(timeoutId);
|
|
48
|
+
timeoutId = undefined;
|
|
49
|
+
callback();
|
|
50
|
+
},
|
|
51
|
+
});
|
|
38
52
|
const stream = createReadableStreamFromReadable(body);
|
|
39
53
|
|
|
40
54
|
responseHeaders.set("Content-Type", "text/html");
|
|
41
55
|
|
|
56
|
+
pipe(body);
|
|
57
|
+
|
|
42
58
|
resolve(
|
|
43
59
|
new Response(stream, {
|
|
44
60
|
headers: responseHeaders,
|
|
45
61
|
status: responseStatusCode,
|
|
46
62
|
}),
|
|
47
63
|
);
|
|
48
|
-
|
|
49
|
-
pipe(body);
|
|
50
64
|
},
|
|
51
65
|
onShellError(error: unknown) {
|
|
52
66
|
reject(error);
|
|
@@ -62,9 +76,5 @@ export default function handleRequest(
|
|
|
62
76
|
},
|
|
63
77
|
},
|
|
64
78
|
);
|
|
65
|
-
|
|
66
|
-
// Abort the rendering stream after the `streamTimeout` so it has time to
|
|
67
|
-
// flush down the rejected boundaries
|
|
68
|
-
setTimeout(abort, streamTimeout + 1000);
|
|
69
79
|
});
|
|
70
80
|
}
|
package/dist/config.js
CHANGED
package/dist/internal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v0.0.0-experimental-
|
|
2
|
+
* @react-router/dev v0.0.0-experimental-7ed11be
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -1534,6 +1534,32 @@ function isVirtualServerRouteModuleId(id) {
|
|
|
1534
1534
|
return /(\?|&)server-route-module(&|$)/.test(id);
|
|
1535
1535
|
}
|
|
1536
1536
|
|
|
1537
|
+
// vite/plugins/validate-plugin-order.ts
|
|
1538
|
+
function validatePluginOrder() {
|
|
1539
|
+
return {
|
|
1540
|
+
name: "react-router:validate-plugin-order",
|
|
1541
|
+
configResolved(viteConfig) {
|
|
1542
|
+
let pluginIndex = (pluginName) => {
|
|
1543
|
+
pluginName = Array.isArray(pluginName) ? pluginName : [pluginName];
|
|
1544
|
+
return viteConfig.plugins.findIndex(
|
|
1545
|
+
(plugin) => pluginName.includes(plugin.name)
|
|
1546
|
+
);
|
|
1547
|
+
};
|
|
1548
|
+
let rollupPrePlugins = [
|
|
1549
|
+
{ pluginName: "@mdx-js/rollup", displayName: "@mdx-js/rollup" }
|
|
1550
|
+
];
|
|
1551
|
+
for (let prePlugin of rollupPrePlugins) {
|
|
1552
|
+
let prePluginIndex = pluginIndex(prePlugin.pluginName);
|
|
1553
|
+
if (prePluginIndex >= 0 && prePluginIndex > pluginIndex(["react-router", "react-router/rsc"])) {
|
|
1554
|
+
throw new Error(
|
|
1555
|
+
`The "${prePlugin.displayName}" plugin should be placed before the React Router plugin in your Vite config file`
|
|
1556
|
+
);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1537
1563
|
// vite/rsc/plugin.ts
|
|
1538
1564
|
function reactRouterRSCVitePlugin() {
|
|
1539
1565
|
let configLoader;
|
|
@@ -1543,7 +1569,7 @@ function reactRouterRSCVitePlugin() {
|
|
|
1543
1569
|
let routeIdByFile;
|
|
1544
1570
|
return [
|
|
1545
1571
|
{
|
|
1546
|
-
name: "react-router/rsc
|
|
1572
|
+
name: "react-router/rsc",
|
|
1547
1573
|
async config(viteUserConfig, { command, mode }) {
|
|
1548
1574
|
await import_es_module_lexer2.init;
|
|
1549
1575
|
viteCommand = command;
|
|
@@ -1586,9 +1612,21 @@ function reactRouterRSCVitePlugin() {
|
|
|
1586
1612
|
jsxDev: viteCommand !== "build"
|
|
1587
1613
|
},
|
|
1588
1614
|
environments: {
|
|
1589
|
-
client: {
|
|
1590
|
-
|
|
1591
|
-
|
|
1615
|
+
client: {
|
|
1616
|
+
build: {
|
|
1617
|
+
outDir: (0, import_pathe5.join)(config.buildDirectory, "client")
|
|
1618
|
+
}
|
|
1619
|
+
},
|
|
1620
|
+
rsc: {
|
|
1621
|
+
build: {
|
|
1622
|
+
outDir: (0, import_pathe5.join)(config.buildDirectory, "server")
|
|
1623
|
+
}
|
|
1624
|
+
},
|
|
1625
|
+
ssr: {
|
|
1626
|
+
build: {
|
|
1627
|
+
outDir: (0, import_pathe5.join)(config.buildDirectory, "server/__ssr_build")
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1592
1630
|
},
|
|
1593
1631
|
build: {
|
|
1594
1632
|
rollupOptions: {
|
|
@@ -1783,6 +1821,7 @@ function reactRouterRSCVitePlugin() {
|
|
|
1783
1821
|
return modules;
|
|
1784
1822
|
}
|
|
1785
1823
|
},
|
|
1824
|
+
validatePluginOrder(),
|
|
1786
1825
|
(0, import_plugin_rsc.default)({ entries: getRscEntries() })
|
|
1787
1826
|
];
|
|
1788
1827
|
}
|
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-7ed11be
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2329,6 +2329,32 @@ function toFunctionExpression(decl) {
|
|
|
2329
2329
|
);
|
|
2330
2330
|
}
|
|
2331
2331
|
|
|
2332
|
+
// vite/plugins/validate-plugin-order.ts
|
|
2333
|
+
function validatePluginOrder() {
|
|
2334
|
+
return {
|
|
2335
|
+
name: "react-router:validate-plugin-order",
|
|
2336
|
+
configResolved(viteConfig) {
|
|
2337
|
+
let pluginIndex = (pluginName) => {
|
|
2338
|
+
pluginName = Array.isArray(pluginName) ? pluginName : [pluginName];
|
|
2339
|
+
return viteConfig.plugins.findIndex(
|
|
2340
|
+
(plugin) => pluginName.includes(plugin.name)
|
|
2341
|
+
);
|
|
2342
|
+
};
|
|
2343
|
+
let rollupPrePlugins = [
|
|
2344
|
+
{ pluginName: "@mdx-js/rollup", displayName: "@mdx-js/rollup" }
|
|
2345
|
+
];
|
|
2346
|
+
for (let prePlugin of rollupPrePlugins) {
|
|
2347
|
+
let prePluginIndex = pluginIndex(prePlugin.pluginName);
|
|
2348
|
+
if (prePluginIndex >= 0 && prePluginIndex > pluginIndex(["react-router", "react-router/rsc"])) {
|
|
2349
|
+
throw new Error(
|
|
2350
|
+
`The "${prePlugin.displayName}" plugin should be placed before the React Router plugin in your Vite config file`
|
|
2351
|
+
);
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
};
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2332
2358
|
// vite/plugin.ts
|
|
2333
2359
|
function extractPluginContext(viteConfig) {
|
|
2334
2360
|
return viteConfig["__reactRouterPluginContext"];
|
|
@@ -2671,10 +2697,6 @@ var reactRouterVitePlugin = () => {
|
|
|
2671
2697
|
buildManifest
|
|
2672
2698
|
};
|
|
2673
2699
|
};
|
|
2674
|
-
let pluginIndex = (pluginName) => {
|
|
2675
|
-
invariant(viteConfig);
|
|
2676
|
-
return viteConfig.plugins.findIndex((plugin) => plugin.name === pluginName);
|
|
2677
|
-
};
|
|
2678
2700
|
let getServerEntry = async ({ routeIds }) => {
|
|
2679
2701
|
invariant(viteConfig, "viteconfig required to generate the server entry");
|
|
2680
2702
|
let routes = routeIds ? (
|
|
@@ -3238,17 +3260,6 @@ var reactRouterVitePlugin = () => {
|
|
|
3238
3260
|
childCompilerConfigFile,
|
|
3239
3261
|
"Vite config file was unable to be resolved for React Router child compiler"
|
|
3240
3262
|
);
|
|
3241
|
-
let rollupPrePlugins = [
|
|
3242
|
-
{ pluginName: "@mdx-js/rollup", displayName: "@mdx-js/rollup" }
|
|
3243
|
-
];
|
|
3244
|
-
for (let prePlugin of rollupPrePlugins) {
|
|
3245
|
-
let prePluginIndex = pluginIndex(prePlugin.pluginName);
|
|
3246
|
-
if (prePluginIndex >= 0 && prePluginIndex > pluginIndex("react-router")) {
|
|
3247
|
-
throw new Error(
|
|
3248
|
-
`The "${prePlugin.displayName}" plugin should be placed before the React Router plugin in your Vite config file`
|
|
3249
|
-
);
|
|
3250
|
-
}
|
|
3251
|
-
}
|
|
3252
3263
|
const childCompilerPlugins = await asyncFlatten(
|
|
3253
3264
|
childCompilerConfigFile.config.plugins ?? []
|
|
3254
3265
|
);
|
|
@@ -3266,7 +3277,7 @@ var reactRouterVitePlugin = () => {
|
|
|
3266
3277
|
envFile: false,
|
|
3267
3278
|
plugins: [
|
|
3268
3279
|
childCompilerPlugins.filter(
|
|
3269
|
-
(plugin) => typeof plugin === "object" && plugin !== null && "name" in plugin && plugin.name !== "react-router" && plugin.name !== "react-router:route-exports" && plugin.name !== "react-router:hmr-updates"
|
|
3280
|
+
(plugin) => typeof plugin === "object" && plugin !== null && "name" in plugin && plugin.name !== "react-router" && plugin.name !== "react-router:route-exports" && plugin.name !== "react-router:hmr-updates" && plugin.name !== "react-router:validate-plugin-order"
|
|
3270
3281
|
).map((plugin) => ({
|
|
3271
3282
|
...plugin,
|
|
3272
3283
|
configureServer: void 0,
|
|
@@ -3955,7 +3966,8 @@ var reactRouterVitePlugin = () => {
|
|
|
3955
3966
|
server.environments.client.reloadModule(clientModule);
|
|
3956
3967
|
}
|
|
3957
3968
|
}
|
|
3958
|
-
}
|
|
3969
|
+
},
|
|
3970
|
+
validatePluginOrder()
|
|
3959
3971
|
];
|
|
3960
3972
|
};
|
|
3961
3973
|
function getParentClientNodes(clientModuleGraph, module2) {
|
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-7ed11be",
|
|
4
4
|
"description": "Dev tools and CLI for React Router",
|
|
5
5
|
"homepage": "https://reactrouter.com",
|
|
6
6
|
"bugs": {
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"tinyglobby": "^0.2.14",
|
|
92
92
|
"valibot": "^0.41.0",
|
|
93
93
|
"vite-node": "^3.2.2",
|
|
94
|
-
"@react-router/node": "0.0.0-experimental-
|
|
94
|
+
"@react-router/node": "0.0.0-experimental-7ed11be"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
97
|
"@types/babel__core": "^7.20.5",
|
|
@@ -114,15 +114,15 @@
|
|
|
114
114
|
"vite": "^6.1.0",
|
|
115
115
|
"wireit": "0.14.9",
|
|
116
116
|
"wrangler": "^4.23.0",
|
|
117
|
-
"@react-router/serve": "0.0.0-experimental-
|
|
118
|
-
"react-router": "^0.0.0-experimental-
|
|
117
|
+
"@react-router/serve": "0.0.0-experimental-7ed11be",
|
|
118
|
+
"react-router": "^0.0.0-experimental-7ed11be"
|
|
119
119
|
},
|
|
120
120
|
"peerDependencies": {
|
|
121
121
|
"typescript": "^5.1.0",
|
|
122
122
|
"vite": "^5.1.0 || ^6.0.0 || ^7.0.0",
|
|
123
123
|
"wrangler": "^3.28.2 || ^4.0.0",
|
|
124
|
-
"react-router": "^0.0.0-experimental-
|
|
125
|
-
"
|
|
124
|
+
"@react-router/serve": "^0.0.0-experimental-7ed11be",
|
|
125
|
+
"react-router": "^0.0.0-experimental-7ed11be"
|
|
126
126
|
},
|
|
127
127
|
"peerDependenciesMeta": {
|
|
128
128
|
"@react-router/serve": {
|