react-router-hono-server 2.8.5 → 2.10.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/dist/dev.js +28 -11
- package/package.json +3 -3
package/dist/dev.js
CHANGED
|
@@ -37,6 +37,11 @@ function reactRouterHonoServer(options = {}) {
|
|
|
37
37
|
if (!pluginConfig) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
+
if (pluginConfig.future.unstable_viteEnvironmentApi) {
|
|
41
|
+
console.warn(
|
|
42
|
+
"\x1B[33mThe unstable_viteEnvironmentApi is enabled.\nThis is experimental and may break your build.\x1B[0m\n"
|
|
43
|
+
);
|
|
44
|
+
}
|
|
40
45
|
if (runtime === "cloudflare" && !config.plugins?.find((p) => p && "name" in p && p.name === "react-router-cloudflare-vite-dev-proxy")) {
|
|
41
46
|
console.warn(
|
|
42
47
|
`\x1B[31mMissing cloudflareDevProxy() in your vite.config.ts.
|
|
@@ -59,7 +64,7 @@ Please add it to your plugins: import { cloudflareDevProxy } from "@react-router
|
|
|
59
64
|
noExternal: ["react-router-hono-server"]
|
|
60
65
|
}
|
|
61
66
|
};
|
|
62
|
-
if (!pluginConfig.isSsrBuild) {
|
|
67
|
+
if (!pluginConfig.future.unstable_viteEnvironmentApi && !pluginConfig.isSsrBuild) {
|
|
63
68
|
return baseConfig;
|
|
64
69
|
}
|
|
65
70
|
let reactRouterBuildFile = pluginConfig.serverBuildFile;
|
|
@@ -73,8 +78,7 @@ Please add it to your plugins: import { cloudflareDevProxy } from "@react-router
|
|
|
73
78
|
"react-dom/server": reactVersion >= 19 ? "react-dom/server.edge" : "react-dom/server.browser"
|
|
74
79
|
};
|
|
75
80
|
}
|
|
76
|
-
|
|
77
|
-
...baseConfig,
|
|
81
|
+
const ssrConfig = {
|
|
78
82
|
resolve: {
|
|
79
83
|
alias
|
|
80
84
|
},
|
|
@@ -97,6 +101,18 @@ Please add it to your plugins: import { cloudflareDevProxy } from "@react-router
|
|
|
97
101
|
}
|
|
98
102
|
}
|
|
99
103
|
};
|
|
104
|
+
if (pluginConfig.future.unstable_viteEnvironmentApi) {
|
|
105
|
+
return {
|
|
106
|
+
...baseConfig,
|
|
107
|
+
environments: {
|
|
108
|
+
ssr: ssrConfig
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
...baseConfig,
|
|
114
|
+
...ssrConfig
|
|
115
|
+
};
|
|
100
116
|
},
|
|
101
117
|
async closeBundle() {
|
|
102
118
|
if (!pluginConfig || !pluginConfig.isSsrBuild || runtime !== "cloudflare") {
|
|
@@ -163,15 +179,15 @@ function resolvePluginConfig(config, options) {
|
|
|
163
179
|
if (!("__reactRouterPluginContext" in config)) {
|
|
164
180
|
return null;
|
|
165
181
|
}
|
|
166
|
-
const reactRouterConfig = config.__reactRouterPluginContext;
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
const
|
|
170
|
-
const isSsrBuild = reactRouterConfig.isSsrBuild;
|
|
182
|
+
const { reactRouterConfig, environmentBuildContext, rootDirectory } = config.__reactRouterPluginContext;
|
|
183
|
+
const buildDirectory = path.relative(rootDirectory, reactRouterConfig.buildDirectory);
|
|
184
|
+
const appDirectory = path.relative(rootDirectory, reactRouterConfig.appDirectory);
|
|
185
|
+
const isSsrBuild = environmentBuildContext?.name === "ssr";
|
|
171
186
|
const assetsDir = config.build?.assetsDir || "assets";
|
|
172
187
|
const serverEntryPoint = options.serverEntryPoint || findDefaultServerEntry(appDirectory);
|
|
173
|
-
const serverBuildFile = reactRouterConfig.
|
|
174
|
-
const basename = reactRouterConfig.
|
|
188
|
+
const serverBuildFile = reactRouterConfig.serverBuildFile;
|
|
189
|
+
const basename = reactRouterConfig.basename;
|
|
190
|
+
const future = reactRouterConfig.future;
|
|
175
191
|
return {
|
|
176
192
|
rootDirectory,
|
|
177
193
|
buildDirectory,
|
|
@@ -181,7 +197,8 @@ function resolvePluginConfig(config, options) {
|
|
|
181
197
|
serverEntryPoint,
|
|
182
198
|
dev: options.dev,
|
|
183
199
|
serverBuildFile,
|
|
184
|
-
basename
|
|
200
|
+
basename,
|
|
201
|
+
future
|
|
185
202
|
};
|
|
186
203
|
}
|
|
187
204
|
var warned = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-router-hono-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The Vite plugin you need to create a Hono server for your React Router app in less than 10 seconds.",
|
|
6
6
|
"exports": {
|
|
@@ -101,9 +101,9 @@
|
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"@cloudflare/workers-types": "^4.20241112.0",
|
|
103
103
|
"@types/react": "^18.3.10 || ^19.0.0",
|
|
104
|
-
"@react-router/dev": "^7.
|
|
104
|
+
"@react-router/dev": "^7.2.0",
|
|
105
105
|
"miniflare": "^3.20241205.0",
|
|
106
|
-
"react-router": "^7.
|
|
106
|
+
"react-router": "^7.2.0",
|
|
107
107
|
"vite": "^5.1.0 || ^6.0.0",
|
|
108
108
|
"wrangler": "^3.91.0"
|
|
109
109
|
},
|