Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"jiti": "^2.4.2",
"listhen": "^1.9.0",
"prettier": "^3.5.3",
"srvx": "^0.7.1",
"srvx": "^0.10.1",
"typescript": "^5.8.3",
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.44.0",
"unbuild": "^3.5.0",
Expand All @@ -111,6 +111,12 @@
"esbuild",
"sharp",
"workerd"
],
"onlyBuiltDependencies": [
"@parcel/watcher",
"esbuild",
"sharp",
"workerd"
]
}
}
11 changes: 9 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions src/server/_types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import type {
Server,
ServerPlugin,
ServerOptions,
ServerRequest,
} from "srvx/types";
import type { Server, ServerPlugin, ServerOptions, ServerRequest } from "srvx";

import type { Hooks } from "../hooks";

Expand Down
4 changes: 1 addition & 3 deletions src/server/bun.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { serve as srvxServe } from "srvx/bun";
import adapter from "../adapters/bun";

import type { Server, ServerPlugin } from "srvx/types";
import type { Server, ServerPlugin } from "srvx";
import type { WSOptions, ServerWithWSOptions } from "./_types";

export function plugin(wsOpts: WSOptions): ServerPlugin {
Expand All @@ -23,11 +23,9 @@ export function plugin(wsOpts: WSOptions): ServerPlugin {
});

server.options.bun ??= {};
// @ts-expect-error
if (server.options.bun.websocket) {
throw new Error("websocket handlers for bun already set!");
}
// @ts-expect-error
server.options.bun.websocket = ws.websocket;
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/cloudflare.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { serve as srvxServe } from "srvx/cloudflare";
import adapter from "../adapters/cloudflare";

import type { Server, ServerPlugin } from "srvx/types";
import type { Server, ServerPlugin } from "srvx";
import type { WSOptions, ServerWithWSOptions } from "./_types";

export function plugin(wsOpts: WSOptions): ServerPlugin {
Expand Down
2 changes: 1 addition & 1 deletion src/server/default.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { serve as srvxServe } from "srvx";
import adapter from "../adapters/sse";

import type { Server, ServerPlugin } from "srvx/types";
import type { Server, ServerPlugin } from "srvx";
import type { WSOptions, ServerWithWSOptions } from "./_types";

export function plugin(wsOpts: WSOptions): ServerPlugin {
Expand Down
2 changes: 1 addition & 1 deletion src/server/deno.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { serve as srvxServe } from "srvx/deno";
import adapter from "../adapters/deno";

import type { Server, ServerPlugin } from "srvx/types";
import type { Server, ServerPlugin } from "srvx";
import type { WSOptions, ServerWithWSOptions } from "./_types";

export function plugin(wsOpts: WSOptions): ServerPlugin {
Expand Down
4 changes: 1 addition & 3 deletions src/server/node.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { serve as srvxServe, NodeRequest } from "srvx/node";
import adapter from "../adapters/node";

import type { Server, ServerPlugin } from "srvx/types";
import type { Server, ServerPlugin } from "srvx";
import type { WSOptions, ServerWithWSOptions } from "./_types";

export function plugin(wsOpts: WSOptions): ServerPlugin {
Expand All @@ -11,9 +11,7 @@ export function plugin(wsOpts: WSOptions): ServerPlugin {
resolve: wsOpts.resolve,
...wsOpts.options?.deno,
});
// @ts-expect-error
const originalServe = server.serve;
// @ts-expect-error
server.serve = () => {
server.node?.server!.on("upgrade", (req, socket, head) => {
ws.handleUpgrade(
Expand Down