@react-router/dev 7.1.2 → 7.1.3
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 +86 -118
- package/dist/config/defaults/entry.server.node.tsx +1 -1
- package/dist/config.js +1 -1
- package/dist/routes.js +1 -1
- package/dist/vite/cloudflare.js +1 -1
- package/dist/vite.js +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# `@react-router/dev`
|
|
2
2
|
|
|
3
|
+
## 7.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix `reveal` and `routes` CLI commands ([#12745](https://github.com/remix-run/react-router/pull/12745))
|
|
8
|
+
- Updated dependencies:
|
|
9
|
+
- `react-router@7.1.3`
|
|
10
|
+
- `@react-router/node@7.1.3`
|
|
11
|
+
- `@react-router/serve@7.1.3`
|
|
12
|
+
|
|
3
13
|
## 7.1.2
|
|
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 v7.1.
|
|
3
|
+
* @react-router/dev v7.1.3
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
6
6
|
*
|
|
@@ -496,6 +496,15 @@ async function createConfigLoader({
|
|
|
496
496
|
}
|
|
497
497
|
};
|
|
498
498
|
}
|
|
499
|
+
async function loadConfig({ rootDirectory }) {
|
|
500
|
+
let configLoader = await createConfigLoader({
|
|
501
|
+
rootDirectory,
|
|
502
|
+
watch: false
|
|
503
|
+
});
|
|
504
|
+
let config = await configLoader.getConfig();
|
|
505
|
+
await configLoader.close();
|
|
506
|
+
return config;
|
|
507
|
+
}
|
|
499
508
|
function findEntry(dir, basename2, options) {
|
|
500
509
|
for (let ext of entryExts) {
|
|
501
510
|
let file = import_pathe3.default.resolve(dir, basename2 + ext);
|
|
@@ -586,6 +595,45 @@ var init_config = __esm({
|
|
|
586
595
|
}
|
|
587
596
|
});
|
|
588
597
|
|
|
598
|
+
// vite/profiler.ts
|
|
599
|
+
var import_node_fs2, import_node_path, import_picocolors2, getSession, start, profileCount, stop;
|
|
600
|
+
var init_profiler = __esm({
|
|
601
|
+
"vite/profiler.ts"() {
|
|
602
|
+
"use strict";
|
|
603
|
+
import_node_fs2 = __toESM(require("fs"));
|
|
604
|
+
import_node_path = __toESM(require("path"));
|
|
605
|
+
import_picocolors2 = __toESM(require("picocolors"));
|
|
606
|
+
getSession = () => global.__reactRouter_profile_session;
|
|
607
|
+
start = async (callback) => {
|
|
608
|
+
let inspector = await import("inspector").then((r) => r.default);
|
|
609
|
+
let session = global.__reactRouter_profile_session = new inspector.Session();
|
|
610
|
+
session.connect();
|
|
611
|
+
session.post("Profiler.enable", () => {
|
|
612
|
+
session.post("Profiler.start", callback);
|
|
613
|
+
});
|
|
614
|
+
};
|
|
615
|
+
profileCount = 0;
|
|
616
|
+
stop = (log) => {
|
|
617
|
+
let session = getSession();
|
|
618
|
+
if (!session) return;
|
|
619
|
+
return new Promise((res, rej) => {
|
|
620
|
+
session.post("Profiler.stop", (err2, { profile }) => {
|
|
621
|
+
if (err2) return rej(err2);
|
|
622
|
+
let outPath = import_node_path.default.resolve(`./react-router-${profileCount++}.cpuprofile`);
|
|
623
|
+
import_node_fs2.default.writeFileSync(outPath, JSON.stringify(profile));
|
|
624
|
+
log(
|
|
625
|
+
import_picocolors2.default.yellow(
|
|
626
|
+
`CPU profile written to ${import_picocolors2.default.white(import_picocolors2.default.dim(outPath))}`
|
|
627
|
+
)
|
|
628
|
+
);
|
|
629
|
+
global.__reactRouter_profile_session = void 0;
|
|
630
|
+
res();
|
|
631
|
+
});
|
|
632
|
+
});
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
|
|
589
637
|
// typegen/paths.ts
|
|
590
638
|
function getTypesDir(ctx) {
|
|
591
639
|
return Path2.join(ctx.rootDirectory, ".react-router/types");
|
|
@@ -728,16 +776,16 @@ async function run(rootDirectory) {
|
|
|
728
776
|
async function watch(rootDirectory, { logger } = {}) {
|
|
729
777
|
const ctx = await createContext2({ rootDirectory, watch: true });
|
|
730
778
|
await writeAll(ctx);
|
|
731
|
-
logger?.info(
|
|
779
|
+
logger?.info(import_picocolors3.default.green("generated types"), { timestamp: true, clear: true });
|
|
732
780
|
ctx.configLoader.onChange(async ({ result, routeConfigChanged }) => {
|
|
733
781
|
if (!result.ok) {
|
|
734
|
-
logger?.error(
|
|
782
|
+
logger?.error(import_picocolors3.default.red(result.error), { timestamp: true, clear: true });
|
|
735
783
|
return;
|
|
736
784
|
}
|
|
737
785
|
ctx.config = result.value;
|
|
738
786
|
if (routeConfigChanged) {
|
|
739
787
|
await writeAll(ctx);
|
|
740
|
-
logger?.info(
|
|
788
|
+
logger?.info(import_picocolors3.default.green("regenerated types"), {
|
|
741
789
|
timestamp: true,
|
|
742
790
|
clear: true
|
|
743
791
|
});
|
|
@@ -765,21 +813,21 @@ async function createContext2({
|
|
|
765
813
|
}
|
|
766
814
|
async function writeAll(ctx) {
|
|
767
815
|
const typegenDir = getTypesDir(ctx);
|
|
768
|
-
|
|
816
|
+
import_node_fs3.default.rmSync(typegenDir, { recursive: true, force: true });
|
|
769
817
|
Object.values(ctx.config.routes).forEach((route) => {
|
|
770
818
|
const typesPath = getTypesPath(ctx, route);
|
|
771
819
|
const content = generate(ctx, route);
|
|
772
|
-
|
|
773
|
-
|
|
820
|
+
import_node_fs3.default.mkdirSync(Path4.dirname(typesPath), { recursive: true });
|
|
821
|
+
import_node_fs3.default.writeFileSync(typesPath, content);
|
|
774
822
|
});
|
|
775
823
|
}
|
|
776
|
-
var
|
|
824
|
+
var import_node_fs3, Path4, import_picocolors3;
|
|
777
825
|
var init_typegen = __esm({
|
|
778
826
|
"typegen/index.ts"() {
|
|
779
827
|
"use strict";
|
|
780
|
-
|
|
828
|
+
import_node_fs3 = __toESM(require("fs"));
|
|
781
829
|
Path4 = __toESM(require("pathe"));
|
|
782
|
-
|
|
830
|
+
import_picocolors3 = __toESM(require("picocolors"));
|
|
783
831
|
init_config();
|
|
784
832
|
init_generate();
|
|
785
833
|
init_paths();
|
|
@@ -812,21 +860,21 @@ var init_node_adapter = __esm({
|
|
|
812
860
|
});
|
|
813
861
|
|
|
814
862
|
// vite/resolve-file-url.ts
|
|
815
|
-
var
|
|
863
|
+
var path5;
|
|
816
864
|
var init_resolve_file_url = __esm({
|
|
817
865
|
"vite/resolve-file-url.ts"() {
|
|
818
866
|
"use strict";
|
|
819
|
-
|
|
867
|
+
path5 = __toESM(require("path"));
|
|
820
868
|
init_vite();
|
|
821
869
|
}
|
|
822
870
|
});
|
|
823
871
|
|
|
824
872
|
// vite/styles.ts
|
|
825
|
-
var
|
|
873
|
+
var path6, import_react_router, cssFileRegExp, cssModulesRegExp;
|
|
826
874
|
var init_styles = __esm({
|
|
827
875
|
"vite/styles.ts"() {
|
|
828
876
|
"use strict";
|
|
829
|
-
|
|
877
|
+
path6 = __toESM(require("path"));
|
|
830
878
|
import_react_router = require("react-router");
|
|
831
879
|
init_resolve_file_url();
|
|
832
880
|
init_vite();
|
|
@@ -903,56 +951,19 @@ async function resolveViteConfig({
|
|
|
903
951
|
async function extractPluginContext(viteConfig) {
|
|
904
952
|
return viteConfig["__reactRouterPluginContext"];
|
|
905
953
|
}
|
|
906
|
-
|
|
907
|
-
configFile,
|
|
908
|
-
root
|
|
909
|
-
}) {
|
|
910
|
-
if (!root) {
|
|
911
|
-
root = process.env.REACT_ROUTER_ROOT || process.cwd();
|
|
912
|
-
}
|
|
913
|
-
configFile = configFile ?? findConfig(root, "vite.config", [
|
|
914
|
-
".ts",
|
|
915
|
-
".cts",
|
|
916
|
-
".mts",
|
|
917
|
-
".js",
|
|
918
|
-
".cjs",
|
|
919
|
-
".mjs"
|
|
920
|
-
]);
|
|
921
|
-
if (!configFile) {
|
|
922
|
-
console.error(import_picocolors3.default.red("Vite config file not found"));
|
|
923
|
-
process.exit(1);
|
|
924
|
-
}
|
|
925
|
-
let viteConfig = await resolveViteConfig({ configFile, root });
|
|
926
|
-
let ctx = await extractPluginContext(viteConfig);
|
|
927
|
-
if (!ctx) {
|
|
928
|
-
console.error(
|
|
929
|
-
import_picocolors3.default.red("React Router Vite plugin not found in Vite config")
|
|
930
|
-
);
|
|
931
|
-
process.exit(1);
|
|
932
|
-
}
|
|
933
|
-
return ctx;
|
|
934
|
-
}
|
|
935
|
-
function findConfig(dir, basename2, extensions) {
|
|
936
|
-
for (let ext of extensions) {
|
|
937
|
-
let name = basename2 + ext;
|
|
938
|
-
let file = path6.join(dir, name);
|
|
939
|
-
if (fse.existsSync(file)) return file;
|
|
940
|
-
}
|
|
941
|
-
return void 0;
|
|
942
|
-
}
|
|
943
|
-
var import_node_crypto, path6, url, fse, babel, import_react_router2, import_es_module_lexer, import_jsesc, import_picocolors3, virtualHmrRuntime, virtualInjectHmrRuntime, virtual, getServerBuildDirectory, defaultEntriesDir, defaultEntries, REACT_REFRESH_HEADER;
|
|
954
|
+
var import_node_crypto, path7, url, fse, babel2, import_react_router2, import_es_module_lexer, import_jsesc, import_picocolors4, virtualHmrRuntime, virtualInjectHmrRuntime, virtual, getServerBuildDirectory, defaultEntriesDir, defaultEntries, REACT_REFRESH_HEADER;
|
|
944
955
|
var init_plugin = __esm({
|
|
945
956
|
"vite/plugin.ts"() {
|
|
946
957
|
"use strict";
|
|
947
958
|
import_node_crypto = require("crypto");
|
|
948
|
-
|
|
959
|
+
path7 = __toESM(require("path"));
|
|
949
960
|
url = __toESM(require("url"));
|
|
950
961
|
fse = __toESM(require("fs-extra"));
|
|
951
|
-
|
|
962
|
+
babel2 = __toESM(require("@babel/core"));
|
|
952
963
|
import_react_router2 = require("react-router");
|
|
953
964
|
import_es_module_lexer = require("es-module-lexer");
|
|
954
965
|
import_jsesc = __toESM(require("jsesc"));
|
|
955
|
-
|
|
966
|
+
import_picocolors4 = __toESM(require("picocolors"));
|
|
956
967
|
init_typegen();
|
|
957
968
|
init_invariant();
|
|
958
969
|
init_babel();
|
|
@@ -972,18 +983,18 @@ var init_plugin = __esm({
|
|
|
972
983
|
serverManifest: create("server-manifest"),
|
|
973
984
|
browserManifest: create("browser-manifest")
|
|
974
985
|
};
|
|
975
|
-
getServerBuildDirectory = (ctx) =>
|
|
986
|
+
getServerBuildDirectory = (ctx) => path7.join(
|
|
976
987
|
ctx.reactRouterConfig.buildDirectory,
|
|
977
988
|
"server",
|
|
978
989
|
...ctx.serverBundleBuildConfig ? [ctx.serverBundleBuildConfig.serverBundleId] : []
|
|
979
990
|
);
|
|
980
|
-
defaultEntriesDir =
|
|
981
|
-
|
|
991
|
+
defaultEntriesDir = path7.resolve(
|
|
992
|
+
path7.dirname(require.resolve("@react-router/dev/package.json")),
|
|
982
993
|
"dist",
|
|
983
994
|
"config",
|
|
984
995
|
"defaults"
|
|
985
996
|
);
|
|
986
|
-
defaultEntries = fse.readdirSync(defaultEntriesDir).map((filename3) =>
|
|
997
|
+
defaultEntries = fse.readdirSync(defaultEntriesDir).map((filename3) => path7.join(defaultEntriesDir, filename3));
|
|
987
998
|
invariant(defaultEntries.length > 0, "No default entries found");
|
|
988
999
|
REACT_REFRESH_HEADER = `
|
|
989
1000
|
import RefreshRuntime from "${virtualHmrRuntime.id}";
|
|
@@ -1009,45 +1020,6 @@ if (import.meta.hot && !inWebWorker) {
|
|
|
1009
1020
|
}
|
|
1010
1021
|
});
|
|
1011
1022
|
|
|
1012
|
-
// vite/profiler.ts
|
|
1013
|
-
var import_node_fs3, import_node_path, import_picocolors4, getSession, start, profileCount, stop;
|
|
1014
|
-
var init_profiler = __esm({
|
|
1015
|
-
"vite/profiler.ts"() {
|
|
1016
|
-
"use strict";
|
|
1017
|
-
import_node_fs3 = __toESM(require("fs"));
|
|
1018
|
-
import_node_path = __toESM(require("path"));
|
|
1019
|
-
import_picocolors4 = __toESM(require("picocolors"));
|
|
1020
|
-
getSession = () => global.__reactRouter_profile_session;
|
|
1021
|
-
start = async (callback) => {
|
|
1022
|
-
let inspector = await import("inspector").then((r) => r.default);
|
|
1023
|
-
let session = global.__reactRouter_profile_session = new inspector.Session();
|
|
1024
|
-
session.connect();
|
|
1025
|
-
session.post("Profiler.enable", () => {
|
|
1026
|
-
session.post("Profiler.start", callback);
|
|
1027
|
-
});
|
|
1028
|
-
};
|
|
1029
|
-
profileCount = 0;
|
|
1030
|
-
stop = (log) => {
|
|
1031
|
-
let session = getSession();
|
|
1032
|
-
if (!session) return;
|
|
1033
|
-
return new Promise((res, rej) => {
|
|
1034
|
-
session.post("Profiler.stop", (err2, { profile }) => {
|
|
1035
|
-
if (err2) return rej(err2);
|
|
1036
|
-
let outPath = import_node_path.default.resolve(`./react-router-${profileCount++}.cpuprofile`);
|
|
1037
|
-
import_node_fs3.default.writeFileSync(outPath, JSON.stringify(profile));
|
|
1038
|
-
log(
|
|
1039
|
-
import_picocolors4.default.yellow(
|
|
1040
|
-
`CPU profile written to ${import_picocolors4.default.white(import_picocolors4.default.dim(outPath))}`
|
|
1041
|
-
)
|
|
1042
|
-
);
|
|
1043
|
-
global.__reactRouter_profile_session = void 0;
|
|
1044
|
-
res();
|
|
1045
|
-
});
|
|
1046
|
-
});
|
|
1047
|
-
};
|
|
1048
|
-
}
|
|
1049
|
-
});
|
|
1050
|
-
|
|
1051
1023
|
// vite/build.ts
|
|
1052
1024
|
var build_exports = {};
|
|
1053
1025
|
__export(build_exports, {
|
|
@@ -1347,6 +1319,8 @@ var import_fs_extra2 = __toESM(require("fs-extra"));
|
|
|
1347
1319
|
var import_package_json2 = __toESM(require("@npmcli/package-json"));
|
|
1348
1320
|
var import_exit_hook = __toESM(require("exit-hook"));
|
|
1349
1321
|
var import_picocolors7 = __toESM(require("picocolors"));
|
|
1322
|
+
var import_react_router3 = require("react-router");
|
|
1323
|
+
init_config();
|
|
1350
1324
|
|
|
1351
1325
|
// config/format.ts
|
|
1352
1326
|
function formatRoutes(routeManifest, format) {
|
|
@@ -1404,16 +1378,13 @@ function formatRoutesAsJsx(routeManifest) {
|
|
|
1404
1378
|
return output;
|
|
1405
1379
|
}
|
|
1406
1380
|
|
|
1407
|
-
// cli/commands.ts
|
|
1408
|
-
init_plugin();
|
|
1409
|
-
|
|
1410
1381
|
// cli/useJavascript.ts
|
|
1411
|
-
var
|
|
1382
|
+
var babel = __toESM(require("@babel/core"));
|
|
1412
1383
|
var import_plugin_syntax_jsx = __toESM(require("@babel/plugin-syntax-jsx"));
|
|
1413
1384
|
var import_preset_typescript = __toESM(require("@babel/preset-typescript"));
|
|
1414
1385
|
var import_prettier = __toESM(require("prettier"));
|
|
1415
1386
|
function transpile(tsx, options = {}) {
|
|
1416
|
-
let mjs =
|
|
1387
|
+
let mjs = babel.transformSync(tsx, {
|
|
1417
1388
|
compact: false,
|
|
1418
1389
|
cwd: options.cwd,
|
|
1419
1390
|
filename: options.filename,
|
|
@@ -1430,18 +1401,14 @@ init_profiler();
|
|
|
1430
1401
|
init_typegen();
|
|
1431
1402
|
init_vite();
|
|
1432
1403
|
async function routes(reactRouterRoot, flags = {}) {
|
|
1433
|
-
let
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
if (!ctx) {
|
|
1438
|
-
console.error(
|
|
1439
|
-
import_picocolors7.default.red("React Router Vite plugin not found in Vite config")
|
|
1440
|
-
);
|
|
1404
|
+
let rootDirectory = reactRouterRoot ?? process.cwd();
|
|
1405
|
+
let configResult = await loadConfig({ rootDirectory });
|
|
1406
|
+
if (!configResult.ok) {
|
|
1407
|
+
console.error(import_picocolors7.default.red(configResult.error));
|
|
1441
1408
|
process.exit(1);
|
|
1442
1409
|
}
|
|
1443
1410
|
let format = flags.json ? "json" : "jsx";
|
|
1444
|
-
console.log(formatRoutes(
|
|
1411
|
+
console.log(formatRoutes(configResult.value.routes, format));
|
|
1445
1412
|
}
|
|
1446
1413
|
async function build2(root, options = {}) {
|
|
1447
1414
|
if (!root) {
|
|
@@ -1475,17 +1442,18 @@ var conjunctionListFormat = new Intl.ListFormat("en", {
|
|
|
1475
1442
|
type: "conjunction"
|
|
1476
1443
|
});
|
|
1477
1444
|
async function generateEntry(entry, reactRouterRoot, flags = {}) {
|
|
1478
|
-
let ctx = await loadPluginContext({
|
|
1479
|
-
root: reactRouterRoot,
|
|
1480
|
-
configFile: flags.config
|
|
1481
|
-
});
|
|
1482
|
-
let rootDirectory = ctx.rootDirectory;
|
|
1483
|
-
let appDirectory = ctx.reactRouterConfig.appDirectory;
|
|
1484
1445
|
if (!entry) {
|
|
1485
1446
|
await generateEntry("entry.client", reactRouterRoot, flags);
|
|
1486
1447
|
await generateEntry("entry.server", reactRouterRoot, flags);
|
|
1487
1448
|
return;
|
|
1488
1449
|
}
|
|
1450
|
+
let rootDirectory = reactRouterRoot ?? process.cwd();
|
|
1451
|
+
let configResult = await loadConfig({ rootDirectory });
|
|
1452
|
+
if (!configResult.ok) {
|
|
1453
|
+
console.error(import_picocolors7.default.red(configResult.error));
|
|
1454
|
+
return;
|
|
1455
|
+
}
|
|
1456
|
+
let appDirectory = configResult.value.appDirectory;
|
|
1489
1457
|
if (!entries.includes(entry)) {
|
|
1490
1458
|
let entriesArray = Array.from(entries);
|
|
1491
1459
|
let list = conjunctionListFormat.format(entriesArray);
|
|
@@ -61,7 +61,7 @@ export default function handleRequest(
|
|
|
61
61
|
}
|
|
62
62
|
);
|
|
63
63
|
|
|
64
|
-
// Abort the rendering stream after the `streamTimeout` so it has
|
|
64
|
+
// Abort the rendering stream after the `streamTimeout` so it has time to
|
|
65
65
|
// flush down the rejected boundaries
|
|
66
66
|
setTimeout(abort, streamTimeout + 1000);
|
|
67
67
|
});
|
package/dist/config.js
CHANGED
package/dist/routes.js
CHANGED
package/dist/vite/cloudflare.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.1.
|
|
3
|
+
"version": "7.1.3",
|
|
4
4
|
"description": "Dev tools and CLI for React Router",
|
|
5
5
|
"homepage": "https://reactrouter.com",
|
|
6
6
|
"bugs": {
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"set-cookie-parser": "^2.6.0",
|
|
89
89
|
"valibot": "^0.41.0",
|
|
90
90
|
"vite-node": "3.0.0-beta.2",
|
|
91
|
-
"@react-router/node": "7.1.
|
|
91
|
+
"@react-router/node": "7.1.3"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@types/babel__core": "^7.20.5",
|
|
@@ -117,15 +117,15 @@
|
|
|
117
117
|
"vite": "^6.0.0",
|
|
118
118
|
"wireit": "0.14.9",
|
|
119
119
|
"wrangler": "^3.28.2",
|
|
120
|
-
"@react-router/serve": "7.1.
|
|
121
|
-
"react-router": "^7.1.
|
|
120
|
+
"@react-router/serve": "7.1.3",
|
|
121
|
+
"react-router": "^7.1.3"
|
|
122
122
|
},
|
|
123
123
|
"peerDependencies": {
|
|
124
124
|
"typescript": "^5.1.0",
|
|
125
125
|
"vite": "^5.1.0 || ^6.0.0",
|
|
126
126
|
"wrangler": "^3.28.2",
|
|
127
|
-
"@react-router/serve": "^7.1.
|
|
128
|
-
"react-router": "^7.1.
|
|
127
|
+
"@react-router/serve": "^7.1.3",
|
|
128
|
+
"react-router": "^7.1.3"
|
|
129
129
|
},
|
|
130
130
|
"peerDependenciesMeta": {
|
|
131
131
|
"@react-router/serve": {
|