react-router-hono-server 2.11.0 → 2.13.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/README.md +37 -4
- package/dist/adapters/aws-lambda.d.ts +9 -1
- package/dist/adapters/aws-lambda.js +1 -1
- package/dist/adapters/bun.d.ts +16 -0
- package/dist/adapters/bun.js +9 -3
- package/dist/adapters/cloudflare.js +1 -1
- package/dist/adapters/node.d.ts +20 -0
- package/dist/adapters/node.js +5 -4
- package/dist/{chunk-6GJF2WWC.js → chunk-IZYOBD55.js} +2 -2
- package/dist/cli.js +2 -2
- package/dist/dev.js +31 -17
- package/package.json +31 -30
package/README.md
CHANGED
|
@@ -576,7 +576,7 @@ export interface HonoServerOptions<E extends Env = BlankEnv> extends HonoServerO
|
|
|
576
576
|
* The Node.js Adapter rewrites the global Request/Response and uses a lightweight Request/Response to improve performance.
|
|
577
577
|
*
|
|
578
578
|
* If you want this behavior, set it to `true`
|
|
579
|
-
*
|
|
579
|
+
*
|
|
580
580
|
* 🚨 Setting this to `true` can break `request.clone()` if you later check `instanceof Request`.
|
|
581
581
|
*
|
|
582
582
|
* {@link https://github.com/honojs/node-server?tab=readme-ov-file#overrideglobalobjects}
|
|
@@ -584,6 +584,25 @@ export interface HonoServerOptions<E extends Env = BlankEnv> extends HonoServerO
|
|
|
584
584
|
* @default false
|
|
585
585
|
*/
|
|
586
586
|
overrideGlobalObjects?: boolean;
|
|
587
|
+
/**
|
|
588
|
+
* Customize the hostname of the node server
|
|
589
|
+
*/
|
|
590
|
+
hostname?: string;
|
|
591
|
+
/**
|
|
592
|
+
* Customize the serve static options
|
|
593
|
+
*/
|
|
594
|
+
serveStaticOptions?: {
|
|
595
|
+
/**
|
|
596
|
+
* Customize the public assets (what's in your `public` directory) serve static options.
|
|
597
|
+
*
|
|
598
|
+
*/
|
|
599
|
+
publicAssets?: Omit<ServeStaticOptions<E>, "root">;
|
|
600
|
+
/**
|
|
601
|
+
* Customize the client assets (what's in your `build/client/assets` directory - React Router) serve static options.
|
|
602
|
+
*
|
|
603
|
+
*/
|
|
604
|
+
clientAssets?: Omit<ServeStaticOptions<E>, "root">;
|
|
605
|
+
};
|
|
587
606
|
}
|
|
588
607
|
```
|
|
589
608
|
|
|
@@ -596,6 +615,21 @@ export interface HonoServerOptions<E extends Env = BlankEnv> extends HonoServerO
|
|
|
596
615
|
* {@link https://bun.sh/docs/api/http#start-a-server-bun-serve}
|
|
597
616
|
*/
|
|
598
617
|
customBunServer?: Serve & ServeOptions;
|
|
618
|
+
/**
|
|
619
|
+
* Customize the serve static options
|
|
620
|
+
*/
|
|
621
|
+
serveStaticOptions?: {
|
|
622
|
+
/**
|
|
623
|
+
* Customize the public assets (what's in your `public` directory) serve static options.
|
|
624
|
+
*
|
|
625
|
+
*/
|
|
626
|
+
publicAssets?: Omit<ServeStaticOptions<E>, "root">;
|
|
627
|
+
/**
|
|
628
|
+
* Customize the client assets (what's in your `build/client/assets` directory - React Router) serve static options.
|
|
629
|
+
*
|
|
630
|
+
*/
|
|
631
|
+
clientAssets?: Omit<ServeStaticOptions<E>, "root">;
|
|
632
|
+
};
|
|
599
633
|
}
|
|
600
634
|
```
|
|
601
635
|
|
|
@@ -627,7 +661,7 @@ interface HonoAWSServerOptions<E extends Env = BlankEnv> extends Omit<HonoServer
|
|
|
627
661
|
> TLDR: If you encounter a `Error: Unable to decode turbo-stream response` after a redirect from your middleware, try to use `redirect` instead of `c.redirect`.
|
|
628
662
|
>
|
|
629
663
|
> `redirect` will use `c.redirect` for "normal" requests and a single-fetch-like response for React Router `.data` requests.
|
|
630
|
-
>
|
|
664
|
+
>
|
|
631
665
|
> If the next handler is a Hono middleware (ex: https://github.com/rphlmr/react-router-hono-server/discussions/56), you can use `c.redirect` as usual.
|
|
632
666
|
>
|
|
633
667
|
> You **have to** use the `redirect` helper to redirect from a middleware if the next handler that will receive this redirect is a React Router route.
|
|
@@ -752,7 +786,7 @@ You can use React Router middleware with this package.
|
|
|
752
786
|
|
|
753
787
|
> [!IMPORTANT]
|
|
754
788
|
> Please note that this is an unstable feature and could change in the future.
|
|
755
|
-
>
|
|
789
|
+
>
|
|
756
790
|
> If you already have a custom `getLoadContext` function, you now have to return a `Map` from it. Check the example for more information.
|
|
757
791
|
|
|
758
792
|
|
|
@@ -930,7 +964,6 @@ Add the pre-render option to your `react-router.config.ts`
|
|
|
930
964
|
import type { Config } from "@react-router/dev/config";
|
|
931
965
|
|
|
932
966
|
export default {
|
|
933
|
-
serverBuildFile: "assets/server-build.js", // 🚨 Dont forget this
|
|
934
967
|
prerender: ["/"],
|
|
935
968
|
} satisfies Config;
|
|
936
969
|
```
|
|
@@ -67,6 +67,14 @@ type HonoServerOptions<E extends Env = BlankEnv> = HonoAWSServerOptions<E> & Omi
|
|
|
67
67
|
*
|
|
68
68
|
* @param config {@link HonoServerOptions} - The configuration options for the server
|
|
69
69
|
*/
|
|
70
|
-
declare function createHonoServer<E extends Env = BlankEnv>(options?: HonoServerOptions<E>): Promise<Hono<E, hono_types.BlankSchema, "/"> | Handler | ((event:
|
|
70
|
+
declare function createHonoServer<E extends Env = BlankEnv>(options?: HonoServerOptions<E>): Promise<Hono<E, hono_types.BlankSchema, "/"> | Handler | (<L extends hono_aws_lambda.LambdaEvent>(event: L, lambdaContext?: hono_aws_lambda.LambdaContext) => Promise<hono_aws_lambda.APIGatewayProxyResult & (L extends {
|
|
71
|
+
multiValueHeaders: Record<string, string[]>;
|
|
72
|
+
} ? {
|
|
73
|
+
headers?: undefined;
|
|
74
|
+
multiValueHeaders: Record<string, string[]>;
|
|
75
|
+
} : {
|
|
76
|
+
headers: Record<string, string>;
|
|
77
|
+
multiValueHeaders?: undefined;
|
|
78
|
+
})>)>;
|
|
71
79
|
|
|
72
80
|
export { type HonoServerOptions, createHonoServer };
|
package/dist/adapters/bun.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Serve, ServeOptions } from 'bun';
|
|
2
2
|
import { Env } from 'hono';
|
|
3
|
+
import { ServeStaticOptions } from 'hono/serve-static';
|
|
3
4
|
import { BlankEnv } from 'hono/types';
|
|
4
5
|
import { H as HonoServerOptionsBase, a as WithWebsocket, W as WithoutWebsocket } from '../helpers-BKrW-3-B.js';
|
|
5
6
|
export { c as createGetLoadContext } from '../helpers-BKrW-3-B.js';
|
|
@@ -16,6 +17,21 @@ interface HonoBunServerOptions<E extends Env = BlankEnv> extends HonoServerOptio
|
|
|
16
17
|
* {@link https://bun.sh/docs/api/http#start-a-server-bun-serve}
|
|
17
18
|
*/
|
|
18
19
|
customBunServer?: Partial<CustomBunServer>;
|
|
20
|
+
/**
|
|
21
|
+
* Customize the serve static options
|
|
22
|
+
*/
|
|
23
|
+
serveStaticOptions?: {
|
|
24
|
+
/**
|
|
25
|
+
* Customize the public assets (what's in your `public` directory) serve static options.
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
publicAssets?: Omit<ServeStaticOptions<E>, "root">;
|
|
29
|
+
/**
|
|
30
|
+
* Customize the client assets (what's in your `build/client/assets` directory - React Router) serve static options.
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
clientAssets?: Omit<ServeStaticOptions<E>, "root">;
|
|
34
|
+
};
|
|
19
35
|
}
|
|
20
36
|
type HonoServerOptionsWithWebSocket<E extends Env = BlankEnv> = HonoBunServerOptions<E> & WithWebsocket<E>;
|
|
21
37
|
type HonoServerOptionsWithoutWebSocket<E extends Env = BlankEnv> = HonoBunServerOptions<E> & WithoutWebsocket<E>;
|
package/dist/adapters/bun.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getBuildMode,
|
|
7
7
|
importBuild,
|
|
8
8
|
patchUpgradeListener
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-IZYOBD55.js";
|
|
10
10
|
import {
|
|
11
11
|
cache
|
|
12
12
|
} from "../chunk-V3H4JZ4H.js";
|
|
@@ -40,13 +40,19 @@ async function createHonoServer(options) {
|
|
|
40
40
|
`/${import.meta.env.REACT_ROUTER_HONO_SERVER_ASSETS_DIR}/*`,
|
|
41
41
|
cache(60 * 60 * 24 * 365),
|
|
42
42
|
// 1 year
|
|
43
|
-
serveStatic({
|
|
43
|
+
serveStatic({
|
|
44
|
+
root: clientBuildPath,
|
|
45
|
+
...mergedOptions.serveStaticOptions?.clientAssets
|
|
46
|
+
})
|
|
44
47
|
);
|
|
45
48
|
app.use(
|
|
46
49
|
"*",
|
|
47
50
|
cache(60 * 60),
|
|
48
51
|
// 1 hour
|
|
49
|
-
serveStatic({
|
|
52
|
+
serveStatic({
|
|
53
|
+
root: PRODUCTION ? clientBuildPath : "./public",
|
|
54
|
+
...mergedOptions.serveStaticOptions?.publicAssets
|
|
55
|
+
})
|
|
50
56
|
);
|
|
51
57
|
if (mergedOptions.defaultLogger) {
|
|
52
58
|
app.use("*", logger());
|
package/dist/adapters/node.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AddressInfo } from 'node:net';
|
|
2
2
|
import { ServerType } from '@hono/node-server';
|
|
3
|
+
import { ServeStaticOptions } from '@hono/node-server/serve-static';
|
|
3
4
|
import { Env, Hono } from 'hono';
|
|
4
5
|
import { BlankEnv } from 'hono/types';
|
|
5
6
|
import { H as HonoServerOptionsBase, a as WithWebsocket, W as WithoutWebsocket } from '../helpers-BKrW-3-B.js';
|
|
@@ -63,6 +64,25 @@ interface HonoNodeServerOptions<E extends Env = BlankEnv> extends HonoServerOpti
|
|
|
63
64
|
* @default false
|
|
64
65
|
*/
|
|
65
66
|
overrideGlobalObjects?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Customize the hostname of the node server
|
|
69
|
+
*/
|
|
70
|
+
hostname?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Customize the serve static options
|
|
73
|
+
*/
|
|
74
|
+
serveStaticOptions?: {
|
|
75
|
+
/**
|
|
76
|
+
* Customize the public assets (what's in your `public` directory) serve static options.
|
|
77
|
+
*
|
|
78
|
+
*/
|
|
79
|
+
publicAssets?: Omit<ServeStaticOptions<E>, "root">;
|
|
80
|
+
/**
|
|
81
|
+
* Customize the client assets (what's in your `build/client/assets` directory - React Router) serve static options.
|
|
82
|
+
*
|
|
83
|
+
*/
|
|
84
|
+
clientAssets?: Omit<ServeStaticOptions<E>, "root">;
|
|
85
|
+
};
|
|
66
86
|
}
|
|
67
87
|
type HonoServerOptionsWithWebSocket<E extends Env = BlankEnv> = HonoNodeServerOptions<E> & WithWebsocket<E>;
|
|
68
88
|
type HonoServerOptionsWithoutWebSocket<E extends Env = BlankEnv> = HonoNodeServerOptions<E> & WithoutWebsocket<E>;
|
package/dist/adapters/node.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getBuildMode,
|
|
7
7
|
importBuild,
|
|
8
8
|
patchUpgradeListener
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-IZYOBD55.js";
|
|
10
10
|
import {
|
|
11
11
|
cache
|
|
12
12
|
} from "../chunk-V3H4JZ4H.js";
|
|
@@ -49,13 +49,13 @@ async function createHonoServer(options) {
|
|
|
49
49
|
`/${import.meta.env.REACT_ROUTER_HONO_SERVER_ASSETS_DIR}/*`,
|
|
50
50
|
cache(60 * 60 * 24 * 365),
|
|
51
51
|
// 1 year
|
|
52
|
-
serveStatic({ root: clientBuildPath })
|
|
52
|
+
serveStatic({ root: clientBuildPath, ...mergedOptions.serveStaticOptions?.clientAssets })
|
|
53
53
|
);
|
|
54
54
|
app.use(
|
|
55
55
|
"*",
|
|
56
56
|
cache(60 * 60),
|
|
57
57
|
// 1 hour
|
|
58
|
-
serveStatic({ root: PRODUCTION ? clientBuildPath : "./public" })
|
|
58
|
+
serveStatic({ root: PRODUCTION ? clientBuildPath : "./public", ...mergedOptions.serveStaticOptions?.publicAssets })
|
|
59
59
|
);
|
|
60
60
|
if (mergedOptions.defaultLogger) {
|
|
61
61
|
app.use("*", logger());
|
|
@@ -86,7 +86,8 @@ async function createHonoServer(options) {
|
|
|
86
86
|
...app,
|
|
87
87
|
...mergedOptions.customNodeServer,
|
|
88
88
|
port: mergedOptions.port,
|
|
89
|
-
overrideGlobalObjects: mergedOptions.overrideGlobalObjects
|
|
89
|
+
overrideGlobalObjects: mergedOptions.overrideGlobalObjects,
|
|
90
|
+
hostname: mergedOptions.hostname
|
|
90
91
|
},
|
|
91
92
|
mergedOptions.listeningListener
|
|
92
93
|
);
|
|
@@ -65,7 +65,7 @@ function patchUpgradeListener(httpServer) {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
function bindIncomingRequestSocketInfo() {
|
|
68
|
-
return createMiddleware(
|
|
68
|
+
return createMiddleware((c, next) => {
|
|
69
69
|
c.env.server = {
|
|
70
70
|
incoming: {
|
|
71
71
|
socket: {
|
|
@@ -79,7 +79,7 @@ function bindIncomingRequestSocketInfo() {
|
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
async function importBuild() {
|
|
82
|
-
return import(
|
|
82
|
+
return await import(
|
|
83
83
|
// @ts-expect-error - Virtual module provided by React Router at build time
|
|
84
84
|
"virtual:react-router/server-build"
|
|
85
85
|
);
|
package/dist/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ import { createHonoServer } from "react-router-hono-server/${runtime}";
|
|
|
19
19
|
export default await createHonoServer();`;
|
|
20
20
|
var file = command({
|
|
21
21
|
name: "file",
|
|
22
|
-
|
|
22
|
+
handler() {
|
|
23
23
|
const serverFilePath = path.resolve(process.cwd(), "app", "server.ts");
|
|
24
24
|
fs.writeFileSync(serverFilePath, serverFile);
|
|
25
25
|
console.log(`\x1B[33m\u2728 File created at ${serverFilePath}\x1B[0m`);
|
|
@@ -27,7 +27,7 @@ var file = command({
|
|
|
27
27
|
});
|
|
28
28
|
var folder = command({
|
|
29
29
|
name: "folder",
|
|
30
|
-
|
|
30
|
+
handler() {
|
|
31
31
|
const serverFilePath = path.resolve(process.cwd(), "app", "server", "index.ts");
|
|
32
32
|
if (!fs.existsSync(serverFilePath)) {
|
|
33
33
|
fs.mkdirSync(path.dirname(serverFilePath), { recursive: true });
|
package/dist/dev.js
CHANGED
|
@@ -4,8 +4,9 @@ import path from "node:path";
|
|
|
4
4
|
import honoDevServer from "@hono/vite-dev-server";
|
|
5
5
|
import bunAdapter from "@hono/vite-dev-server/bun";
|
|
6
6
|
import nodeAdapter from "@hono/vite-dev-server/node";
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var REACT_ROUTER_VIRTUAL_MODULE_ID = "\0virtual:react-router/server-build";
|
|
8
|
+
var VIRTUAL_MODULE_ID = "\0virtual:react-router-hono-server/server";
|
|
9
|
+
var REACT_ROUTER_EXPORT = "export { serverManifest as assets, assetsBuildDirectory, basename, entry, future, isSpaMode, prerender, publicPath, routes, ssr };";
|
|
9
10
|
function reactRouterHonoServer(options = {}) {
|
|
10
11
|
const runtime = options.runtime || "node";
|
|
11
12
|
let pluginConfig;
|
|
@@ -14,12 +15,12 @@ function reactRouterHonoServer(options = {}) {
|
|
|
14
15
|
name: "react-router-hono-server",
|
|
15
16
|
enforce: "post",
|
|
16
17
|
resolveId(id) {
|
|
17
|
-
if (id ===
|
|
18
|
+
if (id === VIRTUAL_MODULE_ID) {
|
|
18
19
|
return id;
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
22
|
load(id) {
|
|
22
|
-
if (id ===
|
|
23
|
+
if (id === VIRTUAL_MODULE_ID) {
|
|
23
24
|
return `
|
|
24
25
|
// generated by react-router-hono-server/dev
|
|
25
26
|
import { createHonoServer } from "react-router-hono-server/${runtime}";
|
|
@@ -28,7 +29,7 @@ function reactRouterHonoServer(options = {}) {
|
|
|
28
29
|
`;
|
|
29
30
|
}
|
|
30
31
|
},
|
|
31
|
-
async config(config) {
|
|
32
|
+
async config(config, env) {
|
|
32
33
|
pluginConfig = resolvePluginConfig(config, options);
|
|
33
34
|
if (!pluginConfig) {
|
|
34
35
|
return;
|
|
@@ -38,7 +39,7 @@ function reactRouterHonoServer(options = {}) {
|
|
|
38
39
|
"\x1B[33mThe unstable_viteEnvironmentApi is enabled.\nThis is experimental and may break your build.\x1B[0m\n"
|
|
39
40
|
);
|
|
40
41
|
}
|
|
41
|
-
if (runtime === "cloudflare" && !config.plugins?.find((p) => p && "name" in p && p.name === "react-router-cloudflare-vite-dev-proxy")) {
|
|
42
|
+
if (env.mode === "development" && runtime === "cloudflare" && !config.plugins?.find((p) => p && "name" in p && p.name === "react-router-cloudflare-vite-dev-proxy")) {
|
|
42
43
|
console.warn(
|
|
43
44
|
`\x1B[31mMissing cloudflareDevProxy() in your vite.config.ts.
|
|
44
45
|
Please add it to your plugins: import { cloudflareDevProxy } from "@react-router/dev/vite/cloudflare";\x1B[0m
|
|
@@ -85,14 +86,20 @@ Please add it to your plugins: import { cloudflareDevProxy } from "@react-router
|
|
|
85
86
|
rollupOptions: {
|
|
86
87
|
input: pluginConfig.serverEntryPoint,
|
|
87
88
|
output: {
|
|
88
|
-
entryFileNames:
|
|
89
|
+
entryFileNames: (chunk) => {
|
|
90
|
+
chunk.facadeModuleId = REACT_ROUTER_VIRTUAL_MODULE_ID;
|
|
91
|
+
return "index.js";
|
|
92
|
+
},
|
|
93
|
+
// not invoked when target is webworker (single file output)
|
|
89
94
|
chunkFileNames: (chunk) => {
|
|
90
95
|
if (chunk.name === "server-build") {
|
|
91
96
|
return reactRouterBuildFile;
|
|
92
97
|
}
|
|
93
98
|
return "assets/[name]-[hash].js";
|
|
94
99
|
},
|
|
95
|
-
|
|
100
|
+
// We are doing that because in this case, we build a single file that only exports the Hono server
|
|
101
|
+
// RR needs its exports for prerendering
|
|
102
|
+
footer: runtime === "cloudflare" ? REACT_ROUTER_EXPORT : void 0
|
|
96
103
|
}
|
|
97
104
|
}
|
|
98
105
|
}
|
|
@@ -116,7 +123,7 @@ Please add it to your plugins: import { cloudflareDevProxy } from "@react-router
|
|
|
116
123
|
}
|
|
117
124
|
console.log("Cleaning up server exports...");
|
|
118
125
|
const buildPath = path.join(pluginConfig.rootDirectory, pluginConfig.buildDirectory, "server", "index.js");
|
|
119
|
-
let
|
|
126
|
+
let serverFile = await fs.promises.readFile(buildPath, "utf-8").catch((e) => {
|
|
120
127
|
if (e.code === "ENOENT") {
|
|
121
128
|
console.error("\x1B[31m\nThe server was not built\x1B[0m");
|
|
122
129
|
if (pluginConfig?.flag?.force_react_19) {
|
|
@@ -125,13 +132,16 @@ Please add it to your plugins: import { cloudflareDevProxy } from "@react-router
|
|
|
125
132
|
);
|
|
126
133
|
}
|
|
127
134
|
}
|
|
128
|
-
|
|
135
|
+
return null;
|
|
129
136
|
});
|
|
130
|
-
|
|
137
|
+
if (!serverFile) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
serverFile = serverFile.replace(REACT_ROUTER_EXPORT, "");
|
|
131
141
|
if (await getReactVersion(pluginConfig) >= 19) {
|
|
132
|
-
|
|
142
|
+
serverFile = serverFile.replace(/react-dom\/server\.browser/g, "react-dom/server.edge");
|
|
133
143
|
}
|
|
134
|
-
await fs.promises.writeFile(buildPath,
|
|
144
|
+
await fs.promises.writeFile(buildPath, serverFile);
|
|
135
145
|
console.log("\x1B[32mAll done!\x1B[0m");
|
|
136
146
|
},
|
|
137
147
|
async configureServer(server) {
|
|
@@ -157,12 +167,16 @@ Please add it to your plugins: import { cloudflareDevProxy } from "@react-router
|
|
|
157
167
|
export: options.dev?.export || "default",
|
|
158
168
|
exclude: [
|
|
159
169
|
new RegExp(
|
|
160
|
-
`^(?=\\/${pluginConfig.appDirectory.replace(
|
|
170
|
+
`^(?=\\/${pluginConfig.appDirectory.replace(/^[/\\]+|[/\\]+$/g, "").replaceAll(/[/\\]+/g, "/")}\\/)((?!.*\\.data(\\?|$)).*\\..*(\\?.*)?$)`
|
|
171
|
+
),
|
|
172
|
+
new RegExp(
|
|
173
|
+
`^(?=\\/${pluginConfig.appDirectory.replace(/^[/\\]+|[/\\]+$/g, "").replaceAll(/[/\\]+/g, "/").split("/")[0]}\\/)((?!.*\\.data(\\?|$)).*\\..*(\\?.*)?$)`
|
|
161
174
|
),
|
|
162
175
|
/\?import(\?.*)?$/,
|
|
163
176
|
/^\/@.+$/,
|
|
164
177
|
/^\/node_modules\/.*/,
|
|
165
|
-
|
|
178
|
+
`^(?=\\/${pluginConfig.appDirectory.replace(/^[/\\]+|[/\\]+$/g, "").replace(/[/\\]+/g, "/")}/**/.*/**)`,
|
|
179
|
+
`^(?=\\/${pluginConfig.appDirectory.replace(/^[/\\]+|[/\\]+$/g, "").replace(/[/\\]+/g, "/").split("/")[0]}/**/.*/**)`,
|
|
166
180
|
...pluginConfig.dev?.exclude || []
|
|
167
181
|
]
|
|
168
182
|
});
|
|
@@ -221,7 +235,7 @@ function findDefaultServerEntry(appDirectory) {
|
|
|
221
235
|
if (!warned) {
|
|
222
236
|
console.warn(
|
|
223
237
|
`\x1B[33mNo server entry point found.
|
|
224
|
-
Will use a virtual module (${
|
|
238
|
+
Will use a virtual module (${VIRTUAL_MODULE_ID}) with a default Hono server.
|
|
225
239
|
|
|
226
240
|
To customize the server, create one of the following files:
|
|
227
241
|
- ${fileWay} (npx react-router-hono-server reveal file)
|
|
@@ -231,7 +245,7 @@ You can also set the \`serverEntryPoint\` option in the reactRouterHonoServer pl
|
|
|
231
245
|
);
|
|
232
246
|
warned = true;
|
|
233
247
|
}
|
|
234
|
-
return
|
|
248
|
+
return VIRTUAL_MODULE_ID;
|
|
235
249
|
}
|
|
236
250
|
async function getReactVersion(pluginConfig) {
|
|
237
251
|
if (pluginConfig?.flag?.force_react_19) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-router-hono-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.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": {
|
|
@@ -54,18 +54,6 @@
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
-
"scripts": {
|
|
58
|
-
"test": "vitest run",
|
|
59
|
-
"test:cov": "vitest run --coverage",
|
|
60
|
-
"build": "tsup",
|
|
61
|
-
"build:watch": "npm run build -- --watch",
|
|
62
|
-
"prepublishOnly": "npm run build",
|
|
63
|
-
"check": "biome check .",
|
|
64
|
-
"check:fix": "biome check --fix .",
|
|
65
|
-
"typecheck": "tsc",
|
|
66
|
-
"validate": "npm run check && npm run tsc",
|
|
67
|
-
"clear-all": "rm -rf node_modules package-lock.json && find ./examples -type d -name 'node_modules' -exec rm -rf {} + && find ./examples -name 'package-lock.json' -exec rm -f {} +"
|
|
68
|
-
},
|
|
69
57
|
"author": "",
|
|
70
58
|
"license": "ISC",
|
|
71
59
|
"repository": {
|
|
@@ -78,35 +66,37 @@
|
|
|
78
66
|
"bin": {
|
|
79
67
|
"react-router-hono-server": "dist/cli.js"
|
|
80
68
|
},
|
|
81
|
-
"files": [
|
|
69
|
+
"files": [
|
|
70
|
+
"dist"
|
|
71
|
+
],
|
|
82
72
|
"homepage": "https://github.com/rphlmr/react-router-hono-server#readme",
|
|
83
73
|
"dependencies": {
|
|
84
74
|
"@drizzle-team/brocli": "^0.11.0",
|
|
85
|
-
"@hono/node-server": "^1.
|
|
86
|
-
"@hono/node-ws": "^1.
|
|
87
|
-
"@hono/vite-dev-server": "^0.
|
|
88
|
-
"hono": "^4.
|
|
75
|
+
"@hono/node-server": "^1.14.0",
|
|
76
|
+
"@hono/node-ws": "^1.1.1",
|
|
77
|
+
"@hono/vite-dev-server": "^0.19.0",
|
|
78
|
+
"hono": "^4.7.5"
|
|
89
79
|
},
|
|
90
80
|
"devDependencies": {
|
|
91
81
|
"@biomejs/biome": "^1.9.4",
|
|
92
|
-
"@cloudflare/workers-types": "^4.
|
|
93
|
-
"@types/bun": "^1.
|
|
94
|
-
"@types/node": "^22.
|
|
95
|
-
"@vitest/coverage-v8": "^
|
|
96
|
-
"lefthook": "^1.
|
|
82
|
+
"@cloudflare/workers-types": "^4.20250405.0",
|
|
83
|
+
"@types/bun": "^1.2.8",
|
|
84
|
+
"@types/node": "^22.14.0",
|
|
85
|
+
"@vitest/coverage-v8": "^3.1.1",
|
|
86
|
+
"lefthook": "^1.11.6",
|
|
97
87
|
"npm-run-all": "^4.1.5",
|
|
98
|
-
"tsup": "^8.
|
|
99
|
-
"typescript": "^5.
|
|
100
|
-
"vitest": "^
|
|
88
|
+
"tsup": "^8.4.0",
|
|
89
|
+
"typescript": "^5.8.3",
|
|
90
|
+
"vitest": "^3.1.1"
|
|
101
91
|
},
|
|
102
92
|
"peerDependencies": {
|
|
103
|
-
"@cloudflare/workers-types": "^4.
|
|
93
|
+
"@cloudflare/workers-types": "^4.20250317.0",
|
|
104
94
|
"@types/react": "^18.3.10 || ^19.0.0",
|
|
105
95
|
"@react-router/dev": "^7.2.0",
|
|
106
96
|
"miniflare": "^3.20241205.0",
|
|
107
97
|
"react-router": "^7.2.0",
|
|
108
|
-
"vite": "^
|
|
109
|
-
"wrangler": "^
|
|
98
|
+
"vite": "^6.0.0",
|
|
99
|
+
"wrangler": "^4.2.0"
|
|
110
100
|
},
|
|
111
101
|
"peerDependenciesMeta": {
|
|
112
102
|
"@cloudflare/workers-types": {
|
|
@@ -121,5 +111,16 @@
|
|
|
121
111
|
},
|
|
122
112
|
"engines": {
|
|
123
113
|
"node": ">=22.12.0"
|
|
114
|
+
},
|
|
115
|
+
"scripts": {
|
|
116
|
+
"test": "vitest run",
|
|
117
|
+
"test:cov": "vitest run --coverage",
|
|
118
|
+
"build": "tsup",
|
|
119
|
+
"build:watch": "npm run build -- --watch",
|
|
120
|
+
"check": "biome check .",
|
|
121
|
+
"check:fix": "biome check --fix .",
|
|
122
|
+
"typecheck": "tsc",
|
|
123
|
+
"validate": "npm run check && npm run tsc",
|
|
124
|
+
"clear-all": "rm -rf node_modules pnpm-lock.yaml && find ./examples -type d -name 'node_modules' -exec rm -rf {} + && find ./examples -name 'pnpm-lock.yaml' -exec rm -f {} +"
|
|
124
125
|
}
|
|
125
|
-
}
|
|
126
|
+
}
|