@react-router/dev 7.7.1 → 7.8.0-pre.1
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 +19 -7
- 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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# `@react-router/dev`
|
|
2
2
|
|
|
3
|
+
## 7.8.0-pre.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies:
|
|
8
|
+
- `react-router@7.8.0-pre.1`
|
|
9
|
+
- `@react-router/node@7.8.0-pre.1`
|
|
10
|
+
- `@react-router/serve@7.8.0-pre.1`
|
|
11
|
+
|
|
12
|
+
## 7.8.0-pre.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Fix rename without mkdir in Vite plugin ([#14105](https://github.com/remix-run/react-router/pull/14105))
|
|
17
|
+
- Updated dependencies:
|
|
18
|
+
- `react-router@7.8.0-pre.0`
|
|
19
|
+
- `@react-router/node@7.8.0-pre.0`
|
|
20
|
+
- `@react-router/serve@7.8.0-pre.0`
|
|
21
|
+
|
|
3
22
|
## 7.7.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -698,7 +717,6 @@
|
|
|
698
717
|
```
|
|
699
718
|
|
|
700
719
|
This initial implementation targets type inference for:
|
|
701
|
-
|
|
702
720
|
- `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
|
|
703
721
|
- `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
|
|
704
722
|
- `ActionData` : Action data from `action` and/or `clientAction` within your route module
|
|
@@ -713,7 +731,6 @@
|
|
|
713
731
|
```
|
|
714
732
|
|
|
715
733
|
Check out our docs for more:
|
|
716
|
-
|
|
717
734
|
- [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
|
|
718
735
|
- [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
|
|
719
736
|
|
|
@@ -913,7 +930,6 @@
|
|
|
913
930
|
- Vite: Provide `Unstable_ServerBundlesFunction` and `Unstable_VitePluginConfig` types ([#8654](https://github.com/remix-run/remix/pull/8654))
|
|
914
931
|
|
|
915
932
|
- Vite: add `--sourcemapClient` and `--sourcemapServer` flags to `remix vite:build` ([#8613](https://github.com/remix-run/remix/pull/8613))
|
|
916
|
-
|
|
917
933
|
- `--sourcemapClient`
|
|
918
934
|
|
|
919
935
|
- `--sourcemapClient=inline`
|
|
@@ -1250,7 +1266,6 @@
|
|
|
1250
1266
|
- 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))
|
|
1251
1267
|
|
|
1252
1268
|
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:
|
|
1253
|
-
|
|
1254
1269
|
- Leveraging a data source local to the browser (i.e., `localStorage`)
|
|
1255
1270
|
- Managing a client-side cache of server data (like `IndexedDB`)
|
|
1256
1271
|
- Bypassing the Remix server in a BFF setup and hitting your API directly from the browser
|
|
@@ -1654,7 +1669,6 @@
|
|
|
1654
1669
|
- Output esbuild metafiles for bundle analysis ([#6772](https://github.com/remix-run/remix/pull/6772))
|
|
1655
1670
|
|
|
1656
1671
|
Written to server build directory (`build/` by default):
|
|
1657
|
-
|
|
1658
1672
|
- `metafile.css.json`
|
|
1659
1673
|
- `metafile.js.json` (browser JS)
|
|
1660
1674
|
- `metafile.server.json` (server JS)
|
|
@@ -1752,7 +1766,6 @@
|
|
|
1752
1766
|
- built-in tls support ([#6483](https://github.com/remix-run/remix/pull/6483))
|
|
1753
1767
|
|
|
1754
1768
|
New options:
|
|
1755
|
-
|
|
1756
1769
|
- `--tls-key` / `tlsKey`: TLS key
|
|
1757
1770
|
- `--tls-cert` / `tlsCert`: TLS Certificate
|
|
1758
1771
|
|
|
@@ -2023,7 +2036,6 @@
|
|
|
2023
2036
|
```
|
|
2024
2037
|
|
|
2025
2038
|
The dev server will:
|
|
2026
|
-
|
|
2027
2039
|
- force `NODE_ENV=development` and warn you if it was previously set to something else
|
|
2028
2040
|
- rebuild your app whenever your Remix app code changes
|
|
2029
2041
|
- 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.
|
|
3
|
+
* @react-router/dev v7.8.0-pre.1
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
6
6
|
*
|
|
@@ -223,9 +223,12 @@ ${message}`
|
|
|
223
223
|
].flat().join("\n\n")
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
|
-
return {
|
|
226
|
+
return {
|
|
227
|
+
valid: true,
|
|
228
|
+
routeConfig
|
|
229
|
+
};
|
|
227
230
|
}
|
|
228
|
-
function configRoutesToRouteManifest(appDirectory, routes2
|
|
231
|
+
function configRoutesToRouteManifest(appDirectory, routes2) {
|
|
229
232
|
let routeManifest = {};
|
|
230
233
|
function walk(route, parentId) {
|
|
231
234
|
let id = route.id || createRouteId(route.file);
|
|
@@ -250,7 +253,7 @@ function configRoutesToRouteManifest(appDirectory, routes2, rootId = "root") {
|
|
|
250
253
|
}
|
|
251
254
|
}
|
|
252
255
|
for (let route of routes2) {
|
|
253
|
-
walk(route
|
|
256
|
+
walk(route);
|
|
254
257
|
}
|
|
255
258
|
return routeManifest;
|
|
256
259
|
}
|
|
@@ -424,11 +427,11 @@ async function resolveConfig({
|
|
|
424
427
|
`Could not find a root route module in the app directory as "${rootRouteDisplayPath}"`
|
|
425
428
|
);
|
|
426
429
|
}
|
|
427
|
-
let routes2
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
430
|
+
let routes2;
|
|
431
|
+
let routeConfig = [];
|
|
432
|
+
if (skipRoutes) {
|
|
433
|
+
routes2 = {};
|
|
434
|
+
} else {
|
|
432
435
|
let routeConfigFile = findEntry(appDirectory, "routes");
|
|
433
436
|
try {
|
|
434
437
|
if (!routeConfigFile) {
|
|
@@ -444,18 +447,22 @@ async function resolveConfig({
|
|
|
444
447
|
let routeConfigExport = (await viteNodeContext.runner.executeFile(
|
|
445
448
|
import_pathe3.default.join(appDirectory, routeConfigFile)
|
|
446
449
|
)).default;
|
|
447
|
-
let routeConfig = await routeConfigExport;
|
|
448
450
|
let result = validateRouteConfig({
|
|
449
451
|
routeConfigFile,
|
|
450
|
-
routeConfig
|
|
452
|
+
routeConfig: await routeConfigExport
|
|
451
453
|
});
|
|
452
454
|
if (!result.valid) {
|
|
453
455
|
return err(result.message);
|
|
454
456
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
457
|
+
routeConfig = [
|
|
458
|
+
{
|
|
459
|
+
id: "root",
|
|
460
|
+
path: "",
|
|
461
|
+
file: rootRouteFile,
|
|
462
|
+
children: result.routeConfig
|
|
463
|
+
}
|
|
464
|
+
];
|
|
465
|
+
routes2 = configRoutesToRouteManifest(appDirectory, routeConfig);
|
|
459
466
|
} catch (error) {
|
|
460
467
|
return err(
|
|
461
468
|
[
|
|
@@ -488,7 +495,8 @@ async function resolveConfig({
|
|
|
488
495
|
serverBuildFile,
|
|
489
496
|
serverBundles,
|
|
490
497
|
serverModuleFormat,
|
|
491
|
-
ssr
|
|
498
|
+
ssr,
|
|
499
|
+
unstable_routeConfig: routeConfig
|
|
492
500
|
});
|
|
493
501
|
for (let preset of reactRouterUserConfig.presets ?? []) {
|
|
494
502
|
await preset.reactRouterConfigResolved?.({ reactRouterConfig });
|
|
@@ -1816,7 +1824,7 @@ async function viteAppBuild(root, {
|
|
|
1816
1824
|
},
|
|
1817
1825
|
configResolved(config) {
|
|
1818
1826
|
let hasReactRouterPlugin = config.plugins.find(
|
|
1819
|
-
(plugin) => plugin.name === "react-router"
|
|
1827
|
+
(plugin) => plugin.name === "react-router" || plugin.name === "react-router/rsc/config"
|
|
1820
1828
|
);
|
|
1821
1829
|
if (!hasReactRouterPlugin) {
|
|
1822
1830
|
throw new Error(
|
|
@@ -1955,7 +1963,9 @@ async function dev(root, {
|
|
|
1955
1963
|
clearScreen,
|
|
1956
1964
|
logLevel
|
|
1957
1965
|
});
|
|
1958
|
-
if (!server.config.plugins.find(
|
|
1966
|
+
if (!server.config.plugins.find(
|
|
1967
|
+
(plugin) => plugin.name === "react-router" || plugin.name === "react-router/rsc/config"
|
|
1968
|
+
)) {
|
|
1959
1969
|
console.error(
|
|
1960
1970
|
import_picocolors6.default.red("React Router Vite plugin not found in Vite config")
|
|
1961
1971
|
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { startTransition, StrictMode } from "react";
|
|
2
|
+
import { hydrateRoot } from "react-dom/client";
|
|
3
|
+
import {
|
|
4
|
+
createFromReadableStream,
|
|
5
|
+
createTemporaryReferenceSet,
|
|
6
|
+
encodeReply,
|
|
7
|
+
setServerCallback,
|
|
8
|
+
} from "@vitejs/plugin-rsc/browser";
|
|
9
|
+
import {
|
|
10
|
+
unstable_createCallServer as createCallServer,
|
|
11
|
+
unstable_getRSCStream as getRSCStream,
|
|
12
|
+
unstable_RSCHydratedRouter as RSCHydratedRouter,
|
|
13
|
+
} from "react-router";
|
|
14
|
+
import type { unstable_RSCPayload as RSCPayload } from "react-router";
|
|
15
|
+
|
|
16
|
+
setServerCallback(
|
|
17
|
+
createCallServer({
|
|
18
|
+
createFromReadableStream,
|
|
19
|
+
createTemporaryReferenceSet,
|
|
20
|
+
encodeReply,
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
createFromReadableStream<RSCPayload>(getRSCStream()).then((payload) => {
|
|
25
|
+
startTransition(() => {
|
|
26
|
+
hydrateRoot(
|
|
27
|
+
document,
|
|
28
|
+
<StrictMode>
|
|
29
|
+
<RSCHydratedRouter
|
|
30
|
+
payload={payload}
|
|
31
|
+
createFromReadableStream={createFromReadableStream}
|
|
32
|
+
/>
|
|
33
|
+
</StrictMode>,
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createTemporaryReferenceSet,
|
|
3
|
+
decodeAction,
|
|
4
|
+
decodeReply,
|
|
5
|
+
loadServerAction,
|
|
6
|
+
renderToReadableStream,
|
|
7
|
+
} from "@vitejs/plugin-rsc/rsc";
|
|
8
|
+
import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
|
|
9
|
+
|
|
10
|
+
import routes from "virtual:react-router/unstable_rsc/routes";
|
|
11
|
+
|
|
12
|
+
export async function fetchServer(request: Request) {
|
|
13
|
+
return await matchRSCServerRequest({
|
|
14
|
+
createTemporaryReferenceSet,
|
|
15
|
+
decodeReply,
|
|
16
|
+
decodeAction,
|
|
17
|
+
loadServerAction,
|
|
18
|
+
request,
|
|
19
|
+
routes,
|
|
20
|
+
generateResponse(match, options) {
|
|
21
|
+
return new Response(renderToReadableStream(match.payload, options), {
|
|
22
|
+
status: match.statusCode,
|
|
23
|
+
headers: match.headers,
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default async function handler(request: Request) {
|
|
30
|
+
const ssr = await import.meta.viteRsc.loadModule<
|
|
31
|
+
typeof import("./entry.ssr")
|
|
32
|
+
>("ssr", "index");
|
|
33
|
+
return ssr.default(request, fetchServer);
|
|
34
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createFromReadableStream } from "@vitejs/plugin-rsc/ssr";
|
|
2
|
+
// @ts-expect-error
|
|
3
|
+
import * as ReactDomServer from "react-dom/server.edge";
|
|
4
|
+
import {
|
|
5
|
+
unstable_RSCStaticRouter as RSCStaticRouter,
|
|
6
|
+
unstable_routeRSCServerRequest as routeRSCServerRequest,
|
|
7
|
+
} from "react-router";
|
|
8
|
+
|
|
9
|
+
export default async function handler(
|
|
10
|
+
request: Request,
|
|
11
|
+
fetchServer: (request: Request) => Promise<Response>,
|
|
12
|
+
) {
|
|
13
|
+
const bootstrapScriptContent =
|
|
14
|
+
await import.meta.viteRsc.loadBootstrapScriptContent("index");
|
|
15
|
+
return routeRSCServerRequest({
|
|
16
|
+
request,
|
|
17
|
+
fetchServer,
|
|
18
|
+
createFromReadableStream,
|
|
19
|
+
renderHTML(getPayload) {
|
|
20
|
+
return ReactDomServer.renderToReadableStream(
|
|
21
|
+
<RSCStaticRouter getPayload={getPayload} />,
|
|
22
|
+
{
|
|
23
|
+
bootstrapScriptContent,
|
|
24
|
+
signal: request.signal,
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as Vite from 'vite';
|
|
2
|
-
import { R as RouteManifest, a as RouteManifestEntry } from './routes-
|
|
2
|
+
import { R as RouteManifest, a as RouteManifestEntry, b as RouteConfigEntry } from './routes-CZR-bKRt.js';
|
|
3
3
|
import 'valibot';
|
|
4
4
|
|
|
5
5
|
declare const excludedConfigPresetKeys: readonly ["presets"];
|
|
@@ -202,6 +202,10 @@ type ResolvedReactRouterConfig = Readonly<{
|
|
|
202
202
|
* SPA without server-rendering. Default's to `true`.
|
|
203
203
|
*/
|
|
204
204
|
ssr: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* The resolved array of route config entries exported from `routes.ts`
|
|
207
|
+
*/
|
|
208
|
+
unstable_routeConfig: RouteConfigEntry[];
|
|
205
209
|
}>;
|
|
206
210
|
|
|
207
211
|
export type { BuildManifest, ReactRouterConfig as Config, Preset, ServerBundlesFunction };
|
package/dist/config.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as Vite from 'vite';
|
|
2
|
+
|
|
3
|
+
declare function reactRouterRSCVitePlugin(): Vite.PluginOption[];
|
|
4
|
+
|
|
5
|
+
declare const __INTERNAL_DO_NOT_USE_OR_YOU_WILL_GET_A_STRONGLY_WORDED_LETTER__: {
|
|
6
|
+
unstable_reactRouterRSC: typeof reactRouterRSCVitePlugin;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { __INTERNAL_DO_NOT_USE_OR_YOU_WILL_GET_A_STRONGLY_WORDED_LETTER__ };
|