@react-router/dev 7.9.0 → 7.9.1-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 +10 -8
- package/dist/cli/index.js +31 -12
- package/dist/config.js +1 -1
- package/dist/internal.js +77 -22
- package/dist/routes.js +1 -1
- package/dist/vite/cloudflare.js +3 -3
- package/dist/vite.js +37 -20
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# `@react-router/dev`
|
|
2
2
|
|
|
3
|
+
## 7.9.1-pre.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix internal `Future` interface naming from `middleware` -> `v8_middleware` ([#14327](https://github.com/remix-run/react-router/pull/14327))
|
|
8
|
+
- Updated dependencies:
|
|
9
|
+
- `react-router@7.9.1-pre.0`
|
|
10
|
+
- `@react-router/node@7.9.1-pre.0`
|
|
11
|
+
- `@react-router/serve@7.9.1-pre.0`
|
|
12
|
+
|
|
3
13
|
## 7.9.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -7,7 +17,6 @@
|
|
|
7
17
|
- Stabilize middleware and context APIs. ([#14215](https://github.com/remix-run/react-router/pull/14215))
|
|
8
18
|
|
|
9
19
|
We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use:
|
|
10
|
-
|
|
11
20
|
- [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider)
|
|
12
21
|
- [`createContext`](https://reactrouter.com/api/utils/createContext)
|
|
13
22
|
- `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option
|
|
@@ -750,7 +759,6 @@
|
|
|
750
759
|
```
|
|
751
760
|
|
|
752
761
|
This initial implementation targets type inference for:
|
|
753
|
-
|
|
754
762
|
- `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
|
|
755
763
|
- `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
|
|
756
764
|
- `ActionData` : Action data from `action` and/or `clientAction` within your route module
|
|
@@ -765,7 +773,6 @@
|
|
|
765
773
|
```
|
|
766
774
|
|
|
767
775
|
Check out our docs for more:
|
|
768
|
-
|
|
769
776
|
- [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
|
|
770
777
|
- [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
|
|
771
778
|
|
|
@@ -965,7 +972,6 @@
|
|
|
965
972
|
- Vite: Provide `Unstable_ServerBundlesFunction` and `Unstable_VitePluginConfig` types ([#8654](https://github.com/remix-run/remix/pull/8654))
|
|
966
973
|
|
|
967
974
|
- Vite: add `--sourcemapClient` and `--sourcemapServer` flags to `remix vite:build` ([#8613](https://github.com/remix-run/remix/pull/8613))
|
|
968
|
-
|
|
969
975
|
- `--sourcemapClient`
|
|
970
976
|
|
|
971
977
|
- `--sourcemapClient=inline`
|
|
@@ -1302,7 +1308,6 @@
|
|
|
1302
1308
|
- Add support for `clientLoader`/`clientAction`/`HydrateFallback` route exports ([RFC](https://github.com/remix-run/remix/discussions/7634)) ([#8173](https://github.com/remix-run/remix/pull/8173))
|
|
1303
1309
|
|
|
1304
1310
|
Remix now supports loaders/actions that run on the client (in addition to, or instead of the loader/action that runs on the server). While we still recommend server loaders/actions for the majority of your data needs in a Remix app - these provide some levers you can pull for more advanced use-cases such as:
|
|
1305
|
-
|
|
1306
1311
|
- Leveraging a data source local to the browser (i.e., `localStorage`)
|
|
1307
1312
|
- Managing a client-side cache of server data (like `IndexedDB`)
|
|
1308
1313
|
- Bypassing the Remix server in a BFF setup and hitting your API directly from the browser
|
|
@@ -1706,7 +1711,6 @@
|
|
|
1706
1711
|
- Output esbuild metafiles for bundle analysis ([#6772](https://github.com/remix-run/remix/pull/6772))
|
|
1707
1712
|
|
|
1708
1713
|
Written to server build directory (`build/` by default):
|
|
1709
|
-
|
|
1710
1714
|
- `metafile.css.json`
|
|
1711
1715
|
- `metafile.js.json` (browser JS)
|
|
1712
1716
|
- `metafile.server.json` (server JS)
|
|
@@ -1804,7 +1808,6 @@
|
|
|
1804
1808
|
- built-in tls support ([#6483](https://github.com/remix-run/remix/pull/6483))
|
|
1805
1809
|
|
|
1806
1810
|
New options:
|
|
1807
|
-
|
|
1808
1811
|
- `--tls-key` / `tlsKey`: TLS key
|
|
1809
1812
|
- `--tls-cert` / `tlsCert`: TLS Certificate
|
|
1810
1813
|
|
|
@@ -2075,7 +2078,6 @@
|
|
|
2075
2078
|
```
|
|
2076
2079
|
|
|
2077
2080
|
The dev server will:
|
|
2078
|
-
|
|
2079
2081
|
- force `NODE_ENV=development` and warn you if it was previously set to something else
|
|
2080
2082
|
- rebuild your app whenever your Remix app code changes
|
|
2081
2083
|
- restart your app server whenever rebuilds succeed
|
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* @react-router/dev v7.9.0
|
|
3
|
+
* @react-router/dev v7.9.1-pre.0
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
6
6
|
*
|
|
@@ -424,7 +424,7 @@ async function resolveConfig({
|
|
|
424
424
|
}
|
|
425
425
|
let appDirectory = import_pathe3.default.resolve(root, userAppDirectory || "app");
|
|
426
426
|
let buildDirectory = import_pathe3.default.resolve(root, userBuildDirectory);
|
|
427
|
-
let rootRouteFile = findEntry(appDirectory, "root");
|
|
427
|
+
let rootRouteFile = findEntry(appDirectory, "root", { absolute: true });
|
|
428
428
|
if (!rootRouteFile) {
|
|
429
429
|
let rootRouteDisplayPath = import_pathe3.default.relative(
|
|
430
430
|
root,
|
|
@@ -465,7 +465,7 @@ async function resolveConfig({
|
|
|
465
465
|
{
|
|
466
466
|
id: "root",
|
|
467
467
|
path: "",
|
|
468
|
-
file: rootRouteFile,
|
|
468
|
+
file: import_pathe3.default.relative(appDirectory, rootRouteFile),
|
|
469
469
|
children: result.routeConfig
|
|
470
470
|
}
|
|
471
471
|
];
|
|
@@ -812,7 +812,8 @@ var init_profiler = __esm({
|
|
|
812
812
|
async function createContext2({
|
|
813
813
|
rootDirectory,
|
|
814
814
|
watch: watch2,
|
|
815
|
-
mode
|
|
815
|
+
mode,
|
|
816
|
+
rsc
|
|
816
817
|
}) {
|
|
817
818
|
const configLoader = await createConfigLoader({ rootDirectory, mode, watch: watch2 });
|
|
818
819
|
const configResult = await configLoader.getConfig();
|
|
@@ -823,7 +824,8 @@ async function createContext2({
|
|
|
823
824
|
return {
|
|
824
825
|
configLoader,
|
|
825
826
|
rootDirectory,
|
|
826
|
-
config
|
|
827
|
+
config,
|
|
828
|
+
rsc
|
|
827
829
|
};
|
|
828
830
|
}
|
|
829
831
|
var init_context = __esm({
|
|
@@ -911,7 +913,7 @@ function generateFuture(ctx) {
|
|
|
911
913
|
|
|
912
914
|
declare module "react-router" {
|
|
913
915
|
interface Future {
|
|
914
|
-
|
|
916
|
+
v8_middleware: ${ctx.config.future.v8_middleware}
|
|
915
917
|
}
|
|
916
918
|
}
|
|
917
919
|
`;
|
|
@@ -1116,7 +1118,7 @@ function getRouteAnnotations({
|
|
|
1116
1118
|
module: Module
|
|
1117
1119
|
}>
|
|
1118
1120
|
` + "\n\n" + generate(matchesType).code + "\n\n" + import_dedent.default`
|
|
1119
|
-
type Annotations = GetAnnotations<Info & { module: Module, matches: Matches }>;
|
|
1121
|
+
type Annotations = GetAnnotations<Info & { module: Module, matches: Matches }, ${ctx.rsc}>;
|
|
1120
1122
|
|
|
1121
1123
|
export namespace Route {
|
|
1122
1124
|
// links
|
|
@@ -1240,8 +1242,8 @@ async function write(...files) {
|
|
|
1240
1242
|
})
|
|
1241
1243
|
);
|
|
1242
1244
|
}
|
|
1243
|
-
async function run(rootDirectory, { mode }) {
|
|
1244
|
-
const ctx = await createContext2({ rootDirectory, mode, watch: false });
|
|
1245
|
+
async function run(rootDirectory, { mode, rsc }) {
|
|
1246
|
+
const ctx = await createContext2({ rootDirectory, mode, rsc, watch: false });
|
|
1245
1247
|
await import_promises.default.rm(typesDirectory(ctx), { recursive: true, force: true });
|
|
1246
1248
|
await write(
|
|
1247
1249
|
generateFuture(ctx),
|
|
@@ -1249,8 +1251,8 @@ async function run(rootDirectory, { mode }) {
|
|
|
1249
1251
|
...generateRoutes(ctx)
|
|
1250
1252
|
);
|
|
1251
1253
|
}
|
|
1252
|
-
async function watch(rootDirectory, { mode, logger }) {
|
|
1253
|
-
const ctx = await createContext2({ rootDirectory, mode, watch: true });
|
|
1254
|
+
async function watch(rootDirectory, { mode, logger, rsc }) {
|
|
1255
|
+
const ctx = await createContext2({ rootDirectory, mode, rsc, watch: true });
|
|
1254
1256
|
await import_promises.default.rm(typesDirectory(ctx), { recursive: true, force: true });
|
|
1255
1257
|
await write(
|
|
1256
1258
|
generateFuture(ctx),
|
|
@@ -1489,6 +1491,13 @@ var init_with_props = __esm({
|
|
|
1489
1491
|
}
|
|
1490
1492
|
});
|
|
1491
1493
|
|
|
1494
|
+
// vite/load-dotenv.ts
|
|
1495
|
+
var init_load_dotenv = __esm({
|
|
1496
|
+
"vite/load-dotenv.ts"() {
|
|
1497
|
+
"use strict";
|
|
1498
|
+
}
|
|
1499
|
+
});
|
|
1500
|
+
|
|
1492
1501
|
// vite/plugins/validate-plugin-order.ts
|
|
1493
1502
|
var init_validate_plugin_order = __esm({
|
|
1494
1503
|
"vite/plugins/validate-plugin-order.ts"() {
|
|
@@ -1776,6 +1785,7 @@ var init_plugin = __esm({
|
|
|
1776
1785
|
init_config();
|
|
1777
1786
|
init_optimize_deps_entries();
|
|
1778
1787
|
init_with_props();
|
|
1788
|
+
init_load_dotenv();
|
|
1779
1789
|
init_validate_plugin_order();
|
|
1780
1790
|
init_warn_on_client_source_maps();
|
|
1781
1791
|
CLIENT_NON_COMPONENT_EXPORTS = [
|
|
@@ -2339,12 +2349,20 @@ async function createClientEntry(rootDirectory, appDirectory, inputFile) {
|
|
|
2339
2349
|
}
|
|
2340
2350
|
async function typegen(root, flags) {
|
|
2341
2351
|
root = resolveRootDirectory(root, flags);
|
|
2352
|
+
const rsc = await hasReactRouterRscPlugin({
|
|
2353
|
+
root,
|
|
2354
|
+
viteBuildOptions: {
|
|
2355
|
+
config: flags.config,
|
|
2356
|
+
mode: flags.mode
|
|
2357
|
+
}
|
|
2358
|
+
});
|
|
2342
2359
|
if (flags.watch) {
|
|
2343
2360
|
await preloadVite();
|
|
2344
2361
|
const vite2 = getVite();
|
|
2345
2362
|
const logger = vite2.createLogger("info", { prefix: "[react-router]" });
|
|
2346
2363
|
await watch(root, {
|
|
2347
2364
|
mode: flags.mode ?? "development",
|
|
2365
|
+
rsc,
|
|
2348
2366
|
logger
|
|
2349
2367
|
});
|
|
2350
2368
|
await new Promise(() => {
|
|
@@ -2352,7 +2370,8 @@ async function typegen(root, flags) {
|
|
|
2352
2370
|
return;
|
|
2353
2371
|
}
|
|
2354
2372
|
await run(root, {
|
|
2355
|
-
mode: flags.mode ?? "production"
|
|
2373
|
+
mode: flags.mode ?? "production",
|
|
2374
|
+
rsc
|
|
2356
2375
|
});
|
|
2357
2376
|
}
|
|
2358
2377
|
|
package/dist/config.js
CHANGED
package/dist/internal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.9.0
|
|
2
|
+
* @react-router/dev v7.9.1-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -46,6 +46,7 @@ module.exports = __toCommonJS(internal_exports);
|
|
|
46
46
|
|
|
47
47
|
// vite/rsc/plugin.ts
|
|
48
48
|
var import_es_module_lexer2 = require("es-module-lexer");
|
|
49
|
+
var Path5 = __toESM(require("pathe"));
|
|
49
50
|
var babel = __toESM(require("@babel/core"));
|
|
50
51
|
var import_picocolors4 = __toESM(require("picocolors"));
|
|
51
52
|
|
|
@@ -457,7 +458,7 @@ async function resolveConfig({
|
|
|
457
458
|
}
|
|
458
459
|
let appDirectory = import_pathe3.default.resolve(root, userAppDirectory || "app");
|
|
459
460
|
let buildDirectory = import_pathe3.default.resolve(root, userBuildDirectory);
|
|
460
|
-
let rootRouteFile = findEntry(appDirectory, "root");
|
|
461
|
+
let rootRouteFile = findEntry(appDirectory, "root", { absolute: true });
|
|
461
462
|
if (!rootRouteFile) {
|
|
462
463
|
let rootRouteDisplayPath = import_pathe3.default.relative(
|
|
463
464
|
root,
|
|
@@ -498,7 +499,7 @@ async function resolveConfig({
|
|
|
498
499
|
{
|
|
499
500
|
id: "root",
|
|
500
501
|
path: "",
|
|
501
|
-
file: rootRouteFile,
|
|
502
|
+
file: import_pathe3.default.relative(appDirectory, rootRouteFile),
|
|
502
503
|
children: result.routeConfig
|
|
503
504
|
}
|
|
504
505
|
];
|
|
@@ -733,7 +734,8 @@ function isEntryFileDependency(moduleGraph, entryFilepath, filepath, visited = /
|
|
|
733
734
|
async function createContext2({
|
|
734
735
|
rootDirectory,
|
|
735
736
|
watch: watch2,
|
|
736
|
-
mode
|
|
737
|
+
mode,
|
|
738
|
+
rsc
|
|
737
739
|
}) {
|
|
738
740
|
const configLoader = await createConfigLoader({ rootDirectory, mode, watch: watch2 });
|
|
739
741
|
const configResult = await configLoader.getConfig();
|
|
@@ -744,7 +746,8 @@ async function createContext2({
|
|
|
744
746
|
return {
|
|
745
747
|
configLoader,
|
|
746
748
|
rootDirectory,
|
|
747
|
-
config
|
|
749
|
+
config,
|
|
750
|
+
rsc
|
|
748
751
|
};
|
|
749
752
|
}
|
|
750
753
|
|
|
@@ -815,7 +818,7 @@ function generateFuture(ctx) {
|
|
|
815
818
|
|
|
816
819
|
declare module "react-router" {
|
|
817
820
|
interface Future {
|
|
818
|
-
|
|
821
|
+
v8_middleware: ${ctx.config.future.v8_middleware}
|
|
819
822
|
}
|
|
820
823
|
}
|
|
821
824
|
`;
|
|
@@ -1021,7 +1024,7 @@ function getRouteAnnotations({
|
|
|
1021
1024
|
module: Module
|
|
1022
1025
|
}>
|
|
1023
1026
|
` + "\n\n" + generate(matchesType).code + "\n\n" + import_dedent.default`
|
|
1024
|
-
type Annotations = GetAnnotations<Info & { module: Module, matches: Matches }>;
|
|
1027
|
+
type Annotations = GetAnnotations<Info & { module: Module, matches: Matches }, ${ctx.rsc}>;
|
|
1025
1028
|
|
|
1026
1029
|
export namespace Route {
|
|
1027
1030
|
// links
|
|
@@ -1132,8 +1135,8 @@ async function write(...files) {
|
|
|
1132
1135
|
})
|
|
1133
1136
|
);
|
|
1134
1137
|
}
|
|
1135
|
-
async function watch(rootDirectory, { mode, logger }) {
|
|
1136
|
-
const ctx = await createContext2({ rootDirectory, mode, watch: true });
|
|
1138
|
+
async function watch(rootDirectory, { mode, logger, rsc }) {
|
|
1139
|
+
const ctx = await createContext2({ rootDirectory, mode, rsc, watch: true });
|
|
1137
1140
|
await import_promises.default.rm(typesDirectory(ctx), { recursive: true, force: true });
|
|
1138
1141
|
await write(
|
|
1139
1142
|
generateFuture(ctx),
|
|
@@ -1247,7 +1250,7 @@ function createVirtualRouteConfig({
|
|
|
1247
1250
|
const routeId = route.id || createRouteId2(route.file, appDirectory);
|
|
1248
1251
|
routeIdByFile.set(routeFile, routeId);
|
|
1249
1252
|
code += `lazy: () => import(${JSON.stringify(
|
|
1250
|
-
`${routeFile}?route-module
|
|
1253
|
+
`${routeFile}?route-module`
|
|
1251
1254
|
)}),`;
|
|
1252
1255
|
code += `id: ${JSON.stringify(routeId)},`;
|
|
1253
1256
|
if (typeof route.path === "string") {
|
|
@@ -1483,26 +1486,38 @@ function transformVirtualRouteModules({
|
|
|
1483
1486
|
code,
|
|
1484
1487
|
viteCommand,
|
|
1485
1488
|
routeIdByFile,
|
|
1489
|
+
rootRouteFile,
|
|
1486
1490
|
viteEnvironment
|
|
1487
1491
|
}) {
|
|
1488
1492
|
if (isVirtualRouteModuleId(id) || routeIdByFile.has(id)) {
|
|
1489
1493
|
return createVirtualRouteModuleCode({
|
|
1490
1494
|
id,
|
|
1491
1495
|
code,
|
|
1496
|
+
rootRouteFile,
|
|
1492
1497
|
viteCommand,
|
|
1493
1498
|
viteEnvironment
|
|
1494
1499
|
});
|
|
1495
1500
|
}
|
|
1496
1501
|
if (isVirtualServerRouteModuleId(id)) {
|
|
1497
|
-
return createVirtualServerRouteModuleCode({
|
|
1502
|
+
return createVirtualServerRouteModuleCode({
|
|
1503
|
+
id,
|
|
1504
|
+
code,
|
|
1505
|
+
viteEnvironment
|
|
1506
|
+
});
|
|
1498
1507
|
}
|
|
1499
1508
|
if (isVirtualClientRouteModuleId(id)) {
|
|
1500
|
-
return createVirtualClientRouteModuleCode({
|
|
1509
|
+
return createVirtualClientRouteModuleCode({
|
|
1510
|
+
id,
|
|
1511
|
+
code,
|
|
1512
|
+
rootRouteFile,
|
|
1513
|
+
viteCommand
|
|
1514
|
+
});
|
|
1501
1515
|
}
|
|
1502
1516
|
}
|
|
1503
1517
|
async function createVirtualRouteModuleCode({
|
|
1504
1518
|
id,
|
|
1505
1519
|
code: routeSource,
|
|
1520
|
+
rootRouteFile,
|
|
1506
1521
|
viteCommand,
|
|
1507
1522
|
viteEnvironment
|
|
1508
1523
|
}) {
|
|
@@ -1562,7 +1577,7 @@ async function createVirtualRouteModuleCode({
|
|
|
1562
1577
|
}
|
|
1563
1578
|
}
|
|
1564
1579
|
}
|
|
1565
|
-
if (
|
|
1580
|
+
if (isRootRouteFile({ id, rootRouteFile }) && !staticExports.includes("ErrorBoundary")) {
|
|
1566
1581
|
code += `export { ErrorBoundary } from "${clientModuleId}";
|
|
1567
1582
|
`;
|
|
1568
1583
|
}
|
|
@@ -1606,6 +1621,7 @@ function createVirtualServerRouteModuleCode({
|
|
|
1606
1621
|
function createVirtualClientRouteModuleCode({
|
|
1607
1622
|
id,
|
|
1608
1623
|
code: routeSource,
|
|
1624
|
+
rootRouteFile,
|
|
1609
1625
|
viteCommand
|
|
1610
1626
|
}) {
|
|
1611
1627
|
const { staticExports, isServerFirstRoute, hasClientExports } = parseRouteExports(routeSource);
|
|
@@ -1616,7 +1632,7 @@ function createVirtualClientRouteModuleCode({
|
|
|
1616
1632
|
removeExports(clientRouteModuleAst, exportsToRemove);
|
|
1617
1633
|
const generatorResult = generate(clientRouteModuleAst);
|
|
1618
1634
|
generatorResult.code = '"use client";' + generatorResult.code;
|
|
1619
|
-
if (
|
|
1635
|
+
if (isRootRouteFile({ id, rootRouteFile }) && !staticExports.includes("ErrorBoundary")) {
|
|
1620
1636
|
const hasRootLayout = staticExports.includes("Layout");
|
|
1621
1637
|
generatorResult.code += `
|
|
1622
1638
|
import { createElement as __rr_createElement } from "react";
|
|
@@ -1651,13 +1667,10 @@ function parseRouteExports(code) {
|
|
|
1651
1667
|
};
|
|
1652
1668
|
}
|
|
1653
1669
|
function getVirtualClientModuleId(id) {
|
|
1654
|
-
return `${id.split("?")[0]}?client-route-module
|
|
1670
|
+
return `${id.split("?")[0]}?client-route-module`;
|
|
1655
1671
|
}
|
|
1656
1672
|
function getVirtualServerModuleId(id) {
|
|
1657
|
-
return `${id.split("?")[0]}?server-route-module
|
|
1658
|
-
}
|
|
1659
|
-
function isRootRouteId(id) {
|
|
1660
|
-
return /(\?|&)root-route=true(&|$)/.test(id);
|
|
1673
|
+
return `${id.split("?")[0]}?server-route-module`;
|
|
1661
1674
|
}
|
|
1662
1675
|
function isVirtualRouteModuleId(id) {
|
|
1663
1676
|
return /(\?|&)route-module(&|$)/.test(id);
|
|
@@ -1668,6 +1681,33 @@ function isVirtualClientRouteModuleId(id) {
|
|
|
1668
1681
|
function isVirtualServerRouteModuleId(id) {
|
|
1669
1682
|
return /(\?|&)server-route-module(&|$)/.test(id);
|
|
1670
1683
|
}
|
|
1684
|
+
function isRootRouteFile({
|
|
1685
|
+
id,
|
|
1686
|
+
rootRouteFile
|
|
1687
|
+
}) {
|
|
1688
|
+
const filePath = id.split("?")[0];
|
|
1689
|
+
return filePath === rootRouteFile;
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
// vite/load-dotenv.ts
|
|
1693
|
+
async function loadDotenv({
|
|
1694
|
+
rootDirectory,
|
|
1695
|
+
viteUserConfig,
|
|
1696
|
+
mode
|
|
1697
|
+
}) {
|
|
1698
|
+
const vite2 = await import("vite");
|
|
1699
|
+
Object.assign(
|
|
1700
|
+
process.env,
|
|
1701
|
+
vite2.loadEnv(
|
|
1702
|
+
mode,
|
|
1703
|
+
viteUserConfig.envDir ?? rootDirectory,
|
|
1704
|
+
// We override the default prefix of "VITE_" with a blank string since
|
|
1705
|
+
// we're targeting the server, so we want to load all environment
|
|
1706
|
+
// variables, not just those explicitly marked for the client
|
|
1707
|
+
""
|
|
1708
|
+
)
|
|
1709
|
+
);
|
|
1710
|
+
}
|
|
1671
1711
|
|
|
1672
1712
|
// vite/plugins/validate-plugin-order.ts
|
|
1673
1713
|
function validatePluginOrder() {
|
|
@@ -1739,12 +1779,20 @@ function warnOnClientSourceMaps() {
|
|
|
1739
1779
|
// vite/rsc/plugin.ts
|
|
1740
1780
|
function reactRouterRSCVitePlugin() {
|
|
1741
1781
|
let configLoader;
|
|
1742
|
-
let config;
|
|
1743
1782
|
let typegenWatcherPromise;
|
|
1744
1783
|
let viteCommand;
|
|
1745
1784
|
let routeIdByFile;
|
|
1746
1785
|
let logger;
|
|
1747
1786
|
const defaultEntries = getDefaultEntries();
|
|
1787
|
+
let config;
|
|
1788
|
+
let rootRouteFile;
|
|
1789
|
+
function updateConfig(newConfig) {
|
|
1790
|
+
config = newConfig;
|
|
1791
|
+
rootRouteFile = Path5.resolve(
|
|
1792
|
+
newConfig.appDirectory,
|
|
1793
|
+
newConfig.routes.root.file
|
|
1794
|
+
);
|
|
1795
|
+
}
|
|
1748
1796
|
return [
|
|
1749
1797
|
{
|
|
1750
1798
|
name: "react-router/rsc",
|
|
@@ -1783,12 +1831,17 @@ ${errors.map((x) => ` - ${x}`).join("\n")}
|
|
|
1783
1831
|
});
|
|
1784
1832
|
const configResult = await configLoader.getConfig();
|
|
1785
1833
|
if (!configResult.ok) throw new Error(configResult.error);
|
|
1786
|
-
|
|
1834
|
+
updateConfig(configResult.value);
|
|
1787
1835
|
if (viteUserConfig.base && config.basename !== "/" && viteCommand === "serve" && !viteUserConfig.server?.middlewareMode && !config.basename.startsWith(viteUserConfig.base)) {
|
|
1788
1836
|
throw new Error(
|
|
1789
1837
|
"When using the React Router `basename` and the Vite `base` config, the `basename` config must begin with `base` for the default Vite dev server."
|
|
1790
1838
|
);
|
|
1791
1839
|
}
|
|
1840
|
+
await loadDotenv({
|
|
1841
|
+
rootDirectory,
|
|
1842
|
+
viteUserConfig,
|
|
1843
|
+
mode
|
|
1844
|
+
});
|
|
1792
1845
|
const vite2 = await import("vite");
|
|
1793
1846
|
logger = vite2.createLogger(viteUserConfig.logLevel, {
|
|
1794
1847
|
prefix: "[react-router]"
|
|
@@ -1922,7 +1975,7 @@ ${errors.map((x) => ` - ${x}`).join("\n")}
|
|
|
1922
1975
|
clear: true,
|
|
1923
1976
|
timestamp: true
|
|
1924
1977
|
});
|
|
1925
|
-
|
|
1978
|
+
updateConfig(result.value);
|
|
1926
1979
|
if (configChanged || routeConfigChanged) {
|
|
1927
1980
|
invalidateVirtualModules(viteDevServer);
|
|
1928
1981
|
}
|
|
@@ -1942,6 +1995,7 @@ ${errors.map((x) => ` - ${x}`).join("\n")}
|
|
|
1942
1995
|
getRootDirectory(viteUserConfig),
|
|
1943
1996
|
{
|
|
1944
1997
|
mode,
|
|
1998
|
+
rsc: true,
|
|
1945
1999
|
// ignore `info` logs from typegen since they are
|
|
1946
2000
|
// redundant when Vite plugin logs are active
|
|
1947
2001
|
logger: vite2.createLogger("warn", {
|
|
@@ -1988,6 +2042,7 @@ ${errors.map((x) => ` - ${x}`).join("\n")}
|
|
|
1988
2042
|
id,
|
|
1989
2043
|
viteCommand,
|
|
1990
2044
|
routeIdByFile,
|
|
2045
|
+
rootRouteFile,
|
|
1991
2046
|
viteEnvironment: this.environment
|
|
1992
2047
|
});
|
|
1993
2048
|
}
|
package/dist/routes.js
CHANGED
package/dist/vite/cloudflare.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.9.0
|
|
2
|
+
* @react-router/dev v7.9.1-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -520,7 +520,7 @@ async function resolveConfig({
|
|
|
520
520
|
}
|
|
521
521
|
let appDirectory = import_pathe3.default.resolve(root, userAppDirectory || "app");
|
|
522
522
|
let buildDirectory = import_pathe3.default.resolve(root, userBuildDirectory);
|
|
523
|
-
let rootRouteFile = findEntry(appDirectory, "root");
|
|
523
|
+
let rootRouteFile = findEntry(appDirectory, "root", { absolute: true });
|
|
524
524
|
if (!rootRouteFile) {
|
|
525
525
|
let rootRouteDisplayPath = import_pathe3.default.relative(
|
|
526
526
|
root,
|
|
@@ -561,7 +561,7 @@ async function resolveConfig({
|
|
|
561
561
|
{
|
|
562
562
|
id: "root",
|
|
563
563
|
path: "",
|
|
564
|
-
file: rootRouteFile,
|
|
564
|
+
file: import_pathe3.default.relative(appDirectory, rootRouteFile),
|
|
565
565
|
children: result.routeConfig
|
|
566
566
|
}
|
|
567
567
|
];
|
package/dist/vite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @react-router/dev v7.9.0
|
|
2
|
+
* @react-router/dev v7.9.1-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -479,7 +479,7 @@ async function resolveConfig({
|
|
|
479
479
|
}
|
|
480
480
|
let appDirectory = import_pathe3.default.resolve(root, userAppDirectory || "app");
|
|
481
481
|
let buildDirectory = import_pathe3.default.resolve(root, userBuildDirectory);
|
|
482
|
-
let rootRouteFile = findEntry(appDirectory, "root");
|
|
482
|
+
let rootRouteFile = findEntry(appDirectory, "root", { absolute: true });
|
|
483
483
|
if (!rootRouteFile) {
|
|
484
484
|
let rootRouteDisplayPath = import_pathe3.default.relative(
|
|
485
485
|
root,
|
|
@@ -520,7 +520,7 @@ async function resolveConfig({
|
|
|
520
520
|
{
|
|
521
521
|
id: "root",
|
|
522
522
|
path: "",
|
|
523
|
-
file: rootRouteFile,
|
|
523
|
+
file: import_pathe3.default.relative(appDirectory, rootRouteFile),
|
|
524
524
|
children: result.routeConfig
|
|
525
525
|
}
|
|
526
526
|
];
|
|
@@ -814,7 +814,8 @@ function isEntryFileDependency(moduleGraph, entryFilepath, filepath, visited = /
|
|
|
814
814
|
async function createContext2({
|
|
815
815
|
rootDirectory,
|
|
816
816
|
watch: watch2,
|
|
817
|
-
mode
|
|
817
|
+
mode,
|
|
818
|
+
rsc
|
|
818
819
|
}) {
|
|
819
820
|
const configLoader = await createConfigLoader({ rootDirectory, mode, watch: watch2 });
|
|
820
821
|
const configResult = await configLoader.getConfig();
|
|
@@ -825,7 +826,8 @@ async function createContext2({
|
|
|
825
826
|
return {
|
|
826
827
|
configLoader,
|
|
827
828
|
rootDirectory,
|
|
828
|
-
config
|
|
829
|
+
config,
|
|
830
|
+
rsc
|
|
829
831
|
};
|
|
830
832
|
}
|
|
831
833
|
|
|
@@ -896,7 +898,7 @@ function generateFuture(ctx) {
|
|
|
896
898
|
|
|
897
899
|
declare module "react-router" {
|
|
898
900
|
interface Future {
|
|
899
|
-
|
|
901
|
+
v8_middleware: ${ctx.config.future.v8_middleware}
|
|
900
902
|
}
|
|
901
903
|
}
|
|
902
904
|
`;
|
|
@@ -1102,7 +1104,7 @@ function getRouteAnnotations({
|
|
|
1102
1104
|
module: Module
|
|
1103
1105
|
}>
|
|
1104
1106
|
` + "\n\n" + generate(matchesType).code + "\n\n" + import_dedent.default`
|
|
1105
|
-
type Annotations = GetAnnotations<Info & { module: Module, matches: Matches }>;
|
|
1107
|
+
type Annotations = GetAnnotations<Info & { module: Module, matches: Matches }, ${ctx.rsc}>;
|
|
1106
1108
|
|
|
1107
1109
|
export namespace Route {
|
|
1108
1110
|
// links
|
|
@@ -1213,8 +1215,8 @@ async function write(...files) {
|
|
|
1213
1215
|
})
|
|
1214
1216
|
);
|
|
1215
1217
|
}
|
|
1216
|
-
async function watch(rootDirectory, { mode, logger }) {
|
|
1217
|
-
const ctx = await createContext2({ rootDirectory, mode, watch: true });
|
|
1218
|
+
async function watch(rootDirectory, { mode, logger, rsc }) {
|
|
1219
|
+
const ctx = await createContext2({ rootDirectory, mode, rsc, watch: true });
|
|
1218
1220
|
await import_promises.default.rm(typesDirectory(ctx), { recursive: true, force: true });
|
|
1219
1221
|
await write(
|
|
1220
1222
|
generateFuture(ctx),
|
|
@@ -2388,6 +2390,26 @@ function toFunctionExpression(decl) {
|
|
|
2388
2390
|
);
|
|
2389
2391
|
}
|
|
2390
2392
|
|
|
2393
|
+
// vite/load-dotenv.ts
|
|
2394
|
+
async function loadDotenv({
|
|
2395
|
+
rootDirectory,
|
|
2396
|
+
viteUserConfig,
|
|
2397
|
+
mode
|
|
2398
|
+
}) {
|
|
2399
|
+
const vite2 = await import("vite");
|
|
2400
|
+
Object.assign(
|
|
2401
|
+
process.env,
|
|
2402
|
+
vite2.loadEnv(
|
|
2403
|
+
mode,
|
|
2404
|
+
viteUserConfig.envDir ?? rootDirectory,
|
|
2405
|
+
// We override the default prefix of "VITE_" with a blank string since
|
|
2406
|
+
// we're targeting the server, so we want to load all environment
|
|
2407
|
+
// variables, not just those explicitly marked for the client
|
|
2408
|
+
""
|
|
2409
|
+
)
|
|
2410
|
+
);
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2391
2413
|
// vite/plugins/validate-plugin-order.ts
|
|
2392
2414
|
function validatePluginOrder() {
|
|
2393
2415
|
return {
|
|
@@ -3152,6 +3174,7 @@ var reactRouterVitePlugin = () => {
|
|
|
3152
3174
|
if (viteCommand === "serve") {
|
|
3153
3175
|
typegenWatcherPromise = watch(rootDirectory, {
|
|
3154
3176
|
mode,
|
|
3177
|
+
rsc: false,
|
|
3155
3178
|
// ignore `info` logs from typegen since they are redundant when Vite plugin logs are active
|
|
3156
3179
|
logger: vite2.createLogger("warn", { prefix: "[react-router]" })
|
|
3157
3180
|
});
|
|
@@ -3162,17 +3185,11 @@ var reactRouterVitePlugin = () => {
|
|
|
3162
3185
|
watch: viteCommand === "serve"
|
|
3163
3186
|
});
|
|
3164
3187
|
await updatePluginContext();
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
// We override the default prefix of "VITE_" with a blank string since
|
|
3171
|
-
// we're targeting the server, so we want to load all environment
|
|
3172
|
-
// variables, not just those explicitly marked for the client
|
|
3173
|
-
""
|
|
3174
|
-
)
|
|
3175
|
-
);
|
|
3188
|
+
await loadDotenv({
|
|
3189
|
+
rootDirectory,
|
|
3190
|
+
viteUserConfig,
|
|
3191
|
+
mode
|
|
3192
|
+
});
|
|
3176
3193
|
let environments = await getEnvironmentsOptions(ctx, viteCommand, {
|
|
3177
3194
|
viteUserConfig
|
|
3178
3195
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-router/dev",
|
|
3
|
-
"version": "7.9.0",
|
|
3
|
+
"version": "7.9.1-pre.0",
|
|
4
4
|
"description": "Dev tools and CLI for React Router",
|
|
5
5
|
"homepage": "https://reactrouter.com",
|
|
6
6
|
"bugs": {
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"tinyglobby": "^0.2.14",
|
|
91
91
|
"valibot": "^0.41.0",
|
|
92
92
|
"vite-node": "^3.2.2",
|
|
93
|
-
"@react-router/node": "7.9.0"
|
|
93
|
+
"@react-router/node": "7.9.1-pre.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@types/babel__core": "^7.20.5",
|
|
@@ -114,16 +114,16 @@
|
|
|
114
114
|
"vite": "^6.1.0",
|
|
115
115
|
"wireit": "0.14.9",
|
|
116
116
|
"wrangler": "^4.23.0",
|
|
117
|
-
"@react-router/serve": "7.9.0",
|
|
118
|
-
"react-router": "^7.9.0"
|
|
117
|
+
"@react-router/serve": "7.9.1-pre.0",
|
|
118
|
+
"react-router": "^7.9.1-pre.0"
|
|
119
119
|
},
|
|
120
120
|
"peerDependencies": {
|
|
121
121
|
"@vitejs/plugin-rsc": "*",
|
|
122
122
|
"typescript": "^5.1.0",
|
|
123
123
|
"vite": "^5.1.0 || ^6.0.0 || ^7.0.0",
|
|
124
124
|
"wrangler": "^3.28.2 || ^4.0.0",
|
|
125
|
-
"@react-router/serve": "^7.9.0",
|
|
126
|
-
"react-router": "^7.9.0"
|
|
125
|
+
"@react-router/serve": "^7.9.1-pre.0",
|
|
126
|
+
"react-router": "^7.9.1-pre.0"
|
|
127
127
|
},
|
|
128
128
|
"peerDependenciesMeta": {
|
|
129
129
|
"@vitejs/plugin-rsc": {
|