react-router-hono-server 2.17.0-next.0 → 2.17.0-next.2

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.
@@ -6,7 +6,7 @@ import {
6
6
  createGetLoadContext,
7
7
  getBuildMode,
8
8
  importBuild
9
- } from "../chunk-ZGIYBMNC.js";
9
+ } from "../chunk-XPXQNPY3.js";
10
10
  import {
11
11
  cache
12
12
  } from "../chunk-YI5FED4X.js";
@@ -4,22 +4,21 @@ import {
4
4
  createGetLoadContext,
5
5
  createWebSocket,
6
6
  getBuildMode,
7
- importBuild,
8
7
  patchUpgradeListener
9
- } from "../chunk-ZGIYBMNC.js";
8
+ } from "../chunk-XPXQNPY3.js";
10
9
  import {
11
10
  cache
12
11
  } from "../chunk-YI5FED4X.js";
13
12
  import "../chunk-JSBRDJBE.js";
14
13
 
15
14
  // src/adapters/bun.ts
15
+ import * as build from "virtual:react-router/server-build";
16
16
  import { Hono } from "hono";
17
17
  import { serveStatic } from "hono/bun";
18
18
  import { createMiddleware } from "hono/factory";
19
19
  import { logger } from "hono/logger";
20
20
  import { createRequestHandler } from "react-router";
21
21
  async function createHonoServer(options) {
22
- const build = await importBuild();
23
22
  const basename = import.meta.env.REACT_ROUTER_HONO_SERVER_BASENAME;
24
23
  const mergedOptions = {
25
24
  ...options,
@@ -3,7 +3,7 @@ import {
3
3
  createGetLoadContext,
4
4
  getBuildMode,
5
5
  importBuild
6
- } from "../chunk-ZGIYBMNC.js";
6
+ } from "../chunk-XPXQNPY3.js";
7
7
  import {
8
8
  cache
9
9
  } from "../chunk-YI5FED4X.js";
@@ -10,24 +10,20 @@ import {
10
10
  createGetLoadContext,
11
11
  createWebSocket,
12
12
  getBuildMode,
13
- importBuild,
14
13
  patchUpgradeListener
15
- } from "../chunk-ZGIYBMNC.js";
14
+ } from "../chunk-XPXQNPY3.js";
16
15
  import {
17
16
  cache
18
17
  } from "../chunk-YI5FED4X.js";
19
18
  import "../chunk-JSBRDJBE.js";
20
19
 
21
20
  // src/adapters/node.ts
21
+ import * as build from "virtual:react-router/server-build";
22
22
  import { Hono } from "hono";
23
23
  import { createMiddleware } from "hono/factory";
24
24
  import { logger } from "hono/logger";
25
25
  import { createRequestHandler } from "react-router";
26
26
  async function createHonoServer(options) {
27
- if (!options?.listeningListener) {
28
- console.time("\u{1F3CE}\uFE0F Server started in");
29
- }
30
- const build = await importBuild();
31
27
  const basename = import.meta.env.REACT_ROUTER_HONO_SERVER_BASENAME;
32
28
  const mergedOptions = {
33
29
  ...options,
@@ -37,7 +33,6 @@ async function createHonoServer(options) {
37
33
  if (basename !== "/") {
38
34
  console.log(`\u{1F517} http://127.0.0.1:${info.port}${basename}`);
39
35
  }
40
- console.timeEnd("\u{1F3CE}\uFE0F Server started in");
41
36
  }),
42
37
  port: options?.port || Number(process.env.PORT) || 3e3,
43
38
  defaultLogger: options?.defaultLogger ?? true,
@@ -1,9 +1,8 @@
1
1
  // src/helpers.ts
2
2
  import { createMiddleware } from "hono/factory";
3
- import { defineWebSocketHelper } from "hono/ws";
4
3
  var defaultWebSocket = {
5
- upgradeWebSocket: defineWebSocketHelper(() => {
6
- }),
4
+ upgradeWebSocket: () => {
5
+ },
7
6
  injectWebSocket: (server) => server
8
7
  };
9
8
  async function createWebSocket({ app, enabled }) {
package/dist/dev.js CHANGED
@@ -1853,7 +1853,8 @@ Please add it to your plugins: import { cloudflareDevProxy } from "@react-router
1853
1853
  target: runtime === "cloudflare" ? "webworker" : void 0,
1854
1854
  // Ensure our package is not externalized during SSR build
1855
1855
  // This is necessary because we are using a virtual import to load the React Router server entry point
1856
- noExternal: ["react-router-hono-server"]
1856
+ noExternal: ["react-router-hono-server"],
1857
+ external: ["@hono/node-ws"]
1857
1858
  }
1858
1859
  };
1859
1860
  if (!pluginConfig.future.unstable_viteEnvironmentApi && !pluginConfig.isSsrBuild) {
@@ -1875,9 +1876,6 @@ Please add it to your plugins: import { cloudflareDevProxy } from "@react-router
1875
1876
  alias
1876
1877
  },
1877
1878
  build: {
1878
- // https://vite.dev/config/build-options#build-target
1879
- cssTarget: ["es2020", "edge88", "firefox78", "chrome87", "safari14"],
1880
- target: "esnext",
1881
1879
  rollupOptions: {
1882
1880
  input: pluginConfig.serverEntryPoint,
1883
1881
  output: {
@@ -1885,16 +1883,21 @@ Please add it to your plugins: import { cloudflareDevProxy } from "@react-router
1885
1883
  chunk.facadeModuleId = REACT_ROUTER_VIRTUAL_MODULE_ID;
1886
1884
  return "index.js";
1887
1885
  },
1888
- // not invoked when target is webworker (single file output)
1886
+ // not invoked when target is webworker (single file output) TODO: Useless now
1889
1887
  chunkFileNames: (chunk) => {
1890
1888
  if (chunk.name === "server-build") {
1891
1889
  return reactRouterBuildFile;
1892
1890
  }
1893
1891
  return "assets/[name]-[hash].js";
1894
1892
  },
1895
- // We are doing that because in this case, we build a single file that only exports the Hono server
1893
+ // We are doing that because we build a single file that only exports the Hono server
1896
1894
  // RR needs its exports for prerendering
1897
- footer: runtime === "cloudflare" ? REACT_ROUTER_EXPORT : void 0
1895
+ footer: (chunk) => {
1896
+ if (!chunk.isEntry) {
1897
+ return "";
1898
+ }
1899
+ return REACT_ROUTER_EXPORT;
1900
+ }
1898
1901
  }
1899
1902
  }
1900
1903
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-router-hono-server",
3
- "version": "2.17.0-next.0",
3
+ "version": "2.17.0-next.2",
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
  "publishConfig": {
@@ -9,50 +9,50 @@
9
9
  "exports": {
10
10
  "./node": {
11
11
  "import": {
12
- "import": "./dist/adapters/node.js",
13
12
  "types": "./dist/adapters/node.d.ts",
13
+ "import": "./dist/adapters/node.js",
14
14
  "default": "./dist/adapters/node.js"
15
15
  }
16
16
  },
17
17
  "./bun": {
18
18
  "import": {
19
- "import": "./dist/adapters/bun.js",
20
19
  "types": "./dist/adapters/bun.d.ts",
20
+ "import": "./dist/adapters/bun.js",
21
21
  "default": "./dist/adapters/bun.js"
22
22
  }
23
23
  },
24
24
  "./cloudflare": {
25
25
  "import": {
26
- "import": "./dist/adapters/cloudflare.js",
27
26
  "types": "./dist/adapters/cloudflare.d.ts",
27
+ "import": "./dist/adapters/cloudflare.js",
28
28
  "default": "./dist/adapters/cloudflare.js"
29
29
  }
30
30
  },
31
31
  "./aws-lambda": {
32
32
  "import": {
33
- "import": "./dist/adapters/aws-lambda.js",
34
33
  "types": "./dist/adapters/aws-lambda.d.ts",
34
+ "import": "./dist/adapters/aws-lambda.js",
35
35
  "default": "./dist/adapters/aws-lambda.js"
36
36
  }
37
37
  },
38
38
  "./dev": {
39
39
  "import": {
40
- "import": "./dist/dev.js",
41
40
  "types": "./dist/dev.d.ts",
41
+ "import": "./dist/dev.js",
42
42
  "default": "./dist/dev.js"
43
43
  }
44
44
  },
45
45
  "./middleware": {
46
46
  "import": {
47
- "import": "./dist/middleware.js",
48
47
  "types": "./dist/middleware.d.ts",
48
+ "import": "./dist/middleware.js",
49
49
  "default": "./dist/middleware.js"
50
50
  }
51
51
  },
52
52
  "./http": {
53
53
  "import": {
54
- "import": "./dist/http.js",
55
54
  "types": "./dist/http.d.ts",
55
+ "import": "./dist/http.js",
56
56
  "default": "./dist/http.js"
57
57
  }
58
58
  }