next-ws 2.0.0 → 2.0.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.
- package/dist/cli.cjs +32 -5398
- package/dist/client/index.d.cts +2 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/server/index.cjs +2 -2
- package/dist/server/index.js +2 -2
- package/package.json +14 -8
package/dist/client/index.d.cts
CHANGED
|
@@ -7,6 +7,7 @@ declare const WebSocketConsumer: React.Consumer<WebSocket | null>;
|
|
|
7
7
|
* allowing for easy access to the WebSocket from anywhere in the app.
|
|
8
8
|
* @param props WebSocket parameters and children.
|
|
9
9
|
* @returns JSX Element
|
|
10
|
+
* @deprecated `WebSocketProvider` is deprecated, use your own implementation instead.
|
|
10
11
|
*/
|
|
11
12
|
declare function WebSocketProvider(p: React.PropsWithChildren<{
|
|
12
13
|
/** The URL for the WebSocket to connect to. */
|
|
@@ -19,6 +20,7 @@ declare function WebSocketProvider(p: React.PropsWithChildren<{
|
|
|
19
20
|
/**
|
|
20
21
|
* Access the websocket from anywhere in the app, so long as it's wrapped in a WebSocketProvider.
|
|
21
22
|
* @returns WebSocket client when connected, null when disconnected.
|
|
23
|
+
* @deprecated `useWebSocket` is deprecated, use your own implementation instead.
|
|
22
24
|
*/
|
|
23
25
|
declare function useWebSocket(): WebSocket | null;
|
|
24
26
|
|
package/dist/client/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ declare const WebSocketConsumer: React.Consumer<WebSocket | null>;
|
|
|
7
7
|
* allowing for easy access to the WebSocket from anywhere in the app.
|
|
8
8
|
* @param props WebSocket parameters and children.
|
|
9
9
|
* @returns JSX Element
|
|
10
|
+
* @deprecated `WebSocketProvider` is deprecated, use your own implementation instead.
|
|
10
11
|
*/
|
|
11
12
|
declare function WebSocketProvider(p: React.PropsWithChildren<{
|
|
12
13
|
/** The URL for the WebSocket to connect to. */
|
|
@@ -19,6 +20,7 @@ declare function WebSocketProvider(p: React.PropsWithChildren<{
|
|
|
19
20
|
/**
|
|
20
21
|
* Access the websocket from anywhere in the app, so long as it's wrapped in a WebSocketProvider.
|
|
21
22
|
* @returns WebSocket client when connected, null when disconnected.
|
|
23
|
+
* @deprecated `useWebSocket` is deprecated, use your own implementation instead.
|
|
22
24
|
*/
|
|
23
25
|
declare function useWebSocket(): WebSocket | null;
|
|
24
26
|
|
package/dist/server/index.cjs
CHANGED
|
@@ -155,7 +155,7 @@ async function importRouteModule(nextServer, filePath) {
|
|
|
155
155
|
async function importModule(modulePath) {
|
|
156
156
|
const moduleUrl = (0, import_node_url.pathToFileURL)(modulePath).toString();
|
|
157
157
|
try {
|
|
158
|
-
return
|
|
158
|
+
return import(moduleUrl);
|
|
159
159
|
} catch (requireError) {
|
|
160
160
|
try {
|
|
161
161
|
return require(modulePath);
|
|
@@ -166,7 +166,7 @@ async function importModule(modulePath) {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
function getSocketHandler(routeModule) {
|
|
169
|
-
return routeModule?.routeModule?.userland?.SOCKET ?? routeModule?.handlers?.SOCKET;
|
|
169
|
+
return routeModule?.default?.routeModule?.userland?.SOCKET ?? routeModule?.routeModule?.userland?.SOCKET ?? routeModule?.default?.handlers?.SOCKET ?? routeModule?.handlers?.SOCKET;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
// src/server/setup.ts
|
package/dist/server/index.js
CHANGED
|
@@ -119,7 +119,7 @@ async function importRouteModule(nextServer, filePath) {
|
|
|
119
119
|
async function importModule(modulePath) {
|
|
120
120
|
const moduleUrl = pathToFileURL(modulePath).toString();
|
|
121
121
|
try {
|
|
122
|
-
return
|
|
122
|
+
return import(moduleUrl);
|
|
123
123
|
} catch (requireError) {
|
|
124
124
|
try {
|
|
125
125
|
return __require(modulePath);
|
|
@@ -130,7 +130,7 @@ async function importModule(modulePath) {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
function getSocketHandler(routeModule) {
|
|
133
|
-
return routeModule?.routeModule?.userland?.SOCKET ?? routeModule?.handlers?.SOCKET;
|
|
133
|
+
return routeModule?.default?.routeModule?.userland?.SOCKET ?? routeModule?.routeModule?.userland?.SOCKET ?? routeModule?.default?.handlers?.SOCKET ?? routeModule?.handlers?.SOCKET;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
// src/server/setup.ts
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-ws",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Add support for WebSockets in Next.js
|
|
5
|
+
"description": "Add support for WebSockets in the Next.js app directory",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"next",
|
|
@@ -27,12 +27,14 @@
|
|
|
27
27
|
],
|
|
28
28
|
"exports": {
|
|
29
29
|
"./client": {
|
|
30
|
-
"
|
|
31
|
-
"import": "./dist/client/index.js"
|
|
30
|
+
"types": "./dist/client/index.d.ts",
|
|
31
|
+
"import": "./dist/client/index.js",
|
|
32
|
+
"require": "./dist/client/index.cjs"
|
|
32
33
|
},
|
|
33
34
|
"./server": {
|
|
34
|
-
"
|
|
35
|
-
"import": "./dist/server/index.js"
|
|
35
|
+
"types": "./dist/server/index.d.ts",
|
|
36
|
+
"import": "./dist/server/index.js",
|
|
37
|
+
"require": "./dist/server/index.cjs"
|
|
36
38
|
},
|
|
37
39
|
"./package.json": "./package.json"
|
|
38
40
|
},
|
|
@@ -46,13 +48,14 @@
|
|
|
46
48
|
"@changesets/changelog-git": "^0.2.0",
|
|
47
49
|
"@changesets/cli": "^2.27.12",
|
|
48
50
|
"@playwright/test": "^1.50.1",
|
|
51
|
+
"@types/minimist": "^1.2.5",
|
|
49
52
|
"@types/node": "^22.13.1",
|
|
50
53
|
"@types/react": "^19.0.8",
|
|
51
54
|
"@types/semver": "^7.5.8",
|
|
52
55
|
"@types/ws": "^8.5.14",
|
|
53
56
|
"chalk": "^5.4.1",
|
|
54
|
-
"commander": "^13.1.0",
|
|
55
57
|
"husky": "^9.1.7",
|
|
58
|
+
"minimist": "^1.2.8",
|
|
56
59
|
"pinst": "^3.0.0",
|
|
57
60
|
"semver": "^7.7.1",
|
|
58
61
|
"tsup": "^8.3.6",
|
|
@@ -67,6 +70,9 @@
|
|
|
67
70
|
"test": "playwright test",
|
|
68
71
|
"_postinstall": "biome format package.json --write && pnpm build",
|
|
69
72
|
"change": "changeset",
|
|
70
|
-
"release": "changeset version && biome format package.json --write
|
|
73
|
+
"release:version": "changeset version && biome format package.json --write",
|
|
74
|
+
"release:snapshot:version": "changeset version --snapshot beta && biome format package.json --write",
|
|
75
|
+
"release:publish": "pnpm build && changeset publish",
|
|
76
|
+
"release:snapshot:publish": "pnpm build && changeset publish --tag beta --no-git-tag"
|
|
71
77
|
}
|
|
72
78
|
}
|