@react-router/dev 0.0.0-experimental-b98209dd9 → 0.0.0-experimental-6844c5934
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 +197 -1
- package/bin.js +13 -0
- package/dist/cli/index.js +46 -35
- package/dist/config/defaults/entry.server.node.tsx +5 -7
- package/dist/config.js +1 -1
- package/dist/routes.js +1 -1
- package/dist/vite/cloudflare.js +1 -1
- package/dist/vite.js +209 -151
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,200 @@
|
|
|
1
|
-
# `@
|
|
1
|
+
# `@react-router/dev`
|
|
2
|
+
|
|
3
|
+
## 7.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix for a crash when optional args are passed to the CLI ([`5b1ca202f`](https://github.com/remix-run/react-router/commit/5b1ca202f77ef342db0109c6b791d33188077cd0))
|
|
8
|
+
- Updated dependencies:
|
|
9
|
+
- `react-router@7.1.1`
|
|
10
|
+
- `@react-router/node@7.1.1`
|
|
11
|
+
- `@react-router/serve@7.1.1`
|
|
12
|
+
|
|
13
|
+
## 7.1.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- Add support for Vite v6 ([#12469](https://github.com/remix-run/react-router/pull/12469))
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Properly initialize `NODE_ENV` if not already set for compatibility with React 19 ([#12578](https://github.com/remix-run/react-router/pull/12578))
|
|
22
|
+
|
|
23
|
+
- Remove the leftover/unused `abortDelay` prop from `ServerRouter` and update the default `entry.server.tsx` to use the new `streamTimeout` value for Single Fetch ([#12478](https://github.com/remix-run/react-router/pull/12478))
|
|
24
|
+
|
|
25
|
+
- The `abortDelay` functionality was removed in v7 as it was coupled to the `defer` implementation from Remix v2, but this removal of this prop was missed
|
|
26
|
+
- If you were still using this prop in your `entry.server` file, it's likely your app is not aborting streams as you would expect and you will need to adopt the new [`streamTimeout`](https://reactrouter.com/explanation/special-files#streamtimeout) value introduced with Single Fetch
|
|
27
|
+
|
|
28
|
+
- Updated dependencies:
|
|
29
|
+
- `react-router@7.1.0`
|
|
30
|
+
- `@react-router/node@7.1.0`
|
|
31
|
+
- `@react-router/serve@7.1.0`
|
|
32
|
+
|
|
33
|
+
## 7.0.2
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Support `moduleResolution` `Node16` and `NodeNext` ([#12440](https://github.com/remix-run/react-router/pull/12440))
|
|
38
|
+
|
|
39
|
+
- Generate wide `matches` and `params` types for current route and child routes ([#12397](https://github.com/remix-run/react-router/pull/12397))
|
|
40
|
+
|
|
41
|
+
At runtime, `matches` includes child route matches and `params` include child route path parameters.
|
|
42
|
+
But previously, we only generated types for parent routes in `matches`; for `params`, we only considered the parent routes and the current route.
|
|
43
|
+
To align our generated types more closely to the runtime behavior, we now generate more permissive, wider types when accessing child route information.
|
|
44
|
+
|
|
45
|
+
- Updated dependencies:
|
|
46
|
+
- `react-router@7.0.2`
|
|
47
|
+
- `@react-router/node@7.0.2`
|
|
48
|
+
- `@react-router/serve@7.0.2`
|
|
49
|
+
|
|
50
|
+
## 7.0.1
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- Pass route error to ErrorBoundary as a prop ([#12338](https://github.com/remix-run/react-router/pull/12338))
|
|
55
|
+
- Ensure typegen file watcher is cleaned up when Vite dev server restarts ([#12331](https://github.com/remix-run/react-router/pull/12331))
|
|
56
|
+
- Updated dependencies:
|
|
57
|
+
- `react-router@7.0.1`
|
|
58
|
+
- `@react-router/node@7.0.1`
|
|
59
|
+
- `@react-router/serve@7.0.1`
|
|
60
|
+
|
|
61
|
+
## 7.0.0
|
|
62
|
+
|
|
63
|
+
### Major Changes
|
|
64
|
+
|
|
65
|
+
- For Remix consumers migrating to React Router, the `vitePlugin` and `cloudflareDevProxyVitePlugin` exports have been renamed and moved. ([#11904](https://github.com/remix-run/react-router/pull/11904))
|
|
66
|
+
|
|
67
|
+
```diff
|
|
68
|
+
-import {
|
|
69
|
+
- vitePlugin as remix,
|
|
70
|
+
- cloudflareDevProxyVitePlugin,
|
|
71
|
+
-} from "@remix/dev";
|
|
72
|
+
|
|
73
|
+
+import { reactRouter } from "@react-router/dev/vite";
|
|
74
|
+
+import { cloudflareDevProxy } from "@react-router/dev/vite/cloudflare";
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- Remove single_fetch future flag. ([#11522](https://github.com/remix-run/react-router/pull/11522))
|
|
78
|
+
|
|
79
|
+
- update minimum node version to 18 ([#11690](https://github.com/remix-run/react-router/pull/11690))
|
|
80
|
+
|
|
81
|
+
- Add `exports` field to all packages ([#11675](https://github.com/remix-run/react-router/pull/11675))
|
|
82
|
+
|
|
83
|
+
- node package no longer re-exports from react-router ([#11702](https://github.com/remix-run/react-router/pull/11702))
|
|
84
|
+
|
|
85
|
+
- For Remix consumers migrating to React Router who used the Vite plugin's `buildEnd` hook, the resolved `reactRouterConfig` object no longer contains a `publicPath` property since this belongs to Vite, not React Router. ([#11575](https://github.com/remix-run/react-router/pull/11575))
|
|
86
|
+
|
|
87
|
+
- For Remix consumers migrating to React Router, the Vite plugin's `manifest` option has been removed. ([#11573](https://github.com/remix-run/react-router/pull/11573))
|
|
88
|
+
|
|
89
|
+
The `manifest` option been superseded by the more powerful `buildEnd` hook since it's passed the `buildManifest` argument. You can still write the build manifest to disk if needed, but you'll most likely find it more convenient to write any logic depending on the build manifest within the `buildEnd` hook itself.
|
|
90
|
+
|
|
91
|
+
If you were using the `manifest` option, you can replace it with a `buildEnd` hook that writes the manifest to disk like this:
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
// react-router.config.ts
|
|
95
|
+
import type { Config } from "@react-router/dev/config";
|
|
96
|
+
import { writeFile } from "node:fs/promises";
|
|
97
|
+
|
|
98
|
+
export default {
|
|
99
|
+
async buildEnd({ buildManifest }) {
|
|
100
|
+
await writeFile(
|
|
101
|
+
"build/manifest.json",
|
|
102
|
+
JSON.stringify(buildManifest, null, 2),
|
|
103
|
+
"utf-8"
|
|
104
|
+
);
|
|
105
|
+
},
|
|
106
|
+
} satisfies Config;
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
- Consolidate types previously duplicated across `@remix-run/router`, `@remix-run/server-runtime`, and `@remix-run/react` now that they all live in `react-router` ([#12177](https://github.com/remix-run/react-router/pull/12177))
|
|
110
|
+
|
|
111
|
+
- Examples: `LoaderFunction`, `LoaderFunctionArgs`, `ActionFunction`, `ActionFunctionArgs`, `DataFunctionArgs`, `RouteManifest`, `LinksFunction`, `Route`, `EntryRoute`
|
|
112
|
+
- The `RouteManifest` type used by the "remix" code is now slightly stricter because it is using the former `@remix-run/router` `RouteManifest`
|
|
113
|
+
- `Record<string, Route> -> Record<string, Route | undefined>`
|
|
114
|
+
- Removed `AppData` type in favor of inlining `unknown` in the few locations it was used
|
|
115
|
+
- Removed `ServerRuntimeMeta*` types in favor of the `Meta*` types they were duplicated from
|
|
116
|
+
|
|
117
|
+
- Update default `isbot` version to v5 and drop support for `isbot@3` ([#11770](https://github.com/remix-run/react-router/pull/11770))
|
|
118
|
+
|
|
119
|
+
- If you have `isbot@4` or `isbot@5` in your `package.json`:
|
|
120
|
+
- You do not need to make any changes
|
|
121
|
+
- If you have `isbot@3` in your `package.json` and you have your own `entry.server.tsx` file in your repo
|
|
122
|
+
- You do not need to make any changes
|
|
123
|
+
- You can upgrade to `isbot@5` independent of the React Router v7 upgrade
|
|
124
|
+
- If you have `isbot@3` in your `package.json` and you do not have your own `entry.server.tsx` file in your repo
|
|
125
|
+
- You are using the internal default entry provided by React Router v7 and you will need to upgrade to `isbot@5` in your `package.json`
|
|
126
|
+
|
|
127
|
+
- Drop support for Node 18, update minimum Node vestion to 20 ([#12171](https://github.com/remix-run/react-router/pull/12171))
|
|
128
|
+
|
|
129
|
+
- Remove `installGlobals()` as this should no longer be necessary
|
|
130
|
+
|
|
131
|
+
- For Remix consumers migrating to React Router, Vite manifests (i.e. `.vite/manifest.json`) are now written within each build subdirectory, e.g. `build/client/.vite/manifest.json` and `build/server/.vite/manifest.json` instead of `build/.vite/client-manifest.json` and `build/.vite/server-manifest.json`. This means that the build output is now much closer to what you'd expect from a typical Vite project. ([#11573](https://github.com/remix-run/react-router/pull/11573))
|
|
132
|
+
|
|
133
|
+
Originally the Remix Vite plugin moved all Vite manifests to a root-level `build/.vite` directory to avoid accidentally serving them in production, particularly from the client build. This was later improved with additional logic that deleted these Vite manifest files at the end of the build process unless Vite's `build.manifest` had been enabled within the app's Vite config. This greatly reduced the risk of accidentally serving the Vite manifests in production since they're only present when explicitly asked for. As a result, we can now assume that consumers will know that they need to manage these additional files themselves, and React Router can safely generate a more standard Vite build output.
|
|
134
|
+
|
|
135
|
+
### Minor Changes
|
|
136
|
+
|
|
137
|
+
- Params, loader data, and action data as props for route component exports ([#11961](https://github.com/remix-run/react-router/pull/11961))
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
export default function Component({ params, loaderData, actionData }) {}
|
|
141
|
+
|
|
142
|
+
export function HydrateFallback({ params }) {}
|
|
143
|
+
export function ErrorBoundary({ params, loaderData, actionData }) {}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
- Remove internal entry.server.spa.tsx implementation ([#11681](https://github.com/remix-run/react-router/pull/11681))
|
|
147
|
+
|
|
148
|
+
- Add `prefix` route config helper to `@react-router/dev/routes` ([#12094](https://github.com/remix-run/react-router/pull/12094))
|
|
149
|
+
|
|
150
|
+
- ### Typesafety improvements ([#12019](https://github.com/remix-run/react-router/pull/12019))
|
|
151
|
+
|
|
152
|
+
React Router now generates types for each of your route modules.
|
|
153
|
+
You can access those types by importing them from `./+types.<route filename without extension>`.
|
|
154
|
+
For example:
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
// app/routes/product.tsx
|
|
158
|
+
import type * as Route from "./+types.product";
|
|
159
|
+
|
|
160
|
+
export function loader({ params }: Route.LoaderArgs) {}
|
|
161
|
+
|
|
162
|
+
export default function Component({ loaderData }: Route.ComponentProps) {}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
This initial implementation targets type inference for:
|
|
166
|
+
|
|
167
|
+
- `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
|
|
168
|
+
- `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
|
|
169
|
+
- `ActionData` : Action data from `action` and/or `clientAction` within your route module
|
|
170
|
+
|
|
171
|
+
In the future, we plan to add types for the rest of the route module exports: `meta`, `links`, `headers`, `shouldRevalidate`, etc.
|
|
172
|
+
We also plan to generate types for typesafe `Link`s:
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
<Link to="/products/:id" params={{ id: 1 }} />
|
|
176
|
+
// ^^^^^^^^^^^^^ ^^^^^^^^^
|
|
177
|
+
// typesafe `to` and `params` based on the available routes in your app
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Check out our docs for more:
|
|
181
|
+
|
|
182
|
+
- [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
|
|
183
|
+
- [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
|
|
184
|
+
|
|
185
|
+
### Patch Changes
|
|
186
|
+
|
|
187
|
+
- Enable prerendering for resource routes ([#12200](https://github.com/remix-run/react-router/pull/12200))
|
|
188
|
+
- chore: warn instead of error for min node version in CLI ([#12270](https://github.com/remix-run/react-router/pull/12270))
|
|
189
|
+
- chore: re-enable development warnings through a `development` exports condition. ([#12269](https://github.com/remix-run/react-router/pull/12269))
|
|
190
|
+
- include root "react-dom" module for optimization ([#12060](https://github.com/remix-run/react-router/pull/12060))
|
|
191
|
+
- resolve config directory relative to flat output file structure ([#12187](https://github.com/remix-run/react-router/pull/12187))
|
|
192
|
+
- if we are in SAP mode, always render the `index.html` for hydration ([#12268](https://github.com/remix-run/react-router/pull/12268))
|
|
193
|
+
- fix(react-router): (v7) fix static prerender of non-ascii characters ([#12161](https://github.com/remix-run/react-router/pull/12161))
|
|
194
|
+
- Updated dependencies:
|
|
195
|
+
- `react-router@7.0.0`
|
|
196
|
+
- `@react-router/serve@7.0.0`
|
|
197
|
+
- `@react-router/node@7.0.0`
|
|
2
198
|
|
|
3
199
|
## 2.9.0
|
|
4
200
|
|
package/bin.js
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
let arg = require("arg");
|
|
3
|
+
|
|
4
|
+
// Minimal replication of our actual parsing in `run.ts`. If not already set,
|
|
5
|
+
// default `NODE_ENV` so React loads the proper version in it's CJS entry script.
|
|
6
|
+
// We have to do this before importing `run.ts` since that is what imports
|
|
7
|
+
// `react` (indirectly via `react-router`)
|
|
8
|
+
let args = arg({}, { argv: process.argv.slice(2), stopAtPositional: true });
|
|
9
|
+
if (args._[0] === "dev") {
|
|
10
|
+
process.env.NODE_ENV = process.env.NODE_ENV ?? "development";
|
|
11
|
+
} else {
|
|
12
|
+
process.env.NODE_ENV = process.env.NODE_ENV ?? "production";
|
|
13
|
+
}
|
|
14
|
+
|
|
2
15
|
require("./dist/cli/index");
|
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* @react-router/dev v0.0.0-experimental-
|
|
3
|
+
* @react-router/dev v0.0.0-experimental-6844c5934
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) Remix Software Inc.
|
|
6
6
|
*
|
|
@@ -100,11 +100,11 @@ async function createContext(viteConfig = {}) {
|
|
|
100
100
|
const runner = new import_client.ViteNodeRunner({
|
|
101
101
|
root: devServer.config.root,
|
|
102
102
|
base: devServer.config.base,
|
|
103
|
-
fetchModule(
|
|
104
|
-
return server.fetchModule(
|
|
103
|
+
fetchModule(id) {
|
|
104
|
+
return server.fetchModule(id);
|
|
105
105
|
},
|
|
106
|
-
resolveId(
|
|
107
|
-
return server.resolveId(
|
|
106
|
+
resolveId(id, importer) {
|
|
107
|
+
return server.resolveId(id, importer);
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
return { devServer, server, runner };
|
|
@@ -160,24 +160,24 @@ ${message}`
|
|
|
160
160
|
function configRoutesToRouteManifest(appDirectory, routes2, rootId = "root") {
|
|
161
161
|
let routeManifest = {};
|
|
162
162
|
function walk(route, parentId) {
|
|
163
|
-
let
|
|
163
|
+
let id = route.id || createRouteId(route.file);
|
|
164
164
|
let manifestItem = {
|
|
165
|
-
id
|
|
165
|
+
id,
|
|
166
166
|
parentId,
|
|
167
167
|
file: Path.isAbsolute(route.file) ? Path.relative(appDirectory, route.file) : route.file,
|
|
168
168
|
path: route.path,
|
|
169
169
|
index: route.index,
|
|
170
170
|
caseSensitive: route.caseSensitive
|
|
171
171
|
};
|
|
172
|
-
if (routeManifest.hasOwnProperty(
|
|
172
|
+
if (routeManifest.hasOwnProperty(id)) {
|
|
173
173
|
throw new Error(
|
|
174
|
-
`Unable to define routes with duplicate route id: "${
|
|
174
|
+
`Unable to define routes with duplicate route id: "${id}"`
|
|
175
175
|
);
|
|
176
176
|
}
|
|
177
|
-
routeManifest[
|
|
177
|
+
routeManifest[id] = manifestItem;
|
|
178
178
|
if (route.children) {
|
|
179
179
|
for (let child of route.children) {
|
|
180
|
-
walk(child,
|
|
180
|
+
walk(child, id);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -600,7 +600,7 @@ function generate(ctx, route) {
|
|
|
600
600
|
const indent = i === 0 ? "" : " ".repeat(2);
|
|
601
601
|
let source = noExtension(rel);
|
|
602
602
|
if (!source.startsWith("../")) source = "./" + source;
|
|
603
|
-
return `${indent}import type { Info as Parent${i} } from "${source}"`;
|
|
603
|
+
return `${indent}import type { Info as Parent${i} } from "${source}.js"`;
|
|
604
604
|
}).join("\n");
|
|
605
605
|
return import_dedent.default`
|
|
606
606
|
// React Router generated types for route:
|
|
@@ -610,14 +610,16 @@ function generate(ctx, route) {
|
|
|
610
610
|
|
|
611
611
|
${parentTypeImports}
|
|
612
612
|
|
|
613
|
-
type Module = typeof import("../${Pathe2.filename(route.file)}")
|
|
613
|
+
type Module = typeof import("../${Pathe2.filename(route.file)}.js")
|
|
614
614
|
|
|
615
615
|
export type Info = {
|
|
616
616
|
parents: [${parents.map((_, i) => `Parent${i}`).join(", ")}],
|
|
617
617
|
id: "${route.id}"
|
|
618
618
|
file: "${route.file}"
|
|
619
619
|
path: "${route.path}"
|
|
620
|
-
params: {${formatParamProperties(
|
|
620
|
+
params: {${formatParamProperties(
|
|
621
|
+
urlpath
|
|
622
|
+
)}} & { [key: string]: string | undefined }
|
|
621
623
|
module: Module
|
|
622
624
|
loaderData: T.CreateLoaderData<Module>
|
|
623
625
|
actionData: T.CreateActionData<Module>
|
|
@@ -806,17 +808,24 @@ var init_styles = __esm({
|
|
|
806
808
|
path3 = __toESM(require("path"));
|
|
807
809
|
import_react_router = require("react-router");
|
|
808
810
|
init_resolve_file_url();
|
|
811
|
+
init_import_vite_esm_sync();
|
|
809
812
|
cssFileRegExp = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
|
810
813
|
cssModulesRegExp = new RegExp(`\\.module${cssFileRegExp.source}`);
|
|
811
814
|
}
|
|
812
815
|
});
|
|
813
816
|
|
|
814
|
-
// vite/
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
817
|
+
// vite/virtual-module.ts
|
|
818
|
+
function create(name) {
|
|
819
|
+
let id = `virtual:react-router/${name}`;
|
|
820
|
+
return {
|
|
821
|
+
id,
|
|
822
|
+
resolvedId: `\0${id}`,
|
|
823
|
+
url: `/@id/__x00__${id}`
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
var init_virtual_module = __esm({
|
|
827
|
+
"vite/virtual-module.ts"() {
|
|
818
828
|
"use strict";
|
|
819
|
-
id = (name) => `virtual:react-router/${name}`;
|
|
820
829
|
}
|
|
821
830
|
});
|
|
822
831
|
|
|
@@ -838,14 +847,14 @@ var init_remove_exports = __esm({
|
|
|
838
847
|
});
|
|
839
848
|
|
|
840
849
|
// vite/with-props.ts
|
|
841
|
-
var import_dedent2,
|
|
850
|
+
var import_dedent2, vmod;
|
|
842
851
|
var init_with_props = __esm({
|
|
843
852
|
"vite/with-props.ts"() {
|
|
844
853
|
"use strict";
|
|
845
854
|
import_dedent2 = __toESM(require("dedent"));
|
|
846
855
|
init_babel();
|
|
847
|
-
|
|
848
|
-
|
|
856
|
+
init_virtual_module();
|
|
857
|
+
vmod = create("with-props");
|
|
849
858
|
}
|
|
850
859
|
});
|
|
851
860
|
|
|
@@ -910,7 +919,7 @@ function findConfig(dir, basename2, extensions) {
|
|
|
910
919
|
}
|
|
911
920
|
return void 0;
|
|
912
921
|
}
|
|
913
|
-
var import_node_crypto, path4, url, fse, babel, import_react_router2, import_es_module_lexer, import_jsesc, import_picocolors3,
|
|
922
|
+
var import_node_crypto, path4, url, fse, babel, import_react_router2, import_es_module_lexer, import_jsesc, import_picocolors3, virtualHmrRuntime, virtualInjectHmrRuntime, virtual, getServerBuildDirectory, defaultEntriesDir, defaultEntries, REACT_REFRESH_HEADER, REACT_REFRESH_FOOTER;
|
|
914
923
|
var init_plugin = __esm({
|
|
915
924
|
"vite/plugin.ts"() {
|
|
916
925
|
"use strict";
|
|
@@ -928,18 +937,20 @@ var init_plugin = __esm({
|
|
|
928
937
|
init_babel();
|
|
929
938
|
init_node_adapter();
|
|
930
939
|
init_styles();
|
|
931
|
-
|
|
940
|
+
init_virtual_module();
|
|
932
941
|
init_resolve_file_url();
|
|
933
942
|
init_combine_urls();
|
|
934
943
|
init_remove_exports();
|
|
935
944
|
init_import_vite_esm_sync();
|
|
936
945
|
init_config();
|
|
937
946
|
init_with_props();
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
947
|
+
virtualHmrRuntime = create("hmr-runtime");
|
|
948
|
+
virtualInjectHmrRuntime = create("inject-hmr-runtime");
|
|
949
|
+
virtual = {
|
|
950
|
+
serverBuild: create("server-build"),
|
|
951
|
+
serverManifest: create("server-manifest"),
|
|
952
|
+
browserManifest: create("browser-manifest")
|
|
953
|
+
};
|
|
943
954
|
getServerBuildDirectory = (ctx) => path4.join(
|
|
944
955
|
ctx.reactRouterConfig.buildDirectory,
|
|
945
956
|
"server",
|
|
@@ -954,7 +965,7 @@ var init_plugin = __esm({
|
|
|
954
965
|
defaultEntries = fse.readdirSync(defaultEntriesDir).map((filename3) => path4.join(defaultEntriesDir, filename3));
|
|
955
966
|
invariant(defaultEntries.length > 0, "No default entries found");
|
|
956
967
|
REACT_REFRESH_HEADER = `
|
|
957
|
-
import RefreshRuntime from "${
|
|
968
|
+
import RefreshRuntime from "${virtualHmrRuntime.id}";
|
|
958
969
|
|
|
959
970
|
const inWebWorker = typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope;
|
|
960
971
|
let prevRefreshReg;
|
|
@@ -1037,8 +1048,8 @@ __export(build_exports, {
|
|
|
1037
1048
|
});
|
|
1038
1049
|
function getAddressableRoutes(routes2) {
|
|
1039
1050
|
let nonAddressableIds = /* @__PURE__ */ new Set();
|
|
1040
|
-
for (let
|
|
1041
|
-
let route = routes2[
|
|
1051
|
+
for (let id in routes2) {
|
|
1052
|
+
let route = routes2[id];
|
|
1042
1053
|
if (route.index) {
|
|
1043
1054
|
invariant(
|
|
1044
1055
|
route.parentId,
|
|
@@ -1047,7 +1058,7 @@ function getAddressableRoutes(routes2) {
|
|
|
1047
1058
|
nonAddressableIds.add(route.parentId);
|
|
1048
1059
|
}
|
|
1049
1060
|
if (typeof route.path !== "string" && !route.index) {
|
|
1050
|
-
nonAddressableIds.add(
|
|
1061
|
+
nonAddressableIds.add(id);
|
|
1051
1062
|
}
|
|
1052
1063
|
}
|
|
1053
1064
|
return Object.values(routes2).filter(
|
|
@@ -1078,12 +1089,12 @@ async function getServerBuilds(ctx) {
|
|
|
1078
1089
|
let { normalizePath } = await import("vite");
|
|
1079
1090
|
let resolvedAppDirectory = import_node_path2.default.resolve(rootDirectory, appDirectory);
|
|
1080
1091
|
let rootRelativeRoutes = Object.fromEntries(
|
|
1081
|
-
Object.entries(routes2).map(([
|
|
1092
|
+
Object.entries(routes2).map(([id, route]) => {
|
|
1082
1093
|
let filePath = import_node_path2.default.join(resolvedAppDirectory, route.file);
|
|
1083
1094
|
let rootRelativeFilePath = normalizePath(
|
|
1084
1095
|
import_node_path2.default.relative(rootDirectory, filePath)
|
|
1085
1096
|
);
|
|
1086
|
-
return [
|
|
1097
|
+
return [id, { ...route, file: rootRelativeFilePath }];
|
|
1087
1098
|
})
|
|
1088
1099
|
);
|
|
1089
1100
|
let buildManifest = {
|
|
@@ -7,7 +7,7 @@ import { isbot } from "isbot";
|
|
|
7
7
|
import type { RenderToPipeableStreamOptions } from "react-dom/server";
|
|
8
8
|
import { renderToPipeableStream } from "react-dom/server";
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
export const streamTimeout = 5_000;
|
|
11
11
|
|
|
12
12
|
export default function handleRequest(
|
|
13
13
|
request: Request,
|
|
@@ -28,11 +28,7 @@ export default function handleRequest(
|
|
|
28
28
|
: "onShellReady";
|
|
29
29
|
|
|
30
30
|
const { pipe, abort } = renderToPipeableStream(
|
|
31
|
-
<ServerRouter
|
|
32
|
-
context={routerContext}
|
|
33
|
-
url={request.url}
|
|
34
|
-
abortDelay={ABORT_DELAY}
|
|
35
|
-
/>,
|
|
31
|
+
<ServerRouter context={routerContext} url={request.url} />,
|
|
36
32
|
{
|
|
37
33
|
[readyOption]() {
|
|
38
34
|
shellRendered = true;
|
|
@@ -65,6 +61,8 @@ export default function handleRequest(
|
|
|
65
61
|
}
|
|
66
62
|
);
|
|
67
63
|
|
|
68
|
-
|
|
64
|
+
// Abort the rendering stream after the `streamTimeout` so it has tine to
|
|
65
|
+
// flush down the rejected boundaries
|
|
66
|
+
setTimeout(abort, streamTimeout + 1000);
|
|
69
67
|
});
|
|
70
68
|
}
|
package/dist/config.js
CHANGED
package/dist/routes.js
CHANGED
package/dist/vite/cloudflare.js
CHANGED