@c0va23/react-router-dev 7.8.3-alpha.2 → 7.9.4-patch.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 +170 -0
- package/dist/cli/index.js +245 -105
- package/dist/config/default-rsc-entries/entry.client.tsx +9 -1
- package/dist/config/default-rsc-entries/entry.rsc.tsx +12 -1
- package/dist/config/default-rsc-entries/entry.ssr.tsx +5 -1
- package/dist/config/defaults/entry.server.node.tsx +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/routes.js +1 -1
- package/dist/vite/cloudflare.d.ts +2 -2
- package/dist/vite/cloudflare.js +30 -82
- package/dist/vite.d.ts +3 -1
- package/dist/vite.js +1304 -364
- package/package.json +14 -15
- package/dist/internal.d.ts +0 -9
- package/dist/internal.js +0 -2010
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* @c0va23/react-router-dev v7.
|
|
3
|
+
* @c0va23/react-router-dev v7.9.4-patch.1
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
6
6
|
*
|
|
@@ -217,7 +217,7 @@ function validateRouteConfig({
|
|
|
217
217
|
`Route config in "${routeConfigFile}" is invalid.`,
|
|
218
218
|
root ? `${root}` : [],
|
|
219
219
|
nested ? Object.entries(nested).map(
|
|
220
|
-
([
|
|
220
|
+
([path9, message]) => `Path: routes.${path9}
|
|
221
221
|
${message}`
|
|
222
222
|
) : []
|
|
223
223
|
].flat().join("\n\n")
|
|
@@ -311,7 +311,8 @@ async function resolveConfig({
|
|
|
311
311
|
root,
|
|
312
312
|
viteNodeContext,
|
|
313
313
|
reactRouterConfigFile,
|
|
314
|
-
skipRoutes
|
|
314
|
+
skipRoutes,
|
|
315
|
+
validateConfig
|
|
315
316
|
}) {
|
|
316
317
|
let reactRouterUserConfig = {};
|
|
317
318
|
if (reactRouterConfigFile) {
|
|
@@ -329,6 +330,12 @@ async function resolveConfig({
|
|
|
329
330
|
return err(`${reactRouterConfigFile} must export a config`);
|
|
330
331
|
}
|
|
331
332
|
reactRouterUserConfig = configModule.default;
|
|
333
|
+
if (validateConfig) {
|
|
334
|
+
const error = validateConfig(reactRouterUserConfig);
|
|
335
|
+
if (error) {
|
|
336
|
+
return err(error);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
332
339
|
} catch (error) {
|
|
333
340
|
return err(`Error loading ${reactRouterConfigFile}: ${error}`);
|
|
334
341
|
}
|
|
@@ -417,7 +424,7 @@ async function resolveConfig({
|
|
|
417
424
|
}
|
|
418
425
|
let appDirectory = import_pathe3.default.resolve(root, userAppDirectory || "app");
|
|
419
426
|
let buildDirectory = import_pathe3.default.resolve(root, userBuildDirectory);
|
|
420
|
-
let rootRouteFile = findEntry(appDirectory, "root");
|
|
427
|
+
let rootRouteFile = findEntry(appDirectory, "root", { absolute: true });
|
|
421
428
|
if (!rootRouteFile) {
|
|
422
429
|
let rootRouteDisplayPath = import_pathe3.default.relative(
|
|
423
430
|
root,
|
|
@@ -458,7 +465,7 @@ async function resolveConfig({
|
|
|
458
465
|
{
|
|
459
466
|
id: "root",
|
|
460
467
|
path: "",
|
|
461
|
-
file: rootRouteFile,
|
|
468
|
+
file: import_pathe3.default.relative(appDirectory, rootRouteFile),
|
|
462
469
|
children: result.routeConfig
|
|
463
470
|
}
|
|
464
471
|
];
|
|
@@ -477,11 +484,11 @@ async function resolveConfig({
|
|
|
477
484
|
}
|
|
478
485
|
}
|
|
479
486
|
let future = {
|
|
480
|
-
|
|
481
|
-
unstable_optimizeDeps:
|
|
482
|
-
unstable_splitRouteModules:
|
|
483
|
-
unstable_subResourceIntegrity:
|
|
484
|
-
unstable_viteEnvironmentApi:
|
|
487
|
+
v8_middleware: userAndPresetConfigs.future?.v8_middleware ?? false,
|
|
488
|
+
unstable_optimizeDeps: userAndPresetConfigs.future?.unstable_optimizeDeps ?? false,
|
|
489
|
+
unstable_splitRouteModules: userAndPresetConfigs.future?.unstable_splitRouteModules ?? false,
|
|
490
|
+
unstable_subResourceIntegrity: userAndPresetConfigs.future?.unstable_subResourceIntegrity ?? false,
|
|
491
|
+
unstable_viteEnvironmentApi: userAndPresetConfigs.future?.unstable_viteEnvironmentApi ?? false
|
|
485
492
|
};
|
|
486
493
|
let reactRouterConfig = deepFreeze({
|
|
487
494
|
appDirectory,
|
|
@@ -507,7 +514,8 @@ async function createConfigLoader({
|
|
|
507
514
|
rootDirectory: root,
|
|
508
515
|
watch: watch2,
|
|
509
516
|
mode,
|
|
510
|
-
skipRoutes
|
|
517
|
+
skipRoutes,
|
|
518
|
+
validateConfig
|
|
511
519
|
}) {
|
|
512
520
|
root = import_pathe3.default.normalize(root ?? process.env.REACT_ROUTER_ROOT ?? process.cwd());
|
|
513
521
|
let vite2 = await import("vite");
|
|
@@ -526,7 +534,13 @@ async function createConfigLoader({
|
|
|
526
534
|
});
|
|
527
535
|
};
|
|
528
536
|
updateReactRouterConfigFile();
|
|
529
|
-
let getConfig = () => resolveConfig({
|
|
537
|
+
let getConfig = () => resolveConfig({
|
|
538
|
+
root,
|
|
539
|
+
viteNodeContext,
|
|
540
|
+
reactRouterConfigFile,
|
|
541
|
+
skipRoutes,
|
|
542
|
+
validateConfig
|
|
543
|
+
});
|
|
530
544
|
let appDirectory;
|
|
531
545
|
let initialConfigResult = await getConfig();
|
|
532
546
|
if (!initialConfigResult.ok) {
|
|
@@ -548,11 +562,11 @@ async function createConfigLoader({
|
|
|
548
562
|
if (!fsWatcher) {
|
|
549
563
|
fsWatcher = import_chokidar.default.watch([root, appDirectory], {
|
|
550
564
|
ignoreInitial: true,
|
|
551
|
-
ignored: (
|
|
552
|
-
let dirname5 = import_pathe3.default.dirname(
|
|
565
|
+
ignored: (path9) => {
|
|
566
|
+
let dirname5 = import_pathe3.default.dirname(path9);
|
|
553
567
|
return !dirname5.startsWith(appDirectory) && // Ensure we're only watching files outside of the app directory
|
|
554
568
|
// that are at the root level, not nested in subdirectories
|
|
555
|
-
|
|
569
|
+
path9 !== root && // Watch the root directory itself
|
|
556
570
|
dirname5 !== root;
|
|
557
571
|
}
|
|
558
572
|
});
|
|
@@ -798,7 +812,8 @@ var init_profiler = __esm({
|
|
|
798
812
|
async function createContext2({
|
|
799
813
|
rootDirectory,
|
|
800
814
|
watch: watch2,
|
|
801
|
-
mode
|
|
815
|
+
mode,
|
|
816
|
+
rsc
|
|
802
817
|
}) {
|
|
803
818
|
const configLoader = await createConfigLoader({ rootDirectory, mode, watch: watch2 });
|
|
804
819
|
const configResult = await configLoader.getConfig();
|
|
@@ -809,7 +824,8 @@ async function createContext2({
|
|
|
809
824
|
return {
|
|
810
825
|
configLoader,
|
|
811
826
|
rootDirectory,
|
|
812
|
-
config
|
|
827
|
+
config,
|
|
828
|
+
rsc
|
|
813
829
|
};
|
|
814
830
|
}
|
|
815
831
|
var init_context = __esm({
|
|
@@ -876,7 +892,7 @@ function fullpath(lineage2) {
|
|
|
876
892
|
if (lineage2.length === 1 && route?.id === "root") return "/";
|
|
877
893
|
const isLayout = route && route.index !== true && route.path === void 0;
|
|
878
894
|
if (isLayout) return void 0;
|
|
879
|
-
return "/" + lineage2.map((route2) => route2.path?.replace(/^\//, "")?.replace(/\/$/, "")).filter((
|
|
895
|
+
return "/" + lineage2.map((route2) => route2.path?.replace(/^\//, "")?.replace(/\/$/, "")).filter((path9) => path9 !== void 0 && path9 !== "").join("/");
|
|
880
896
|
}
|
|
881
897
|
var init_route = __esm({
|
|
882
898
|
"typegen/route.ts"() {
|
|
@@ -897,7 +913,7 @@ function generateFuture(ctx) {
|
|
|
897
913
|
|
|
898
914
|
declare module "react-router" {
|
|
899
915
|
interface Future {
|
|
900
|
-
|
|
916
|
+
v8_middleware: ${ctx.config.future.v8_middleware}
|
|
901
917
|
}
|
|
902
918
|
}
|
|
903
919
|
`;
|
|
@@ -964,9 +980,10 @@ function generateRoutes(ctx) {
|
|
|
964
980
|
interface Register {
|
|
965
981
|
pages: Pages
|
|
966
982
|
routeFiles: RouteFiles
|
|
983
|
+
routeModules: RouteModules
|
|
967
984
|
}
|
|
968
985
|
}
|
|
969
|
-
` + "\n\n" + generate(pagesType(allPages)).code + "\n\n" + generate(routeFilesType({ fileToRoutes, routeToPages })).code
|
|
986
|
+
` + "\n\n" + generate(pagesType(allPages)).code + "\n\n" + generate(routeFilesType({ fileToRoutes, routeToPages })).code + "\n\n" + generate(routeModulesType(ctx)).code
|
|
970
987
|
};
|
|
971
988
|
const allAnnotations = Array.from(fileToRoutes.entries()).filter(([file]) => isInAppDirectory(ctx, file)).map(
|
|
972
989
|
([file, routeIds]) => getRouteAnnotations({ ctx, file, routeIds, lineages })
|
|
@@ -1035,9 +1052,31 @@ function routeFilesType({
|
|
|
1035
1052
|
)
|
|
1036
1053
|
);
|
|
1037
1054
|
}
|
|
1055
|
+
function routeModulesType(ctx) {
|
|
1056
|
+
return t2.tsTypeAliasDeclaration(
|
|
1057
|
+
t2.identifier("RouteModules"),
|
|
1058
|
+
null,
|
|
1059
|
+
t2.tsTypeLiteral(
|
|
1060
|
+
Object.values(ctx.config.routes).map(
|
|
1061
|
+
(route) => t2.tsPropertySignature(
|
|
1062
|
+
t2.stringLiteral(route.id),
|
|
1063
|
+
t2.tsTypeAnnotation(
|
|
1064
|
+
t2.tsTypeQuery(
|
|
1065
|
+
t2.tsImportType(
|
|
1066
|
+
t2.stringLiteral(
|
|
1067
|
+
`./${Path3.relative(ctx.rootDirectory, ctx.config.appDirectory)}/${route.file}`
|
|
1068
|
+
)
|
|
1069
|
+
)
|
|
1070
|
+
)
|
|
1071
|
+
)
|
|
1072
|
+
)
|
|
1073
|
+
)
|
|
1074
|
+
)
|
|
1075
|
+
);
|
|
1076
|
+
}
|
|
1038
1077
|
function isInAppDirectory(ctx, routeFile) {
|
|
1039
|
-
const
|
|
1040
|
-
return
|
|
1078
|
+
const path9 = Path3.resolve(ctx.config.appDirectory, routeFile);
|
|
1079
|
+
return path9.startsWith(ctx.config.appDirectory);
|
|
1041
1080
|
}
|
|
1042
1081
|
function getRouteAnnotations({
|
|
1043
1082
|
ctx,
|
|
@@ -1102,7 +1141,7 @@ function getRouteAnnotations({
|
|
|
1102
1141
|
module: Module
|
|
1103
1142
|
}>
|
|
1104
1143
|
` + "\n\n" + generate(matchesType).code + "\n\n" + import_dedent.default`
|
|
1105
|
-
type Annotations = GetAnnotations<Info & { module: Module, matches: Matches }>;
|
|
1144
|
+
type Annotations = GetAnnotations<Info & { module: Module, matches: Matches }, ${ctx.rsc}>;
|
|
1106
1145
|
|
|
1107
1146
|
export namespace Route {
|
|
1108
1147
|
// links
|
|
@@ -1118,11 +1157,11 @@ function getRouteAnnotations({
|
|
|
1118
1157
|
export type HeadersArgs = Annotations["HeadersArgs"];
|
|
1119
1158
|
export type HeadersFunction = Annotations["HeadersFunction"];
|
|
1120
1159
|
|
|
1121
|
-
//
|
|
1122
|
-
export type
|
|
1160
|
+
// middleware
|
|
1161
|
+
export type MiddlewareFunction = Annotations["MiddlewareFunction"];
|
|
1123
1162
|
|
|
1124
|
-
//
|
|
1125
|
-
export type
|
|
1163
|
+
// clientMiddleware
|
|
1164
|
+
export type ClientMiddlewareFunction = Annotations["ClientMiddlewareFunction"];
|
|
1126
1165
|
|
|
1127
1166
|
// loader
|
|
1128
1167
|
export type LoaderArgs = Annotations["LoaderArgs"];
|
|
@@ -1149,21 +1188,21 @@ function getRouteAnnotations({
|
|
|
1149
1188
|
return { filename: filename2, content };
|
|
1150
1189
|
}
|
|
1151
1190
|
function relativeImportSource(from, to) {
|
|
1152
|
-
let
|
|
1153
|
-
let extension = Path3.extname(
|
|
1154
|
-
|
|
1155
|
-
if (!
|
|
1191
|
+
let path9 = Path3.relative(Path3.dirname(from), to);
|
|
1192
|
+
let extension = Path3.extname(path9);
|
|
1193
|
+
path9 = Path3.join(Path3.dirname(path9), Pathe.filename(path9));
|
|
1194
|
+
if (!path9.startsWith("../")) path9 = "./" + path9;
|
|
1156
1195
|
if (!extension || /\.(js|ts)x?$/.test(extension)) {
|
|
1157
1196
|
extension = ".js";
|
|
1158
1197
|
}
|
|
1159
|
-
return
|
|
1198
|
+
return path9 + extension;
|
|
1160
1199
|
}
|
|
1161
1200
|
function rootDirsPath(ctx, typesPath) {
|
|
1162
1201
|
const rel = Path3.relative(typesDirectory(ctx), typesPath);
|
|
1163
1202
|
return Path3.join(ctx.rootDirectory, rel);
|
|
1164
1203
|
}
|
|
1165
|
-
function paramsType(
|
|
1166
|
-
const params = parse2(
|
|
1204
|
+
function paramsType(path9) {
|
|
1205
|
+
const params = parse2(path9);
|
|
1167
1206
|
return t2.tsTypeLiteral(
|
|
1168
1207
|
Object.entries(params).map(([param, isRequired]) => {
|
|
1169
1208
|
const property = t2.tsPropertySignature(
|
|
@@ -1226,8 +1265,8 @@ async function write(...files) {
|
|
|
1226
1265
|
})
|
|
1227
1266
|
);
|
|
1228
1267
|
}
|
|
1229
|
-
async function run(rootDirectory, { mode }) {
|
|
1230
|
-
const ctx = await createContext2({ rootDirectory, mode, watch: false });
|
|
1268
|
+
async function run(rootDirectory, { mode, rsc }) {
|
|
1269
|
+
const ctx = await createContext2({ rootDirectory, mode, rsc, watch: false });
|
|
1231
1270
|
await import_promises.default.rm(typesDirectory(ctx), { recursive: true, force: true });
|
|
1232
1271
|
await write(
|
|
1233
1272
|
generateFuture(ctx),
|
|
@@ -1235,8 +1274,8 @@ async function run(rootDirectory, { mode }) {
|
|
|
1235
1274
|
...generateRoutes(ctx)
|
|
1236
1275
|
);
|
|
1237
1276
|
}
|
|
1238
|
-
async function watch(rootDirectory, { mode, logger }) {
|
|
1239
|
-
const ctx = await createContext2({ rootDirectory, mode, watch: true });
|
|
1277
|
+
async function watch(rootDirectory, { mode, logger, rsc }) {
|
|
1278
|
+
const ctx = await createContext2({ rootDirectory, mode, rsc, watch: true });
|
|
1240
1279
|
await import_promises.default.rm(typesDirectory(ctx), { recursive: true, force: true });
|
|
1241
1280
|
await write(
|
|
1242
1281
|
generateFuture(ctx),
|
|
@@ -1284,16 +1323,42 @@ var init_typegen = __esm({
|
|
|
1284
1323
|
}
|
|
1285
1324
|
});
|
|
1286
1325
|
|
|
1326
|
+
// vite/has-rsc-plugin.ts
|
|
1327
|
+
async function hasReactRouterRscPlugin({
|
|
1328
|
+
root,
|
|
1329
|
+
viteBuildOptions: { config, logLevel, mode }
|
|
1330
|
+
}) {
|
|
1331
|
+
const vite2 = await import("vite");
|
|
1332
|
+
const viteConfig = await vite2.resolveConfig(
|
|
1333
|
+
{
|
|
1334
|
+
configFile: config,
|
|
1335
|
+
logLevel,
|
|
1336
|
+
mode: mode ?? "production",
|
|
1337
|
+
root
|
|
1338
|
+
},
|
|
1339
|
+
"build",
|
|
1340
|
+
// command
|
|
1341
|
+
"production",
|
|
1342
|
+
// default mode
|
|
1343
|
+
"production"
|
|
1344
|
+
// default NODE_ENV
|
|
1345
|
+
);
|
|
1346
|
+
return viteConfig.plugins.some(
|
|
1347
|
+
(plugin) => plugin?.name === "react-router/rsc"
|
|
1348
|
+
);
|
|
1349
|
+
}
|
|
1350
|
+
var init_has_rsc_plugin = __esm({
|
|
1351
|
+
"vite/has-rsc-plugin.ts"() {
|
|
1352
|
+
"use strict";
|
|
1353
|
+
}
|
|
1354
|
+
});
|
|
1355
|
+
|
|
1287
1356
|
// vite/node-adapter.ts
|
|
1288
|
-
var
|
|
1357
|
+
var import_node_fetch_server;
|
|
1289
1358
|
var init_node_adapter = __esm({
|
|
1290
1359
|
"vite/node-adapter.ts"() {
|
|
1291
1360
|
"use strict";
|
|
1292
|
-
|
|
1293
|
-
import_node_tls = require("tls");
|
|
1294
|
-
import_node_stream = require("stream");
|
|
1295
|
-
import_set_cookie_parser = require("set-cookie-parser");
|
|
1296
|
-
import_node = require("@react-router/node");
|
|
1361
|
+
import_node_fetch_server = require("@remix-run/node-fetch-server");
|
|
1297
1362
|
init_invariant();
|
|
1298
1363
|
}
|
|
1299
1364
|
});
|
|
@@ -1337,6 +1402,16 @@ var init_virtual_module = __esm({
|
|
|
1337
1402
|
}
|
|
1338
1403
|
});
|
|
1339
1404
|
|
|
1405
|
+
// vite/resolve-relative-route-file-path.ts
|
|
1406
|
+
var import_pathe4;
|
|
1407
|
+
var init_resolve_relative_route_file_path = __esm({
|
|
1408
|
+
"vite/resolve-relative-route-file-path.ts"() {
|
|
1409
|
+
"use strict";
|
|
1410
|
+
import_pathe4 = __toESM(require("pathe"));
|
|
1411
|
+
init_vite();
|
|
1412
|
+
}
|
|
1413
|
+
});
|
|
1414
|
+
|
|
1340
1415
|
// vite/combine-urls.ts
|
|
1341
1416
|
var init_combine_urls = __esm({
|
|
1342
1417
|
"vite/combine-urls.ts"() {
|
|
@@ -1354,6 +1429,13 @@ var init_remove_exports = __esm({
|
|
|
1354
1429
|
}
|
|
1355
1430
|
});
|
|
1356
1431
|
|
|
1432
|
+
// vite/has-dependency.ts
|
|
1433
|
+
var init_has_dependency = __esm({
|
|
1434
|
+
"vite/has-dependency.ts"() {
|
|
1435
|
+
"use strict";
|
|
1436
|
+
}
|
|
1437
|
+
});
|
|
1438
|
+
|
|
1357
1439
|
// vite/cache.ts
|
|
1358
1440
|
var init_cache = __esm({
|
|
1359
1441
|
"vite/cache.ts"() {
|
|
@@ -1393,7 +1475,7 @@ var init_route_chunks = __esm({
|
|
|
1393
1475
|
routeChunkExportNames = [
|
|
1394
1476
|
"clientAction",
|
|
1395
1477
|
"clientLoader",
|
|
1396
|
-
"
|
|
1478
|
+
"clientMiddleware",
|
|
1397
1479
|
"HydrateFallback"
|
|
1398
1480
|
];
|
|
1399
1481
|
mainChunkName = "main";
|
|
@@ -1403,12 +1485,23 @@ var init_route_chunks = __esm({
|
|
|
1403
1485
|
main: `${routeChunkQueryStringPrefix}main`,
|
|
1404
1486
|
clientAction: `${routeChunkQueryStringPrefix}clientAction`,
|
|
1405
1487
|
clientLoader: `${routeChunkQueryStringPrefix}clientLoader`,
|
|
1406
|
-
|
|
1488
|
+
clientMiddleware: `${routeChunkQueryStringPrefix}clientMiddleware`,
|
|
1407
1489
|
HydrateFallback: `${routeChunkQueryStringPrefix}HydrateFallback`
|
|
1408
1490
|
};
|
|
1409
1491
|
}
|
|
1410
1492
|
});
|
|
1411
1493
|
|
|
1494
|
+
// vite/optimize-deps-entries.ts
|
|
1495
|
+
var import_tinyglobby;
|
|
1496
|
+
var init_optimize_deps_entries = __esm({
|
|
1497
|
+
"vite/optimize-deps-entries.ts"() {
|
|
1498
|
+
"use strict";
|
|
1499
|
+
import_tinyglobby = require("tinyglobby");
|
|
1500
|
+
init_resolve_relative_route_file_path();
|
|
1501
|
+
init_vite();
|
|
1502
|
+
}
|
|
1503
|
+
});
|
|
1504
|
+
|
|
1412
1505
|
// vite/with-props.ts
|
|
1413
1506
|
var init_with_props = __esm({
|
|
1414
1507
|
"vite/with-props.ts"() {
|
|
@@ -1417,6 +1510,13 @@ var init_with_props = __esm({
|
|
|
1417
1510
|
}
|
|
1418
1511
|
});
|
|
1419
1512
|
|
|
1513
|
+
// vite/load-dotenv.ts
|
|
1514
|
+
var init_load_dotenv = __esm({
|
|
1515
|
+
"vite/load-dotenv.ts"() {
|
|
1516
|
+
"use strict";
|
|
1517
|
+
}
|
|
1518
|
+
});
|
|
1519
|
+
|
|
1420
1520
|
// vite/plugins/validate-plugin-order.ts
|
|
1421
1521
|
var init_validate_plugin_order = __esm({
|
|
1422
1522
|
"vite/plugins/validate-plugin-order.ts"() {
|
|
@@ -1424,6 +1524,16 @@ var init_validate_plugin_order = __esm({
|
|
|
1424
1524
|
}
|
|
1425
1525
|
});
|
|
1426
1526
|
|
|
1527
|
+
// vite/plugins/warn-on-client-source-maps.ts
|
|
1528
|
+
var import_picocolors4;
|
|
1529
|
+
var init_warn_on_client_source_maps = __esm({
|
|
1530
|
+
"vite/plugins/warn-on-client-source-maps.ts"() {
|
|
1531
|
+
"use strict";
|
|
1532
|
+
import_picocolors4 = __toESM(require("picocolors"));
|
|
1533
|
+
init_invariant();
|
|
1534
|
+
}
|
|
1535
|
+
});
|
|
1536
|
+
|
|
1427
1537
|
// vite/plugin.ts
|
|
1428
1538
|
async function resolveViteConfig({
|
|
1429
1539
|
configFile,
|
|
@@ -1466,8 +1576,8 @@ function getServerBundleIds(ctx) {
|
|
|
1466
1576
|
async function cleanBuildDirectory(viteConfig, ctx) {
|
|
1467
1577
|
let buildDirectory = ctx.reactRouterConfig.buildDirectory;
|
|
1468
1578
|
let isWithinRoot = () => {
|
|
1469
|
-
let relativePath =
|
|
1470
|
-
return !relativePath.startsWith("..") && !
|
|
1579
|
+
let relativePath = path7.relative(ctx.rootDirectory, buildDirectory);
|
|
1580
|
+
return !relativePath.startsWith("..") && !path7.isAbsolute(relativePath);
|
|
1471
1581
|
};
|
|
1472
1582
|
if (viteConfig.build.emptyOutDir ?? isWithinRoot()) {
|
|
1473
1583
|
await (0, import_promises2.rm)(buildDirectory, { force: true, recursive: true });
|
|
@@ -1478,7 +1588,7 @@ async function cleanViteManifests(environmentsOptions, ctx) {
|
|
|
1478
1588
|
([environmentName, options]) => {
|
|
1479
1589
|
let outDir = options.build?.outDir;
|
|
1480
1590
|
invariant(outDir, `Expected build.outDir for ${environmentName}`);
|
|
1481
|
-
return
|
|
1591
|
+
return path7.join(outDir, ".vite/manifest.json");
|
|
1482
1592
|
}
|
|
1483
1593
|
);
|
|
1484
1594
|
await Promise.all(
|
|
@@ -1488,7 +1598,7 @@ async function cleanViteManifests(environmentsOptions, ctx) {
|
|
|
1488
1598
|
if (!ctx.viteManifestEnabled) {
|
|
1489
1599
|
await (0, import_promises2.rm)(viteManifestPath, { force: true, recursive: true });
|
|
1490
1600
|
}
|
|
1491
|
-
let viteDir =
|
|
1601
|
+
let viteDir = path7.dirname(viteManifestPath);
|
|
1492
1602
|
let viteDirFiles = await (0, import_promises2.readdir)(viteDir, { recursive: true });
|
|
1493
1603
|
if (viteDirFiles.length === 0) {
|
|
1494
1604
|
await (0, import_promises2.rm)(viteDir, { force: true, recursive: true });
|
|
@@ -1505,10 +1615,10 @@ function mergeEnvironmentOptions(base, ...overrides) {
|
|
|
1505
1615
|
}
|
|
1506
1616
|
async function getEnvironmentOptionsResolvers(ctx, viteCommand) {
|
|
1507
1617
|
let { serverBuildFile, serverModuleFormat } = ctx.reactRouterConfig;
|
|
1508
|
-
let packageRoot =
|
|
1618
|
+
let packageRoot = path7.dirname(
|
|
1509
1619
|
require.resolve("@react-router/dev/package.json")
|
|
1510
1620
|
);
|
|
1511
|
-
let { moduleSyncEnabled } = await import(`file:///${
|
|
1621
|
+
let { moduleSyncEnabled } = await import(`file:///${path7.join(packageRoot, "module-sync-enabled/index.mjs")}`);
|
|
1512
1622
|
let vite2 = getVite();
|
|
1513
1623
|
function getBaseOptions({
|
|
1514
1624
|
viteUserConfig
|
|
@@ -1587,7 +1697,7 @@ async function getEnvironmentOptionsResolvers(ctx, viteCommand) {
|
|
|
1587
1697
|
ctx.entryClientFilePath,
|
|
1588
1698
|
...Object.values(ctx.reactRouterConfig.routes).flatMap(
|
|
1589
1699
|
(route) => {
|
|
1590
|
-
let routeFilePath =
|
|
1700
|
+
let routeFilePath = path7.resolve(
|
|
1591
1701
|
ctx.reactRouterConfig.appDirectory,
|
|
1592
1702
|
route.file
|
|
1593
1703
|
);
|
|
@@ -1611,7 +1721,7 @@ async function getEnvironmentOptionsResolvers(ctx, viteCommand) {
|
|
|
1611
1721
|
) : null;
|
|
1612
1722
|
let routeChunkSuffix = routeChunkName ? `-${(0, import_kebabCase.default)(routeChunkName)}` : "";
|
|
1613
1723
|
let assetsDir = (ctx.reactRouterConfig.future.unstable_viteEnvironmentApi ? viteUserConfig?.environments?.client?.build?.assetsDir : null) ?? viteUserConfig?.build?.assetsDir ?? "assets";
|
|
1614
|
-
return
|
|
1724
|
+
return path7.posix.join(
|
|
1615
1725
|
assetsDir,
|
|
1616
1726
|
`[name]${routeChunkSuffix}-[hash].js`
|
|
1617
1727
|
);
|
|
@@ -1661,22 +1771,22 @@ function resolveEnvironmentsOptions(environmentResolvers, resolverOptions) {
|
|
|
1661
1771
|
function isNonNullable(x) {
|
|
1662
1772
|
return x != null;
|
|
1663
1773
|
}
|
|
1664
|
-
var import_node_crypto, import_node_fs3, import_promises2,
|
|
1774
|
+
var import_node_crypto, import_node_fs3, import_promises2, path7, url, babel2, import_node_fetch_server2, import_react_router2, import_es_module_lexer, import_pick3, import_jsesc, import_picocolors5, 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;
|
|
1665
1775
|
var init_plugin = __esm({
|
|
1666
1776
|
"vite/plugin.ts"() {
|
|
1667
1777
|
"use strict";
|
|
1668
1778
|
import_node_crypto = require("crypto");
|
|
1669
1779
|
import_node_fs3 = require("fs");
|
|
1670
1780
|
import_promises2 = require("fs/promises");
|
|
1671
|
-
|
|
1781
|
+
path7 = __toESM(require("path"));
|
|
1672
1782
|
url = __toESM(require("url"));
|
|
1673
1783
|
babel2 = __toESM(require("@babel/core"));
|
|
1784
|
+
import_node_fetch_server2 = require("@remix-run/node-fetch-server");
|
|
1674
1785
|
import_react_router2 = require("react-router");
|
|
1675
1786
|
import_es_module_lexer = require("es-module-lexer");
|
|
1676
|
-
import_tinyglobby = require("tinyglobby");
|
|
1677
1787
|
import_pick3 = __toESM(require("lodash/pick"));
|
|
1678
1788
|
import_jsesc = __toESM(require("jsesc"));
|
|
1679
|
-
|
|
1789
|
+
import_picocolors5 = __toESM(require("picocolors"));
|
|
1680
1790
|
import_kebabCase = __toESM(require("lodash/kebabCase"));
|
|
1681
1791
|
init_typegen();
|
|
1682
1792
|
init_invariant();
|
|
@@ -1685,18 +1795,23 @@ var init_plugin = __esm({
|
|
|
1685
1795
|
init_styles();
|
|
1686
1796
|
init_virtual_module();
|
|
1687
1797
|
init_resolve_file_url();
|
|
1798
|
+
init_resolve_relative_route_file_path();
|
|
1688
1799
|
init_combine_urls();
|
|
1689
1800
|
init_remove_exports();
|
|
1690
1801
|
init_ssr_externals();
|
|
1802
|
+
init_has_dependency();
|
|
1691
1803
|
init_route_chunks();
|
|
1692
1804
|
init_vite();
|
|
1693
1805
|
init_config();
|
|
1806
|
+
init_optimize_deps_entries();
|
|
1694
1807
|
init_with_props();
|
|
1808
|
+
init_load_dotenv();
|
|
1695
1809
|
init_validate_plugin_order();
|
|
1810
|
+
init_warn_on_client_source_maps();
|
|
1696
1811
|
CLIENT_NON_COMPONENT_EXPORTS = [
|
|
1697
1812
|
"clientAction",
|
|
1698
1813
|
"clientLoader",
|
|
1699
|
-
"
|
|
1814
|
+
"clientMiddleware",
|
|
1700
1815
|
"handle",
|
|
1701
1816
|
"meta",
|
|
1702
1817
|
"links",
|
|
@@ -1718,20 +1833,20 @@ var init_plugin = __esm({
|
|
|
1718
1833
|
serverManifest: create("server-manifest"),
|
|
1719
1834
|
browserManifest: create("browser-manifest")
|
|
1720
1835
|
};
|
|
1721
|
-
getServerBuildDirectory = (reactRouterConfig, { serverBundleId } = {}) =>
|
|
1836
|
+
getServerBuildDirectory = (reactRouterConfig, { serverBundleId } = {}) => path7.join(
|
|
1722
1837
|
reactRouterConfig.buildDirectory,
|
|
1723
1838
|
"server",
|
|
1724
1839
|
...serverBundleId ? [serverBundleId] : []
|
|
1725
1840
|
);
|
|
1726
|
-
getClientBuildDirectory = (reactRouterConfig) =>
|
|
1727
|
-
defaultEntriesDir =
|
|
1728
|
-
|
|
1841
|
+
getClientBuildDirectory = (reactRouterConfig) => path7.join(reactRouterConfig.buildDirectory, "client");
|
|
1842
|
+
defaultEntriesDir = path7.resolve(
|
|
1843
|
+
path7.dirname(require.resolve("@react-router/dev/package.json")),
|
|
1729
1844
|
"dist",
|
|
1730
1845
|
"config",
|
|
1731
1846
|
"defaults"
|
|
1732
1847
|
);
|
|
1733
1848
|
defaultEntries = (0, import_node_fs3.readdirSync)(defaultEntriesDir).map(
|
|
1734
|
-
(filename2) =>
|
|
1849
|
+
(filename2) => path7.join(defaultEntriesDir, filename2)
|
|
1735
1850
|
);
|
|
1736
1851
|
invariant(defaultEntries.length > 0, "No default entries found");
|
|
1737
1852
|
REACT_REFRESH_HEADER = `
|
|
@@ -1777,14 +1892,14 @@ async function build(root, viteBuildOptions) {
|
|
|
1777
1892
|
throw new Error(configResult.error);
|
|
1778
1893
|
}
|
|
1779
1894
|
let config = configResult.value;
|
|
1780
|
-
let unstable_viteEnvironmentApi = config.future.unstable_viteEnvironmentApi;
|
|
1781
1895
|
let viteMajor = parseInt(vite2.version.split(".")[0], 10);
|
|
1782
|
-
if (unstable_viteEnvironmentApi && viteMajor === 5) {
|
|
1896
|
+
if (config.future.unstable_viteEnvironmentApi && viteMajor === 5) {
|
|
1783
1897
|
throw new Error(
|
|
1784
1898
|
"The future.unstable_viteEnvironmentApi option is not supported in Vite 5"
|
|
1785
1899
|
);
|
|
1786
1900
|
}
|
|
1787
|
-
|
|
1901
|
+
const useViteEnvironmentApi = config.future.unstable_viteEnvironmentApi || await hasReactRouterRscPlugin({ root, viteBuildOptions });
|
|
1902
|
+
return await (useViteEnvironmentApi ? viteAppBuild(root, viteBuildOptions) : viteBuild(root, viteBuildOptions));
|
|
1788
1903
|
}
|
|
1789
1904
|
async function viteAppBuild(root, {
|
|
1790
1905
|
assetsInlineLimit,
|
|
@@ -1874,7 +1989,7 @@ async function viteBuild(root, {
|
|
|
1874
1989
|
let ctx = extractPluginContext(viteConfig);
|
|
1875
1990
|
if (!ctx) {
|
|
1876
1991
|
console.error(
|
|
1877
|
-
|
|
1992
|
+
import_picocolors6.default.red("React Router Vite plugin not found in Vite config")
|
|
1878
1993
|
);
|
|
1879
1994
|
process.exit(1);
|
|
1880
1995
|
}
|
|
@@ -1931,15 +2046,16 @@ async function viteBuild(root, {
|
|
|
1931
2046
|
viteConfig
|
|
1932
2047
|
});
|
|
1933
2048
|
}
|
|
1934
|
-
var
|
|
2049
|
+
var import_picocolors6;
|
|
1935
2050
|
var init_build = __esm({
|
|
1936
2051
|
"vite/build.ts"() {
|
|
1937
2052
|
"use strict";
|
|
1938
|
-
|
|
2053
|
+
import_picocolors6 = __toESM(require("picocolors"));
|
|
1939
2054
|
init_config();
|
|
1940
2055
|
init_plugin();
|
|
1941
2056
|
init_invariant();
|
|
1942
2057
|
init_vite();
|
|
2058
|
+
init_has_rsc_plugin();
|
|
1943
2059
|
}
|
|
1944
2060
|
});
|
|
1945
2061
|
|
|
@@ -1975,7 +2091,7 @@ async function dev(root, {
|
|
|
1975
2091
|
(plugin) => plugin.name === "react-router" || plugin.name === "react-router/rsc"
|
|
1976
2092
|
)) {
|
|
1977
2093
|
console.error(
|
|
1978
|
-
|
|
2094
|
+
import_picocolors7.default.red("React Router Vite plugin not found in Vite config")
|
|
1979
2095
|
);
|
|
1980
2096
|
process.exit(1);
|
|
1981
2097
|
}
|
|
@@ -1998,11 +2114,11 @@ async function dev(root, {
|
|
|
1998
2114
|
];
|
|
1999
2115
|
server.bindCLIShortcuts({ print: true, customShortcuts });
|
|
2000
2116
|
}
|
|
2001
|
-
var
|
|
2117
|
+
var import_picocolors7;
|
|
2002
2118
|
var init_dev = __esm({
|
|
2003
2119
|
"vite/dev.ts"() {
|
|
2004
2120
|
"use strict";
|
|
2005
|
-
|
|
2121
|
+
import_picocolors7 = __toESM(require("picocolors"));
|
|
2006
2122
|
init_vite();
|
|
2007
2123
|
init_profiler();
|
|
2008
2124
|
}
|
|
@@ -2011,15 +2127,15 @@ var init_dev = __esm({
|
|
|
2011
2127
|
// cli/run.ts
|
|
2012
2128
|
var import_arg = __toESM(require("arg"));
|
|
2013
2129
|
var import_semver = __toESM(require("semver"));
|
|
2014
|
-
var
|
|
2130
|
+
var import_picocolors9 = __toESM(require("picocolors"));
|
|
2015
2131
|
|
|
2016
2132
|
// cli/commands.ts
|
|
2017
2133
|
var import_node_fs4 = require("fs");
|
|
2018
2134
|
var import_promises3 = require("fs/promises");
|
|
2019
|
-
var
|
|
2135
|
+
var path8 = __toESM(require("path"));
|
|
2020
2136
|
var import_package_json2 = __toESM(require("@npmcli/package-json"));
|
|
2021
2137
|
var import_exit_hook = __toESM(require("exit-hook"));
|
|
2022
|
-
var
|
|
2138
|
+
var import_picocolors8 = __toESM(require("picocolors"));
|
|
2023
2139
|
var import_react_router3 = require("react-router");
|
|
2024
2140
|
init_config();
|
|
2025
2141
|
|
|
@@ -2101,6 +2217,7 @@ async function transpile(tsx, options = {}) {
|
|
|
2101
2217
|
init_profiler();
|
|
2102
2218
|
init_typegen();
|
|
2103
2219
|
init_vite();
|
|
2220
|
+
init_has_rsc_plugin();
|
|
2104
2221
|
async function routes(rootDirectory, flags = {}) {
|
|
2105
2222
|
rootDirectory = resolveRootDirectory(rootDirectory, flags);
|
|
2106
2223
|
let configResult = await loadConfig({
|
|
@@ -2108,7 +2225,7 @@ async function routes(rootDirectory, flags = {}) {
|
|
|
2108
2225
|
mode: flags.mode ?? "production"
|
|
2109
2226
|
});
|
|
2110
2227
|
if (!configResult.ok) {
|
|
2111
|
-
console.error(
|
|
2228
|
+
console.error(import_picocolors8.default.red(configResult.error));
|
|
2112
2229
|
process.exit(1);
|
|
2113
2230
|
}
|
|
2114
2231
|
let format = flags.json ? "json" : "jsx";
|
|
@@ -2145,18 +2262,32 @@ var conjunctionListFormat = new Intl.ListFormat("en", {
|
|
|
2145
2262
|
type: "conjunction"
|
|
2146
2263
|
});
|
|
2147
2264
|
async function generateEntry(entry, rootDirectory, flags = {}) {
|
|
2265
|
+
rootDirectory = resolveRootDirectory(rootDirectory, flags);
|
|
2266
|
+
if (await hasReactRouterRscPlugin({
|
|
2267
|
+
root: rootDirectory,
|
|
2268
|
+
viteBuildOptions: {
|
|
2269
|
+
config: flags.config,
|
|
2270
|
+
mode: flags.mode
|
|
2271
|
+
}
|
|
2272
|
+
})) {
|
|
2273
|
+
console.error(
|
|
2274
|
+
import_picocolors8.default.red(
|
|
2275
|
+
`The reveal command is currently not supported in RSC Framework Mode.`
|
|
2276
|
+
)
|
|
2277
|
+
);
|
|
2278
|
+
process.exit(1);
|
|
2279
|
+
}
|
|
2148
2280
|
if (!entry) {
|
|
2149
2281
|
await generateEntry("entry.client", rootDirectory, flags);
|
|
2150
2282
|
await generateEntry("entry.server", rootDirectory, flags);
|
|
2151
2283
|
return;
|
|
2152
2284
|
}
|
|
2153
|
-
rootDirectory = resolveRootDirectory(rootDirectory, flags);
|
|
2154
2285
|
let configResult = await loadConfig({
|
|
2155
2286
|
rootDirectory,
|
|
2156
2287
|
mode: flags.mode ?? "production"
|
|
2157
2288
|
});
|
|
2158
2289
|
if (!configResult.ok) {
|
|
2159
|
-
console.error(
|
|
2290
|
+
console.error(import_picocolors8.default.red(configResult.error));
|
|
2160
2291
|
return;
|
|
2161
2292
|
}
|
|
2162
2293
|
let appDirectory = configResult.value.appDirectory;
|
|
@@ -2164,24 +2295,24 @@ async function generateEntry(entry, rootDirectory, flags = {}) {
|
|
|
2164
2295
|
let entriesArray = Array.from(entries);
|
|
2165
2296
|
let list = conjunctionListFormat.format(entriesArray);
|
|
2166
2297
|
console.error(
|
|
2167
|
-
|
|
2298
|
+
import_picocolors8.default.red(`Invalid entry file. Valid entry files are ${list}`)
|
|
2168
2299
|
);
|
|
2169
2300
|
return;
|
|
2170
2301
|
}
|
|
2171
2302
|
let pkgJson = await import_package_json2.default.load(rootDirectory);
|
|
2172
2303
|
let deps = pkgJson.content.dependencies ?? {};
|
|
2173
2304
|
if (!deps["@react-router/node"]) {
|
|
2174
|
-
console.error(
|
|
2305
|
+
console.error(import_picocolors8.default.red(`No default server entry detected.`));
|
|
2175
2306
|
return;
|
|
2176
2307
|
}
|
|
2177
|
-
let defaultsDirectory =
|
|
2178
|
-
|
|
2308
|
+
let defaultsDirectory = path8.resolve(
|
|
2309
|
+
path8.dirname(require.resolve("@react-router/dev/package.json")),
|
|
2179
2310
|
"dist",
|
|
2180
2311
|
"config",
|
|
2181
2312
|
"defaults"
|
|
2182
2313
|
);
|
|
2183
|
-
let defaultEntryClient =
|
|
2184
|
-
let defaultEntryServer =
|
|
2314
|
+
let defaultEntryClient = path8.resolve(defaultsDirectory, "entry.client.tsx");
|
|
2315
|
+
let defaultEntryServer = path8.resolve(
|
|
2185
2316
|
defaultsDirectory,
|
|
2186
2317
|
`entry.server.node.tsx`
|
|
2187
2318
|
);
|
|
@@ -2190,7 +2321,7 @@ async function generateEntry(entry, rootDirectory, flags = {}) {
|
|
|
2190
2321
|
let useTypeScript = flags.typescript ?? true;
|
|
2191
2322
|
let outputExtension = useTypeScript ? "tsx" : "jsx";
|
|
2192
2323
|
let outputEntry = `${entry}.${outputExtension}`;
|
|
2193
|
-
let outputFile =
|
|
2324
|
+
let outputFile = path8.resolve(appDirectory, outputEntry);
|
|
2194
2325
|
if (!useTypeScript) {
|
|
2195
2326
|
let javascript = await transpile(contents, {
|
|
2196
2327
|
cwd: rootDirectory,
|
|
@@ -2201,8 +2332,8 @@ async function generateEntry(entry, rootDirectory, flags = {}) {
|
|
|
2201
2332
|
await (0, import_promises3.writeFile)(outputFile, contents, "utf-8");
|
|
2202
2333
|
}
|
|
2203
2334
|
console.log(
|
|
2204
|
-
|
|
2205
|
-
`Entry file ${entry} created at ${
|
|
2335
|
+
import_picocolors8.default.blue(
|
|
2336
|
+
`Entry file ${entry} created at ${path8.relative(
|
|
2206
2337
|
rootDirectory,
|
|
2207
2338
|
outputFile
|
|
2208
2339
|
)}.`
|
|
@@ -2211,17 +2342,17 @@ async function generateEntry(entry, rootDirectory, flags = {}) {
|
|
|
2211
2342
|
}
|
|
2212
2343
|
function resolveRootDirectory(root, flags) {
|
|
2213
2344
|
if (root) {
|
|
2214
|
-
return
|
|
2345
|
+
return path8.resolve(root);
|
|
2215
2346
|
}
|
|
2216
|
-
return process.env.REACT_ROUTER_ROOT || (flags?.config ?
|
|
2347
|
+
return process.env.REACT_ROUTER_ROOT || (flags?.config ? path8.dirname(path8.resolve(flags.config)) : process.cwd());
|
|
2217
2348
|
}
|
|
2218
2349
|
async function checkForEntry(rootDirectory, appDirectory, entries2) {
|
|
2219
2350
|
for (let entry of entries2) {
|
|
2220
|
-
let entryPath =
|
|
2351
|
+
let entryPath = path8.resolve(appDirectory, entry);
|
|
2221
2352
|
let exists = (0, import_node_fs4.existsSync)(entryPath);
|
|
2222
2353
|
if (exists) {
|
|
2223
|
-
let relative7 =
|
|
2224
|
-
console.error(
|
|
2354
|
+
let relative7 = path8.relative(rootDirectory, entryPath);
|
|
2355
|
+
console.error(import_picocolors8.default.red(`Entry file ${relative7} already exists.`));
|
|
2225
2356
|
return process.exit(1);
|
|
2226
2357
|
}
|
|
2227
2358
|
}
|
|
@@ -2238,12 +2369,20 @@ async function createClientEntry(rootDirectory, appDirectory, inputFile) {
|
|
|
2238
2369
|
}
|
|
2239
2370
|
async function typegen(root, flags) {
|
|
2240
2371
|
root = resolveRootDirectory(root, flags);
|
|
2372
|
+
const rsc = await hasReactRouterRscPlugin({
|
|
2373
|
+
root,
|
|
2374
|
+
viteBuildOptions: {
|
|
2375
|
+
config: flags.config,
|
|
2376
|
+
mode: flags.mode
|
|
2377
|
+
}
|
|
2378
|
+
});
|
|
2241
2379
|
if (flags.watch) {
|
|
2242
2380
|
await preloadVite();
|
|
2243
2381
|
const vite2 = getVite();
|
|
2244
2382
|
const logger = vite2.createLogger("info", { prefix: "[react-router]" });
|
|
2245
2383
|
await watch(root, {
|
|
2246
2384
|
mode: flags.mode ?? "development",
|
|
2385
|
+
rsc,
|
|
2247
2386
|
logger
|
|
2248
2387
|
});
|
|
2249
2388
|
await new Promise(() => {
|
|
@@ -2251,20 +2390,21 @@ async function typegen(root, flags) {
|
|
|
2251
2390
|
return;
|
|
2252
2391
|
}
|
|
2253
2392
|
await run(root, {
|
|
2254
|
-
mode: flags.mode ?? "production"
|
|
2393
|
+
mode: flags.mode ?? "production",
|
|
2394
|
+
rsc
|
|
2255
2395
|
});
|
|
2256
2396
|
}
|
|
2257
2397
|
|
|
2258
2398
|
// cli/run.ts
|
|
2259
2399
|
var helpText = `
|
|
2260
|
-
${
|
|
2400
|
+
${import_picocolors9.default.blueBright("react-router")}
|
|
2261
2401
|
|
|
2262
|
-
${
|
|
2263
|
-
$ react-router build [${
|
|
2264
|
-
$ react-router dev [${
|
|
2265
|
-
$ react-router routes [${
|
|
2402
|
+
${import_picocolors9.default.underline("Usage")}:
|
|
2403
|
+
$ react-router build [${import_picocolors9.default.yellowBright("projectDir")}]
|
|
2404
|
+
$ react-router dev [${import_picocolors9.default.yellowBright("projectDir")}]
|
|
2405
|
+
$ react-router routes [${import_picocolors9.default.yellowBright("projectDir")}]
|
|
2266
2406
|
|
|
2267
|
-
${
|
|
2407
|
+
${import_picocolors9.default.underline("Options")}:
|
|
2268
2408
|
--help, -h Print this help message and exit
|
|
2269
2409
|
--version, -v Print the CLI version and exit
|
|
2270
2410
|
--no-color Disable ANSI colors in console output
|
|
@@ -2300,22 +2440,22 @@ ${import_picocolors8.default.blueBright("react-router")}
|
|
|
2300
2440
|
\`typegen\` Options:
|
|
2301
2441
|
--watch Automatically regenerate types whenever route config (\`routes.ts\`) or route modules change
|
|
2302
2442
|
|
|
2303
|
-
${
|
|
2443
|
+
${import_picocolors9.default.underline("Build your project")}:
|
|
2304
2444
|
|
|
2305
2445
|
$ react-router build
|
|
2306
2446
|
|
|
2307
|
-
${
|
|
2447
|
+
${import_picocolors9.default.underline("Run your project locally in development")}:
|
|
2308
2448
|
|
|
2309
2449
|
$ react-router dev
|
|
2310
2450
|
|
|
2311
|
-
${
|
|
2451
|
+
${import_picocolors9.default.underline("Show all routes in your app")}:
|
|
2312
2452
|
|
|
2313
2453
|
$ react-router routes
|
|
2314
2454
|
$ react-router routes my-app
|
|
2315
2455
|
$ react-router routes --json
|
|
2316
2456
|
$ react-router routes --config vite.react-router.config.ts
|
|
2317
2457
|
|
|
2318
|
-
${
|
|
2458
|
+
${import_picocolors9.default.underline("Reveal the used entry point")}:
|
|
2319
2459
|
|
|
2320
2460
|
$ react-router reveal entry.client
|
|
2321
2461
|
$ react-router reveal entry.server
|
|
@@ -2323,7 +2463,7 @@ ${import_picocolors8.default.blueBright("react-router")}
|
|
|
2323
2463
|
$ react-router reveal entry.server --no-typescript
|
|
2324
2464
|
$ react-router reveal entry.server --config vite.react-router.config.ts
|
|
2325
2465
|
|
|
2326
|
-
${
|
|
2466
|
+
${import_picocolors9.default.underline("Generate types for route modules")}:
|
|
2327
2467
|
|
|
2328
2468
|
$ react-router typegen
|
|
2329
2469
|
$ react-router typegen --watch
|