react-router-hono-server 2.25.3 → 3.0.0-next.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 +84 -6
- package/dist/adapters/aws-lambda.d.ts +17 -70
- package/dist/adapters/aws-lambda.js +73 -71
- package/dist/adapters/bun.d.ts +37 -40
- package/dist/adapters/bun.js +114 -131
- package/dist/adapters/cloudflare.d.ts +8 -12
- package/dist/adapters/cloudflare.js +84 -98
- package/dist/adapters/deno.d.ts +51 -0
- package/dist/adapters/deno.js +106 -0
- package/dist/adapters/node.d.ts +62 -67
- package/dist/adapters/node.js +94 -103
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +32 -39
- package/dist/dev.d.ts +46 -44
- package/dist/dev.js +182 -262
- package/dist/{helpers-BXdVojwF.d.ts → helpers-CvvzWAWX.d.ts} +20 -24
- package/dist/helpers-DpeZU9Bf.js +108 -0
- package/dist/http.d.ts +4 -3
- package/dist/http.js +53 -48
- package/dist/middleware.d.ts +4 -5
- package/dist/middleware.js +17 -6
- package/package.json +38 -29
- package/dist/chunk-BH64OQMW.js +0 -102
- package/dist/chunk-YI5FED4X.js +0 -18
package/dist/adapters/node.d.ts
CHANGED
|
@@ -1,88 +1,83 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ServerType } from
|
|
3
|
-
import { ServeStaticOptions } from
|
|
4
|
-
import { Env, Hono } from
|
|
5
|
-
import { BlankEnv } from
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import { ServerOptions as ServerOptions$2, createServer as createServer$2
|
|
10
|
-
import { ServerOptions as ServerOptions$1, createServer as createServer$1 } from 'node:https';
|
|
11
|
-
import 'hono/ws';
|
|
12
|
-
import 'react-router';
|
|
1
|
+
import { i as WithoutWebsocket, n as HonoServerOptionsBase, r as WithWebsocket, t as createGetLoadContext } from "../helpers-CvvzWAWX.js";
|
|
2
|
+
import { ServerType } from "@hono/node-server";
|
|
3
|
+
import { ServeStaticOptions } from "@hono/node-server/serve-static";
|
|
4
|
+
import { Env, Hono } from "hono";
|
|
5
|
+
import { BlankEnv } from "hono/types";
|
|
6
|
+
import { ServerOptions, createServer } from "node:http";
|
|
7
|
+
import { SecureServerOptions, ServerOptions as ServerOptions$1, createSecureServer, createServer as createServer$1 } from "node:http2";
|
|
8
|
+
import { AddressInfo } from "node:net";
|
|
9
|
+
import { ServerOptions as ServerOptions$2, createServer as createServer$2 } from "node:https";
|
|
13
10
|
|
|
11
|
+
//#region src/types/node.https.d.ts
|
|
14
12
|
type createHttpOptions = {
|
|
15
13
|
serverOptions?: ServerOptions;
|
|
16
14
|
createServer?: typeof createServer;
|
|
17
15
|
};
|
|
18
16
|
type createHttpsOptions = {
|
|
19
|
-
serverOptions?: ServerOptions$1;
|
|
20
|
-
createServer?: typeof createServer$1;
|
|
21
|
-
};
|
|
22
|
-
type createHttp2Options = {
|
|
23
17
|
serverOptions?: ServerOptions$2;
|
|
24
18
|
createServer?: typeof createServer$2;
|
|
25
19
|
};
|
|
20
|
+
type createHttp2Options = {
|
|
21
|
+
serverOptions?: ServerOptions$1;
|
|
22
|
+
createServer?: typeof createServer$1;
|
|
23
|
+
};
|
|
26
24
|
type createSecureHttp2Options = {
|
|
27
25
|
serverOptions?: SecureServerOptions;
|
|
28
26
|
createServer?: typeof createSecureServer;
|
|
29
27
|
};
|
|
30
|
-
type CreateNodeServerOptions =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
| createHttp2Options
|
|
34
|
-
| createSecureHttp2Options;
|
|
35
|
-
|
|
28
|
+
type CreateNodeServerOptions = createHttpOptions | createHttpsOptions | createHttp2Options | createSecureHttp2Options;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/adapters/node.d.ts
|
|
36
31
|
interface HonoNodeServerOptions<E extends Env = BlankEnv> extends HonoServerOptionsBase<E> {
|
|
32
|
+
/**
|
|
33
|
+
* Listening listener (production mode only)
|
|
34
|
+
*
|
|
35
|
+
* It is called when the server is listening
|
|
36
|
+
*
|
|
37
|
+
* Defaults log the port
|
|
38
|
+
*/
|
|
39
|
+
listeningListener?: (info: AddressInfo) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Customize the node server (ex: using http2)
|
|
42
|
+
*
|
|
43
|
+
* {@link https://hono.dev/docs/getting-started/nodejs#http2}
|
|
44
|
+
*/
|
|
45
|
+
customNodeServer?: CreateNodeServerOptions;
|
|
46
|
+
/**
|
|
47
|
+
* Callback executed just after `serve` from `@hono/node-server`
|
|
48
|
+
*/
|
|
49
|
+
onServe?: (server: ServerType) => void;
|
|
50
|
+
/**
|
|
51
|
+
* The Node.js Adapter rewrites the global Request/Response and uses a lightweight Request/Response to improve performance.
|
|
52
|
+
*
|
|
53
|
+
* If you this behavior, set it to `true`
|
|
54
|
+
*
|
|
55
|
+
* 🚨 Setting this to `true` can break `request.clone()` if you later check `instanceof Request`.
|
|
56
|
+
*
|
|
57
|
+
* {@link https://github.com/honojs/node-server?tab=readme-ov-file#overrideglobalobjects}
|
|
58
|
+
*
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
overrideGlobalObjects?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Customize the hostname of the node server
|
|
64
|
+
*/
|
|
65
|
+
hostname?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Customize the serve static options
|
|
68
|
+
*/
|
|
69
|
+
serveStaticOptions?: {
|
|
37
70
|
/**
|
|
38
|
-
*
|
|
71
|
+
* Customize the public assets (what's in your `public` directory) serve static options.
|
|
39
72
|
*
|
|
40
|
-
* It is called when the server is listening
|
|
41
|
-
*
|
|
42
|
-
* Defaults log the port
|
|
43
73
|
*/
|
|
44
|
-
|
|
74
|
+
publicAssets?: Omit<ServeStaticOptions<E>, "root">;
|
|
45
75
|
/**
|
|
46
|
-
* Customize the
|
|
76
|
+
* Customize the client assets (what's in your `build/client/assets` directory - React Router) serve static options.
|
|
47
77
|
*
|
|
48
|
-
* {@link https://hono.dev/docs/getting-started/nodejs#http2}
|
|
49
|
-
*/
|
|
50
|
-
customNodeServer?: CreateNodeServerOptions;
|
|
51
|
-
/**
|
|
52
|
-
* Callback executed just after `serve` from `@hono/node-server`
|
|
53
78
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
* The Node.js Adapter rewrites the global Request/Response and uses a lightweight Request/Response to improve performance.
|
|
57
|
-
*
|
|
58
|
-
* If you this behavior, set it to `true`
|
|
59
|
-
*
|
|
60
|
-
* 🚨 Setting this to `true` can break `request.clone()` if you later check `instanceof Request`.
|
|
61
|
-
*
|
|
62
|
-
* {@link https://github.com/honojs/node-server?tab=readme-ov-file#overrideglobalobjects}
|
|
63
|
-
*
|
|
64
|
-
* @default false
|
|
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
|
-
};
|
|
79
|
+
clientAssets?: Omit<ServeStaticOptions<E>, "root">;
|
|
80
|
+
};
|
|
86
81
|
}
|
|
87
82
|
type HonoServerOptionsWithWebSocket<E extends Env = BlankEnv> = HonoNodeServerOptions<E> & WithWebsocket<E>;
|
|
88
83
|
type HonoServerOptionsWithoutWebSocket<E extends Env = BlankEnv> = HonoNodeServerOptions<E> & WithoutWebsocket<E>;
|
|
@@ -94,5 +89,5 @@ type HonoServerOptions<E extends Env = BlankEnv> = HonoServerOptionsWithWebSocke
|
|
|
94
89
|
*/
|
|
95
90
|
declare function createHonoServer<E extends Env = BlankEnv>(options?: HonoServerOptionsWithoutWebSocket<E>): Promise<Hono<E>>;
|
|
96
91
|
declare function createHonoServer<E extends Env = BlankEnv>(options?: HonoServerOptionsWithWebSocket<E>): Promise<Hono<E>>;
|
|
97
|
-
|
|
98
|
-
export {
|
|
92
|
+
//#endregion
|
|
93
|
+
export { HonoServerOptions, createGetLoadContext, createHonoServer };
|
package/dist/adapters/node.js
CHANGED
|
@@ -1,111 +1,102 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
cleanUpgradeListeners,
|
|
4
|
-
createGetLoadContext,
|
|
5
|
-
createWebSocket,
|
|
6
|
-
getBuildMode,
|
|
7
|
-
importBuild,
|
|
8
|
-
patchUpgradeListener
|
|
9
|
-
} from "../chunk-BH64OQMW.js";
|
|
10
|
-
import {
|
|
11
|
-
cache
|
|
12
|
-
} from "../chunk-YI5FED4X.js";
|
|
13
|
-
|
|
14
|
-
// src/adapters/node.ts
|
|
1
|
+
import { a as getBuildMode, i as createWebSocket, n as cleanUpgradeListeners, o as importBuild, r as createGetLoadContext, s as patchUpgradeListener, t as bindIncomingRequestSocketInfo } from "../helpers-DpeZU9Bf.js";
|
|
2
|
+
import { cache } from "../middleware.js";
|
|
15
3
|
import { serve } from "@hono/node-server";
|
|
16
4
|
import { serveStatic } from "@hono/node-server/serve-static";
|
|
17
5
|
import { Hono } from "hono";
|
|
18
6
|
import { createMiddleware } from "hono/factory";
|
|
19
7
|
import { logger } from "hono/logger";
|
|
20
8
|
import { createRequestHandler } from "react-router";
|
|
9
|
+
//#region src/adapters/node.ts
|
|
21
10
|
async function createHonoServer(options) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
11
|
+
const startTime = Date.now();
|
|
12
|
+
const build = await importBuild();
|
|
13
|
+
const basename = import.meta.env.REACT_ROUTER_HONO_SERVER_BASENAME;
|
|
14
|
+
const mergedOptions = {
|
|
15
|
+
...options,
|
|
16
|
+
listeningListener: options?.listeningListener || ((info) => {
|
|
17
|
+
console.log(`🚀 Server started on port ${info.port}`);
|
|
18
|
+
console.log(`🌍 http://127.0.0.1:${info.port}`);
|
|
19
|
+
if (basename !== "/") console.log(`🔗 http://127.0.0.1:${info.port}${basename}`);
|
|
20
|
+
console.log(`🏎️ Server started in ${Date.now() - startTime}ms`);
|
|
21
|
+
}),
|
|
22
|
+
port: options?.port || Number(process.env.PORT) || 3e3,
|
|
23
|
+
defaultLogger: options?.defaultLogger ?? true,
|
|
24
|
+
overrideGlobalObjects: options?.overrideGlobalObjects ?? false
|
|
25
|
+
};
|
|
26
|
+
const mode = getBuildMode();
|
|
27
|
+
const PRODUCTION = mode === "production";
|
|
28
|
+
const clientBuildPath = `${import.meta.env.REACT_ROUTER_HONO_SERVER_BUILD_DIRECTORY}/client`;
|
|
29
|
+
const app = new Hono(mergedOptions.app);
|
|
30
|
+
const { upgradeWebSocket, injectWebSocket } = await createWebSocket({
|
|
31
|
+
app,
|
|
32
|
+
enabled: mergedOptions.useWebSocket ?? false
|
|
33
|
+
});
|
|
34
|
+
if (!PRODUCTION) app.use(bindIncomingRequestSocketInfo());
|
|
35
|
+
/**
|
|
36
|
+
* Add optional middleware that runs before any built-in middleware, including assets serving.
|
|
37
|
+
*/
|
|
38
|
+
await mergedOptions.beforeAll?.(app);
|
|
39
|
+
/**
|
|
40
|
+
* Serve assets files from build/client/assets
|
|
41
|
+
*/
|
|
42
|
+
app.use(`/${import.meta.env.REACT_ROUTER_HONO_SERVER_ASSETS_DIR}/*`, cache(3600 * 24 * 365), serveStatic({
|
|
43
|
+
root: clientBuildPath,
|
|
44
|
+
...mergedOptions.serveStaticOptions?.clientAssets
|
|
45
|
+
}));
|
|
46
|
+
/**
|
|
47
|
+
* Serve public files
|
|
48
|
+
*/
|
|
49
|
+
app.use("*", cache(3600), serveStatic({
|
|
50
|
+
root: PRODUCTION ? clientBuildPath : "./public",
|
|
51
|
+
...mergedOptions.serveStaticOptions?.publicAssets
|
|
52
|
+
}));
|
|
53
|
+
/**
|
|
54
|
+
* Add logger middleware
|
|
55
|
+
*/
|
|
56
|
+
if (mergedOptions.defaultLogger) app.use("*", logger());
|
|
57
|
+
/**
|
|
58
|
+
* Add optional middleware
|
|
59
|
+
*/
|
|
60
|
+
if (mergedOptions.useWebSocket) await mergedOptions.configure(app, { upgradeWebSocket });
|
|
61
|
+
else await mergedOptions.configure?.(app);
|
|
62
|
+
/**
|
|
63
|
+
* Create a React Router Hono app and bind it to the root Hono server using the React Router basename
|
|
64
|
+
*/
|
|
65
|
+
const reactRouterApp = new Hono({ strict: false });
|
|
66
|
+
reactRouterApp.use((c, next) => {
|
|
67
|
+
return createMiddleware(async (c) => {
|
|
68
|
+
const requestHandler = createRequestHandler(build, mode);
|
|
69
|
+
const loadContext = mergedOptions.getLoadContext?.(c, {
|
|
70
|
+
build,
|
|
71
|
+
mode
|
|
72
|
+
});
|
|
73
|
+
return requestHandler(c.req.raw, loadContext instanceof Promise ? await loadContext : loadContext);
|
|
74
|
+
})(c, next);
|
|
75
|
+
});
|
|
76
|
+
app.route(`${basename}`, reactRouterApp);
|
|
77
|
+
if (basename) app.route(`${basename}.data`, reactRouterApp);
|
|
78
|
+
/**
|
|
79
|
+
* Start the production server
|
|
80
|
+
*/
|
|
81
|
+
if (PRODUCTION) {
|
|
82
|
+
const server = serve({
|
|
83
|
+
...app,
|
|
84
|
+
...mergedOptions.customNodeServer,
|
|
85
|
+
port: mergedOptions.port,
|
|
86
|
+
overrideGlobalObjects: mergedOptions.overrideGlobalObjects,
|
|
87
|
+
hostname: mergedOptions.hostname
|
|
88
|
+
}, mergedOptions.listeningListener);
|
|
89
|
+
mergedOptions.onServe?.(server);
|
|
90
|
+
injectWebSocket(server);
|
|
91
|
+
} else if (globalThis.__viteDevServer?.httpServer) {
|
|
92
|
+
const httpServer = globalThis.__viteDevServer.httpServer;
|
|
93
|
+
cleanUpgradeListeners(httpServer);
|
|
94
|
+
mergedOptions.onServe?.(httpServer);
|
|
95
|
+
injectWebSocket(httpServer);
|
|
96
|
+
patchUpgradeListener(httpServer);
|
|
97
|
+
console.log("🚧 Dev server started");
|
|
98
|
+
}
|
|
99
|
+
return app;
|
|
107
100
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
createHonoServer
|
|
111
|
-
};
|
|
101
|
+
//#endregion
|
|
102
|
+
export { createGetLoadContext, createHonoServer };
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cli.js
CHANGED
|
@@ -1,45 +1,38 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import path from "path";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
5
4
|
import { command, run } from "@drizzle-team/brocli";
|
|
6
|
-
|
|
5
|
+
//#region src/cli.ts
|
|
6
|
+
const runtimeRegex = /runtime:\s*(['"])([^'"]*)\1/;
|
|
7
7
|
function guessRuntime() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
8
|
+
try {
|
|
9
|
+
return fs.readFileSync(path.resolve(process.cwd(), "vite.config.ts"), "utf-8").match(runtimeRegex)?.[2] || "node";
|
|
10
|
+
} catch {
|
|
11
|
+
return "node";
|
|
12
|
+
}
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import { createHonoServer } from "react-router-hono-server/${runtime}";
|
|
14
|
+
const serverFile = `// generated by react-router-hono-server/dev
|
|
15
|
+
import { createHonoServer } from "react-router-hono-server/${guessRuntime()}";
|
|
18
16
|
|
|
19
17
|
export default await createHonoServer();`;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
subcommands: [file, folder]
|
|
42
|
-
});
|
|
43
|
-
run([reveal], {
|
|
44
|
-
name: "React Router Hono Server CLI"
|
|
45
|
-
});
|
|
18
|
+
run([command({
|
|
19
|
+
name: "reveal",
|
|
20
|
+
subcommands: [command({
|
|
21
|
+
name: "file",
|
|
22
|
+
handler() {
|
|
23
|
+
const serverFilePath = path.resolve(process.cwd(), "app", "server.ts");
|
|
24
|
+
fs.writeFileSync(serverFilePath, serverFile);
|
|
25
|
+
console.log(`\x1b[33m✨ File created at ${serverFilePath}\x1b[0m`);
|
|
26
|
+
}
|
|
27
|
+
}), command({
|
|
28
|
+
name: "folder",
|
|
29
|
+
handler() {
|
|
30
|
+
const serverFilePath = path.resolve(process.cwd(), "app", "server", "index.ts");
|
|
31
|
+
if (!fs.existsSync(serverFilePath)) fs.mkdirSync(path.dirname(serverFilePath), { recursive: true });
|
|
32
|
+
fs.writeFileSync(serverFilePath, serverFile);
|
|
33
|
+
console.log(`\x1b[33m✨ Folder and file created at ${serverFilePath}\x1b[0m`);
|
|
34
|
+
}
|
|
35
|
+
})]
|
|
36
|
+
})], { name: "React Router Hono Server CLI" });
|
|
37
|
+
//#endregion
|
|
38
|
+
export {};
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,59 +1,61 @@
|
|
|
1
|
-
import { DevServerOptions } from
|
|
2
|
-
import { Plugin } from
|
|
3
|
-
|
|
4
|
-
type Runtime = "node" | "bun" | "cloudflare" | "aws";
|
|
1
|
+
import { DevServerOptions } from "@hono/vite-dev-server";
|
|
2
|
+
import { Plugin } from "vite";
|
|
5
3
|
|
|
4
|
+
//#region src/types/runtime.d.ts
|
|
5
|
+
type Runtime = "node" | "bun" | "cloudflare" | "aws" | "deno";
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/dev.d.ts
|
|
6
8
|
type ReactRouterHonoServerPluginOptionsBase = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The path to the server file, relative to `vite.config.ts`.
|
|
11
|
+
*
|
|
12
|
+
* If it is a folder (`app/server`), it will look for an `index.ts` file.
|
|
13
|
+
*
|
|
14
|
+
* Defaults to `${appDirectory}/server[.ts | /index.ts]` if present.
|
|
15
|
+
*
|
|
16
|
+
* Fallback to a virtual module `virtual:react-router-hono-server/server`.`
|
|
17
|
+
*/
|
|
18
|
+
serverEntryPoint?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The paths that are not served by the dev-server.
|
|
21
|
+
*
|
|
22
|
+
* Defaults include `appDirectory` content.
|
|
23
|
+
*/
|
|
24
|
+
dev?: {
|
|
17
25
|
/**
|
|
18
26
|
* The paths that are not served by the dev-server.
|
|
19
27
|
*
|
|
20
28
|
* Defaults include `appDirectory` content.
|
|
21
29
|
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* The paths that are not served by the dev-server.
|
|
25
|
-
*
|
|
26
|
-
* Defaults include `appDirectory` content.
|
|
27
|
-
*/
|
|
28
|
-
exclude?: DevServerOptions["exclude"];
|
|
29
|
-
/**
|
|
30
|
-
* The name of the export to use for the server.
|
|
31
|
-
*
|
|
32
|
-
* Defaults to `default`.
|
|
33
|
-
*/
|
|
34
|
-
export?: DevServerOptions["export"];
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
type ReactRouterHonoServerPluginOptionsDefault = ReactRouterHonoServerPluginOptionsBase & {
|
|
30
|
+
exclude?: DevServerOptions["exclude"];
|
|
38
31
|
/**
|
|
39
|
-
* The
|
|
32
|
+
* The name of the export to use for the server.
|
|
40
33
|
*
|
|
41
|
-
* Defaults to `
|
|
34
|
+
* Defaults to `default`.
|
|
42
35
|
*/
|
|
43
|
-
|
|
36
|
+
export?: DevServerOptions["export"];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
type ReactRouterHonoServerPluginOptionsDefault = ReactRouterHonoServerPluginOptionsBase & {
|
|
40
|
+
/**
|
|
41
|
+
* The runtime to use for the server.
|
|
42
|
+
*
|
|
43
|
+
* Defaults to `node`.
|
|
44
|
+
*/
|
|
45
|
+
runtime?: Runtime;
|
|
44
46
|
};
|
|
45
47
|
type ReactRouterHonoServerPluginOptionsCloudflare = ReactRouterHonoServerPluginOptionsBase & {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
/**
|
|
49
|
+
* The runtime to use for the server.
|
|
50
|
+
*
|
|
51
|
+
* Defaults to `node`.
|
|
52
|
+
*/
|
|
53
|
+
runtime: Extract<Runtime, "cloudflare">;
|
|
54
|
+
flag?: {
|
|
55
|
+
force_react_19?: boolean;
|
|
56
|
+
};
|
|
55
57
|
};
|
|
56
58
|
type ReactRouterHonoServerPluginOptions = ReactRouterHonoServerPluginOptionsDefault | ReactRouterHonoServerPluginOptionsCloudflare;
|
|
57
59
|
declare function reactRouterHonoServer(options?: ReactRouterHonoServerPluginOptions): Plugin;
|
|
58
|
-
|
|
59
|
-
export { reactRouterHonoServer };
|
|
60
|
+
//#endregion
|
|
61
|
+
export { reactRouterHonoServer };
|