next-ws 2.2.16 → 2.2.18
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/cli.cjs +2 -2
- package/dist/server/index.cjs +15 -3
- package/package.json +2 -2
package/dist/cli.cjs
CHANGED
|
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
var import_minimist = __toESM(require("minimist"));
|
|
28
28
|
|
|
29
29
|
// package.json
|
|
30
|
-
var version = "2.2.
|
|
30
|
+
var version = "2.2.18";
|
|
31
31
|
|
|
32
32
|
// src/commands/helpers/define.ts
|
|
33
33
|
function defineCommandGroup(definition) {
|
|
@@ -843,7 +843,7 @@ var patchCookies2 = definePatchStep({
|
|
|
843
843
|
});
|
|
844
844
|
var patch_2_default = definePatch({
|
|
845
845
|
name: "patch-2",
|
|
846
|
-
versions: ">=15.0.0 <=16.
|
|
846
|
+
versions: ">=15.0.0 <=16.4.1",
|
|
847
847
|
steps: [
|
|
848
848
|
patchNextNodeServer,
|
|
849
849
|
patchRouterServer,
|
package/dist/server/index.cjs
CHANGED
|
@@ -165,7 +165,9 @@ async function importRouteModule(nextServer, filePathname) {
|
|
|
165
165
|
}
|
|
166
166
|
try {
|
|
167
167
|
const buildPagePath = nextServer.getPagePath(filePathname);
|
|
168
|
-
|
|
168
|
+
const routeModule = (await require(buildPagePath)).routeModule;
|
|
169
|
+
await routeModule?.ensureUserland?.();
|
|
170
|
+
return routeModule;
|
|
169
171
|
} catch (cause) {
|
|
170
172
|
console.error(cause);
|
|
171
173
|
return void 0;
|
|
@@ -259,8 +261,18 @@ function setupWebSocketServer(nextServer, options) {
|
|
|
259
261
|
logger2.error(`[next-ws] could not import module for page ${pathname}`);
|
|
260
262
|
return socket.end();
|
|
261
263
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
+
let handleUpgrade;
|
|
265
|
+
let handleSocket;
|
|
266
|
+
try {
|
|
267
|
+
handleUpgrade = module2.userland.UPGRADE;
|
|
268
|
+
handleSocket = module2.userland.SOCKET;
|
|
269
|
+
} catch (cause) {
|
|
270
|
+
logger2.error(
|
|
271
|
+
`[next-ws] could not access handlers for page ${pathname}`,
|
|
272
|
+
cause
|
|
273
|
+
);
|
|
274
|
+
return socket.end();
|
|
275
|
+
}
|
|
264
276
|
if ((!handleUpgrade || typeof handleUpgrade !== "function") && (!handleSocket || typeof handleSocket !== "function")) {
|
|
265
277
|
logger2.error(`[next-ws] route '${pathname}' does not export a handler`);
|
|
266
278
|
return socket.end();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-ws",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.18",
|
|
4
4
|
"description": "Add support for WebSockets in the Next.js app directory",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"chalk": "^5.6.2",
|
|
61
61
|
"husky": "^9.1.7",
|
|
62
62
|
"ioredis": "^5.10.0",
|
|
63
|
-
"next": "16.
|
|
63
|
+
"next": "16.4.1",
|
|
64
64
|
"pinst": "^3.0.0",
|
|
65
65
|
"react": "19.1.1",
|
|
66
66
|
"react-dom": "19.1.1",
|