next-ws 2.1.16 → 2.1.17
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 +7 -7
- package/dist/server/index.cjs +7 -6
- package/dist/server/index.d.ts +3 -2
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -122,7 +122,7 @@ var import_node_path2 = require("path");
|
|
|
122
122
|
var import_node_readline = __toESM(require("readline"));
|
|
123
123
|
var import_node_util = require("util");
|
|
124
124
|
|
|
125
|
-
// node_modules/.pnpm/chalk@5.6.
|
|
125
|
+
// node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
126
126
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
127
127
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
128
128
|
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
@@ -308,7 +308,7 @@ function assembleStyles() {
|
|
|
308
308
|
var ansiStyles = assembleStyles();
|
|
309
309
|
var ansi_styles_default = ansiStyles;
|
|
310
310
|
|
|
311
|
-
// node_modules/.pnpm/chalk@5.6.
|
|
311
|
+
// node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
|
|
312
312
|
var import_node_process = __toESM(require("process"), 1);
|
|
313
313
|
var import_node_os = __toESM(require("os"), 1);
|
|
314
314
|
var import_node_tty = __toESM(require("tty"), 1);
|
|
@@ -440,7 +440,7 @@ var supportsColor = {
|
|
|
440
440
|
};
|
|
441
441
|
var supports_color_default = supportsColor;
|
|
442
442
|
|
|
443
|
-
// node_modules/.pnpm/chalk@5.6.
|
|
443
|
+
// node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
|
|
444
444
|
function stringReplaceAll(string, substring, replacer) {
|
|
445
445
|
let index = string.indexOf(substring);
|
|
446
446
|
if (index === -1) {
|
|
@@ -470,11 +470,11 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
|
470
470
|
return returnValue;
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
-
// node_modules/.pnpm/chalk@5.6.
|
|
473
|
+
// node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
|
|
474
474
|
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
475
|
-
var GENERATOR = Symbol("GENERATOR");
|
|
476
|
-
var STYLER = Symbol("STYLER");
|
|
477
|
-
var IS_EMPTY = Symbol("IS_EMPTY");
|
|
475
|
+
var GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
|
|
476
|
+
var STYLER = /* @__PURE__ */ Symbol("STYLER");
|
|
477
|
+
var IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
|
|
478
478
|
var levelMapping = [
|
|
479
479
|
"ansi",
|
|
480
480
|
"ansi",
|
package/dist/server/index.cjs
CHANGED
|
@@ -58,21 +58,21 @@ function useGlobal(key) {
|
|
|
58
58
|
var [getHttpServer, setHttpServer, useHttpServer] = (
|
|
59
59
|
//
|
|
60
60
|
useGlobal(
|
|
61
|
-
Symbol.for("next-ws.http-server")
|
|
61
|
+
/* @__PURE__ */ Symbol.for("next-ws.http-server")
|
|
62
62
|
//
|
|
63
63
|
)
|
|
64
64
|
);
|
|
65
65
|
var [getWebSocketServer, setWebSocketServer, useWebSocketServer] = (
|
|
66
66
|
//
|
|
67
67
|
useGlobal(
|
|
68
|
-
Symbol.for("next-ws.websocket-server")
|
|
68
|
+
/* @__PURE__ */ Symbol.for("next-ws.websocket-server")
|
|
69
69
|
//
|
|
70
70
|
)
|
|
71
71
|
);
|
|
72
72
|
var [getRequestStorage, setRequestStorage, useRequestStorage] = (
|
|
73
73
|
//
|
|
74
74
|
useGlobal(
|
|
75
|
-
Symbol.for("next-ws.request-store")
|
|
75
|
+
/* @__PURE__ */ Symbol.for("next-ws.request-store")
|
|
76
76
|
//
|
|
77
77
|
)
|
|
78
78
|
);
|
|
@@ -80,7 +80,7 @@ var [getRequestStorage, setRequestStorage, useRequestStorage] = (
|
|
|
80
80
|
// src/server/setup.ts
|
|
81
81
|
var import_node_async_hooks = require("async_hooks");
|
|
82
82
|
var logger2 = __toESM(require("next/dist/build/output/log.js"));
|
|
83
|
-
var import_ws = require("ws");
|
|
83
|
+
var import_ws = __toESM(require("ws"));
|
|
84
84
|
|
|
85
85
|
// src/server/helpers/match.ts
|
|
86
86
|
function compileRoutePattern(routePattern) {
|
|
@@ -209,6 +209,7 @@ function createRequestStore(request) {
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
// src/server/setup.ts
|
|
212
|
+
var WebSocketServer2 = import_ws.WebSocketServer || import_ws.Server;
|
|
212
213
|
function setupWebSocketServer(nextServer) {
|
|
213
214
|
const httpServer = (
|
|
214
215
|
//
|
|
@@ -219,14 +220,14 @@ function setupWebSocketServer(nextServer) {
|
|
|
219
220
|
return logger2.error("[next-ws] was not able to find the HTTP server");
|
|
220
221
|
const wsServer = (
|
|
221
222
|
//
|
|
222
|
-
useWebSocketServer(() => new
|
|
223
|
+
useWebSocketServer(() => new WebSocketServer2({ noServer: true }))
|
|
223
224
|
);
|
|
224
225
|
const requestStorage = (
|
|
225
226
|
//
|
|
226
227
|
useRequestStorage(() => new import_node_async_hooks.AsyncLocalStorage())
|
|
227
228
|
);
|
|
228
229
|
logger2.ready("[next-ws] has started the WebSocket server");
|
|
229
|
-
const kAttached = Symbol.for("next-ws.http-server.attached");
|
|
230
|
+
const kAttached = /* @__PURE__ */ Symbol.for("next-ws.http-server.attached");
|
|
230
231
|
if (Reflect.has(httpServer, kAttached)) return;
|
|
231
232
|
Reflect.set(httpServer, kAttached, true);
|
|
232
233
|
httpServer.on("upgrade", async (message, socket, head) => {
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as next_server from 'next/server';
|
|
2
2
|
import * as http from 'http';
|
|
3
3
|
import * as ws from 'ws';
|
|
4
|
+
import * as node_http from 'node:http';
|
|
4
5
|
import NextNodeServer from 'next/dist/server/next-server.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -40,8 +41,8 @@ type RouteContext<Path extends string> = {
|
|
|
40
41
|
params: Record<string, string | string[] | undefined> & RouteParams<Path> & RouteParams<Path>;
|
|
41
42
|
};
|
|
42
43
|
|
|
43
|
-
declare const getHttpServer: () =>
|
|
44
|
-
declare const setHttpServer: (value:
|
|
44
|
+
declare const getHttpServer: () => node_http.Server<typeof node_http.IncomingMessage, typeof node_http.ServerResponse> | undefined;
|
|
45
|
+
declare const setHttpServer: (value: node_http.Server<typeof node_http.IncomingMessage, typeof node_http.ServerResponse>) => boolean;
|
|
45
46
|
declare const getWebSocketServer: () => ws.WebSocketServer | undefined;
|
|
46
47
|
declare const setWebSocketServer: (value: ws.WebSocketServer) => boolean;
|
|
47
48
|
|