@react-router/dev 7.7.1-pre.0 → 7.8.0-pre.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 +14 -4
- package/dist/cli/index.js +28 -18
- package/dist/config/default-rsc-entries/entry.client.tsx +36 -0
- package/dist/config/default-rsc-entries/entry.rsc.tsx +34 -0
- package/dist/config/default-rsc-entries/entry.ssr.tsx +29 -0
- package/dist/config.d.ts +5 -1
- package/dist/config.js +1 -1
- package/dist/internal.d.ts +9 -0
- package/dist/internal.js +1636 -0
- package/dist/{routes-DHIOx0R9.d.ts → routes-CZR-bKRt.d.ts} +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/routes.js +1 -1
- package/dist/vite/cloudflare.d.ts +2 -2
- package/dist/vite/cloudflare.js +24 -16
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +53 -18
- package/package.json +12 -6
|
@@ -120,4 +120,4 @@ declare const helpers: {
|
|
|
120
120
|
*/
|
|
121
121
|
declare function relative(directory: string): typeof helpers;
|
|
122
122
|
|
|
123
|
-
export { type RouteManifest as R, type RouteManifestEntry as a, type
|
|
123
|
+
export { type RouteManifest as R, type RouteManifestEntry as a, type RouteConfigEntry as b, type RouteConfig as c, relative as d, getAppDirectory as g, index as i, layout as l, prefix as p, route as r };
|
package/dist/routes.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { c as RouteConfig, b as RouteConfigEntry, g as getAppDirectory, i as index, l as layout, p as prefix, d as relative, r as route } from './routes-CZR-bKRt.js';
|
|
2
2
|
import 'valibot';
|
package/dist/routes.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UNSAFE_MiddlewareEnabled,
|
|
1
|
+
import { UNSAFE_MiddlewareEnabled, unstable_RouterContextProvider, AppLoadContext } from 'react-router';
|
|
2
2
|
import { Plugin } from 'vite';
|
|
3
3
|
import { PlatformProxy, GetPlatformProxyOptions } from 'wrangler';
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ type LoadContext<Env, Cf extends CfProperties> = {
|
|
|
10
10
|
type GetLoadContext<Env, Cf extends CfProperties> = (args: {
|
|
11
11
|
request: Request;
|
|
12
12
|
context: LoadContext<Env, Cf>;
|
|
13
|
-
}) => UNSAFE_MiddlewareEnabled extends true ? MaybePromise<
|
|
13
|
+
}) => UNSAFE_MiddlewareEnabled extends true ? MaybePromise<unstable_RouterContextProvider> : MaybePromise<AppLoadContext>;
|
|
14
14
|
/**
|
|
15
15
|
* Vite plugin that provides [Node proxies to local workerd
|
|
16
16
|
* bindings](https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy)
|
package/dist/vite/cloudflare.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.
|
|
2
|
+
* @react-router/dev v7.8.0-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -316,9 +316,12 @@ ${message}`
|
|
|
316
316
|
].flat().join("\n\n")
|
|
317
317
|
};
|
|
318
318
|
}
|
|
319
|
-
return {
|
|
319
|
+
return {
|
|
320
|
+
valid: true,
|
|
321
|
+
routeConfig
|
|
322
|
+
};
|
|
320
323
|
}
|
|
321
|
-
function configRoutesToRouteManifest(appDirectory, routes
|
|
324
|
+
function configRoutesToRouteManifest(appDirectory, routes) {
|
|
322
325
|
let routeManifest = {};
|
|
323
326
|
function walk(route, parentId) {
|
|
324
327
|
let id = route.id || createRouteId(route.file);
|
|
@@ -343,7 +346,7 @@ function configRoutesToRouteManifest(appDirectory, routes, rootId = "root") {
|
|
|
343
346
|
}
|
|
344
347
|
}
|
|
345
348
|
for (let route of routes) {
|
|
346
|
-
walk(route
|
|
349
|
+
walk(route);
|
|
347
350
|
}
|
|
348
351
|
return routeManifest;
|
|
349
352
|
}
|
|
@@ -520,11 +523,11 @@ async function resolveConfig({
|
|
|
520
523
|
`Could not find a root route module in the app directory as "${rootRouteDisplayPath}"`
|
|
521
524
|
);
|
|
522
525
|
}
|
|
523
|
-
let routes
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
526
|
+
let routes;
|
|
527
|
+
let routeConfig = [];
|
|
528
|
+
if (skipRoutes) {
|
|
529
|
+
routes = {};
|
|
530
|
+
} else {
|
|
528
531
|
let routeConfigFile = findEntry(appDirectory, "routes");
|
|
529
532
|
try {
|
|
530
533
|
if (!routeConfigFile) {
|
|
@@ -540,18 +543,22 @@ async function resolveConfig({
|
|
|
540
543
|
let routeConfigExport = (await viteNodeContext.runner.executeFile(
|
|
541
544
|
import_pathe3.default.join(appDirectory, routeConfigFile)
|
|
542
545
|
)).default;
|
|
543
|
-
let routeConfig = await routeConfigExport;
|
|
544
546
|
let result = validateRouteConfig({
|
|
545
547
|
routeConfigFile,
|
|
546
|
-
routeConfig
|
|
548
|
+
routeConfig: await routeConfigExport
|
|
547
549
|
});
|
|
548
550
|
if (!result.valid) {
|
|
549
551
|
return err(result.message);
|
|
550
552
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
553
|
+
routeConfig = [
|
|
554
|
+
{
|
|
555
|
+
id: "root",
|
|
556
|
+
path: "",
|
|
557
|
+
file: rootRouteFile,
|
|
558
|
+
children: result.routeConfig
|
|
559
|
+
}
|
|
560
|
+
];
|
|
561
|
+
routes = configRoutesToRouteManifest(appDirectory, routeConfig);
|
|
555
562
|
} catch (error) {
|
|
556
563
|
return err(
|
|
557
564
|
[
|
|
@@ -584,7 +591,8 @@ async function resolveConfig({
|
|
|
584
591
|
serverBuildFile,
|
|
585
592
|
serverBundles,
|
|
586
593
|
serverModuleFormat,
|
|
587
|
-
ssr
|
|
594
|
+
ssr,
|
|
595
|
+
unstable_routeConfig: routeConfig
|
|
588
596
|
});
|
|
589
597
|
for (let preset of reactRouterUserConfig.presets ?? []) {
|
|
590
598
|
await preset.reactRouterConfigResolved?.({ reactRouterConfig });
|
package/dist/vite.d.ts
CHANGED
package/dist/vite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.
|
|
2
|
+
* @react-router/dev v7.8.0-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -253,9 +253,12 @@ ${message}`
|
|
|
253
253
|
].flat().join("\n\n")
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
|
-
return {
|
|
256
|
+
return {
|
|
257
|
+
valid: true,
|
|
258
|
+
routeConfig
|
|
259
|
+
};
|
|
257
260
|
}
|
|
258
|
-
function configRoutesToRouteManifest(appDirectory, routes
|
|
261
|
+
function configRoutesToRouteManifest(appDirectory, routes) {
|
|
259
262
|
let routeManifest = {};
|
|
260
263
|
function walk(route, parentId) {
|
|
261
264
|
let id = route.id || createRouteId(route.file);
|
|
@@ -280,7 +283,7 @@ function configRoutesToRouteManifest(appDirectory, routes, rootId = "root") {
|
|
|
280
283
|
}
|
|
281
284
|
}
|
|
282
285
|
for (let route of routes) {
|
|
283
|
-
walk(route
|
|
286
|
+
walk(route);
|
|
284
287
|
}
|
|
285
288
|
return routeManifest;
|
|
286
289
|
}
|
|
@@ -480,11 +483,11 @@ async function resolveConfig({
|
|
|
480
483
|
`Could not find a root route module in the app directory as "${rootRouteDisplayPath}"`
|
|
481
484
|
);
|
|
482
485
|
}
|
|
483
|
-
let routes
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
let routes;
|
|
487
|
+
let routeConfig = [];
|
|
488
|
+
if (skipRoutes) {
|
|
489
|
+
routes = {};
|
|
490
|
+
} else {
|
|
488
491
|
let routeConfigFile = findEntry(appDirectory, "routes");
|
|
489
492
|
try {
|
|
490
493
|
if (!routeConfigFile) {
|
|
@@ -500,18 +503,22 @@ async function resolveConfig({
|
|
|
500
503
|
let routeConfigExport = (await viteNodeContext.runner.executeFile(
|
|
501
504
|
import_pathe3.default.join(appDirectory, routeConfigFile)
|
|
502
505
|
)).default;
|
|
503
|
-
let routeConfig = await routeConfigExport;
|
|
504
506
|
let result = validateRouteConfig({
|
|
505
507
|
routeConfigFile,
|
|
506
|
-
routeConfig
|
|
508
|
+
routeConfig: await routeConfigExport
|
|
507
509
|
});
|
|
508
510
|
if (!result.valid) {
|
|
509
511
|
return err(result.message);
|
|
510
512
|
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
513
|
+
routeConfig = [
|
|
514
|
+
{
|
|
515
|
+
id: "root",
|
|
516
|
+
path: "",
|
|
517
|
+
file: rootRouteFile,
|
|
518
|
+
children: result.routeConfig
|
|
519
|
+
}
|
|
520
|
+
];
|
|
521
|
+
routes = configRoutesToRouteManifest(appDirectory, routeConfig);
|
|
515
522
|
} catch (error) {
|
|
516
523
|
return err(
|
|
517
524
|
[
|
|
@@ -544,7 +551,8 @@ async function resolveConfig({
|
|
|
544
551
|
serverBuildFile,
|
|
545
552
|
serverBundles,
|
|
546
553
|
serverModuleFormat,
|
|
547
|
-
ssr
|
|
554
|
+
ssr,
|
|
555
|
+
unstable_routeConfig: routeConfig
|
|
548
556
|
});
|
|
549
557
|
for (let preset of reactRouterUserConfig.presets ?? []) {
|
|
550
558
|
await preset.reactRouterConfigResolved?.({ reactRouterConfig });
|
|
@@ -1510,6 +1518,7 @@ var removeExports = (ast, exportsToRemove) => {
|
|
|
1510
1518
|
let previouslyReferencedIdentifiers = (0, import_babel_dead_code_elimination.findReferencedIdentifiers)(ast);
|
|
1511
1519
|
let exportsFiltered = false;
|
|
1512
1520
|
let markedForRemoval = /* @__PURE__ */ new Set();
|
|
1521
|
+
let removedExportLocalNames = /* @__PURE__ */ new Set();
|
|
1513
1522
|
traverse(ast, {
|
|
1514
1523
|
ExportDeclaration(path6) {
|
|
1515
1524
|
if (path6.node.type === "ExportNamedDeclaration") {
|
|
@@ -1518,6 +1527,9 @@ var removeExports = (ast, exportsToRemove) => {
|
|
|
1518
1527
|
if (specifier.type === "ExportSpecifier" && specifier.exported.type === "Identifier") {
|
|
1519
1528
|
if (exportsToRemove.includes(specifier.exported.name)) {
|
|
1520
1529
|
exportsFiltered = true;
|
|
1530
|
+
if (specifier.local && specifier.local.name !== specifier.exported.name) {
|
|
1531
|
+
removedExportLocalNames.add(specifier.local.name);
|
|
1532
|
+
}
|
|
1521
1533
|
return false;
|
|
1522
1534
|
}
|
|
1523
1535
|
}
|
|
@@ -1558,8 +1570,30 @@ var removeExports = (ast, exportsToRemove) => {
|
|
|
1558
1570
|
}
|
|
1559
1571
|
}
|
|
1560
1572
|
}
|
|
1561
|
-
if (path6.node.type === "ExportDefaultDeclaration"
|
|
1562
|
-
|
|
1573
|
+
if (path6.node.type === "ExportDefaultDeclaration") {
|
|
1574
|
+
if (exportsToRemove.includes("default")) {
|
|
1575
|
+
markedForRemoval.add(path6);
|
|
1576
|
+
if (path6.node.declaration) {
|
|
1577
|
+
if (path6.node.declaration.type === "Identifier") {
|
|
1578
|
+
removedExportLocalNames.add(path6.node.declaration.name);
|
|
1579
|
+
} else if ((path6.node.declaration.type === "FunctionDeclaration" || path6.node.declaration.type === "ClassDeclaration") && path6.node.declaration.id) {
|
|
1580
|
+
removedExportLocalNames.add(path6.node.declaration.id.name);
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
});
|
|
1587
|
+
traverse(ast, {
|
|
1588
|
+
ExpressionStatement(path6) {
|
|
1589
|
+
if (!path6.parentPath.isProgram()) {
|
|
1590
|
+
return;
|
|
1591
|
+
}
|
|
1592
|
+
if (path6.node.expression.type === "AssignmentExpression") {
|
|
1593
|
+
const left = path6.node.expression.left;
|
|
1594
|
+
if (left.type === "MemberExpression" && left.object.type === "Identifier" && (exportsToRemove.includes(left.object.name) || removedExportLocalNames.has(left.object.name))) {
|
|
1595
|
+
markedForRemoval.add(path6);
|
|
1596
|
+
}
|
|
1563
1597
|
}
|
|
1564
1598
|
}
|
|
1565
1599
|
});
|
|
@@ -3397,6 +3431,7 @@ var reactRouterVitePlugin = () => {
|
|
|
3397
3431
|
let dest = path5.join(clientBuildDirectory, ssrAssetPath);
|
|
3398
3432
|
if (!userSsrEmitAssets) {
|
|
3399
3433
|
if (!(0, import_node_fs2.existsSync)(dest)) {
|
|
3434
|
+
await (0, import_promises2.mkdir)(path5.dirname(dest), { recursive: true });
|
|
3400
3435
|
await (0, import_promises2.rename)(src, dest);
|
|
3401
3436
|
movedAssetPaths.push(dest);
|
|
3402
3437
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-router/dev",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.8.0-pre.0",
|
|
4
4
|
"description": "Dev tools and CLI for React Router",
|
|
5
5
|
"homepage": "https://reactrouter.com",
|
|
6
6
|
"bugs": {
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"types": "./dist/vite/cloudflare.d.ts",
|
|
30
30
|
"default": "./dist/vite/cloudflare.js"
|
|
31
31
|
},
|
|
32
|
+
"./internal": {
|
|
33
|
+
"types": "./dist/internal.d.ts",
|
|
34
|
+
"default": "./dist/internal.js"
|
|
35
|
+
},
|
|
32
36
|
"./package.json": "./package.json"
|
|
33
37
|
},
|
|
34
38
|
"imports": {
|
|
@@ -69,6 +73,8 @@
|
|
|
69
73
|
"@babel/traverse": "^7.27.7",
|
|
70
74
|
"@babel/types": "^7.27.7",
|
|
71
75
|
"@npmcli/package-json": "^4.0.1",
|
|
76
|
+
"@vitejs/plugin-react": "^4.5.2",
|
|
77
|
+
"@vitejs/plugin-rsc": "0.4.11",
|
|
72
78
|
"arg": "^5.0.1",
|
|
73
79
|
"babel-dead-code-elimination": "^1.0.6",
|
|
74
80
|
"chokidar": "^4.0.0",
|
|
@@ -86,7 +92,7 @@
|
|
|
86
92
|
"tinyglobby": "^0.2.14",
|
|
87
93
|
"valibot": "^0.41.0",
|
|
88
94
|
"vite-node": "^3.2.2",
|
|
89
|
-
"@react-router/node": "7.
|
|
95
|
+
"@react-router/node": "7.8.0-pre.0"
|
|
90
96
|
},
|
|
91
97
|
"devDependencies": {
|
|
92
98
|
"@types/babel__core": "^7.20.5",
|
|
@@ -109,15 +115,15 @@
|
|
|
109
115
|
"vite": "^6.1.0",
|
|
110
116
|
"wireit": "0.14.9",
|
|
111
117
|
"wrangler": "^4.23.0",
|
|
112
|
-
"@react-router/serve": "7.
|
|
113
|
-
"react-router": "^7.
|
|
118
|
+
"@react-router/serve": "7.8.0-pre.0",
|
|
119
|
+
"react-router": "^7.8.0-pre.0"
|
|
114
120
|
},
|
|
115
121
|
"peerDependencies": {
|
|
116
122
|
"typescript": "^5.1.0",
|
|
117
123
|
"vite": "^5.1.0 || ^6.0.0 || ^7.0.0",
|
|
118
124
|
"wrangler": "^3.28.2 || ^4.0.0",
|
|
119
|
-
"@react-router/serve": "^7.
|
|
120
|
-
"react-router": "^7.
|
|
125
|
+
"@react-router/serve": "^7.8.0-pre.0",
|
|
126
|
+
"react-router": "^7.8.0-pre.0"
|
|
121
127
|
},
|
|
122
128
|
"peerDependenciesMeta": {
|
|
123
129
|
"@react-router/serve": {
|