@teardown/cli 1.2.39 → 2.0.42
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/bin/teardown.js +11 -1
- package/package.json +77 -57
- package/src/cli/commands/init.ts +254 -0
- package/src/cli/commands/plugins.ts +93 -0
- package/src/cli/commands/prebuild.ts +168 -0
- package/src/cli/commands/run.ts +727 -0
- package/src/cli/commands/start.ts +87 -0
- package/src/cli/commands/validate.ts +62 -0
- package/src/cli/index.ts +59 -0
- package/src/config/index.ts +45 -0
- package/src/config/loader.ts +366 -0
- package/src/config/schema.ts +235 -0
- package/src/config/types.ts +322 -0
- package/src/index.ts +177 -0
- package/src/pipeline/cache.ts +179 -0
- package/src/pipeline/index.ts +10 -0
- package/src/pipeline/stages.ts +692 -0
- package/src/plugins/base.ts +370 -0
- package/src/plugins/capabilities/biometrics.ts +64 -0
- package/src/plugins/capabilities/bluetooth.ts +86 -0
- package/src/plugins/capabilities/calendar.ts +57 -0
- package/src/plugins/capabilities/camera.ts +77 -0
- package/src/plugins/capabilities/contacts.ts +57 -0
- package/src/plugins/capabilities/deep-linking.ts +124 -0
- package/src/plugins/capabilities/firebase.ts +138 -0
- package/src/plugins/capabilities/index.ts +96 -0
- package/src/plugins/capabilities/location.ts +87 -0
- package/src/plugins/capabilities/photo-library.ts +80 -0
- package/src/plugins/capabilities/push-notifications.ts +98 -0
- package/src/plugins/capabilities/sign-in-with-apple.ts +53 -0
- package/src/plugins/context.ts +220 -0
- package/src/plugins/index.ts +26 -0
- package/src/plugins/resolver.ts +321 -0
- package/src/templates/generator.ts +507 -0
- package/src/templates/index.ts +9 -0
- package/src/templates/paths.ts +25 -0
- package/src/transformers/android/gradle.ts +400 -0
- package/src/transformers/android/index.ts +19 -0
- package/src/transformers/android/manifest.ts +506 -0
- package/src/transformers/index.ts +39 -0
- package/src/transformers/ios/entitlements.ts +283 -0
- package/src/transformers/ios/index.ts +10 -0
- package/src/transformers/ios/pbxproj.ts +267 -0
- package/src/transformers/ios/plist.ts +198 -0
- package/src/utils/fs.ts +429 -0
- package/src/utils/index.ts +21 -0
- package/src/utils/logger.ts +203 -0
- package/templates/.gitignore +63 -0
- package/templates/Gemfile +3 -0
- package/templates/android/app/build.gradle.kts +97 -0
- package/templates/android/app/proguard-rules.pro +10 -0
- package/templates/android/app/src/main/AndroidManifest.xml +26 -0
- package/templates/android/app/src/main/java/com/appname/MainActivity.kt +22 -0
- package/templates/android/app/src/main/java/com/appname/MainApplication.kt +44 -0
- package/templates/android/app/src/main/res/values/strings.xml +3 -0
- package/templates/android/app/src/main/res/values/styles.xml +7 -0
- package/templates/android/build.gradle.kts +44 -0
- package/templates/android/gradle.properties +39 -0
- package/templates/android/settings.gradle.kts +12 -0
- package/templates/babel.config.js +15 -0
- package/templates/index.js +7 -0
- package/templates/ios/.xcode.env +11 -0
- package/templates/ios/AppName/AppDelegate.swift +25 -0
- package/templates/ios/AppName/AppName-Bridging-Header.h +4 -0
- package/templates/ios/AppName/AppName.entitlements +6 -0
- package/templates/ios/AppName/Images.xcassets/AppIcon.appiconset/Contents.json +35 -0
- package/templates/ios/AppName/Images.xcassets/Contents.json +6 -0
- package/templates/ios/AppName/Info.plist +49 -0
- package/templates/ios/AppName/LaunchScreen.storyboard +38 -0
- package/templates/ios/AppName.xcodeproj/project.pbxproj +402 -0
- package/templates/ios/AppName.xcodeproj/xcshareddata/xcschemes/AppName.xcscheme +78 -0
- package/templates/ios/Podfile +35 -0
- package/templates/metro.config.js +41 -0
- package/templates/package.json +57 -0
- package/templates/react-native.config.js +8 -0
- package/templates/src/app/index.tsx +34 -0
- package/templates/src/assets/fonts/.gitkeep +1 -0
- package/templates/src/assets/images/.gitkeep +1 -0
- package/templates/src/components/ui/accordion.tsx +114 -0
- package/templates/src/components/ui/avatar.tsx +75 -0
- package/templates/src/components/ui/button.tsx +93 -0
- package/templates/src/components/ui/card.tsx +120 -0
- package/templates/src/components/ui/checkbox.tsx +133 -0
- package/templates/src/components/ui/chip.tsx +95 -0
- package/templates/src/components/ui/dialog.tsx +134 -0
- package/templates/src/components/ui/divider.tsx +67 -0
- package/templates/src/components/ui/error-view.tsx +82 -0
- package/templates/src/components/ui/form-field.tsx +101 -0
- package/templates/src/components/ui/index.ts +100 -0
- package/templates/src/components/ui/popover.tsx +92 -0
- package/templates/src/components/ui/pressable-feedback.tsx +88 -0
- package/templates/src/components/ui/radio-group.tsx +153 -0
- package/templates/src/components/ui/scroll-shadow.tsx +108 -0
- package/templates/src/components/ui/select.tsx +165 -0
- package/templates/src/components/ui/skeleton-group.tsx +97 -0
- package/templates/src/components/ui/skeleton.tsx +87 -0
- package/templates/src/components/ui/spinner.tsx +87 -0
- package/templates/src/components/ui/surface.tsx +95 -0
- package/templates/src/components/ui/switch.tsx +124 -0
- package/templates/src/components/ui/tabs.tsx +154 -0
- package/templates/src/components/ui/text-field.tsx +106 -0
- package/templates/src/components/ui/toast.tsx +129 -0
- package/templates/src/contexts/.gitkeep +2 -0
- package/templates/src/core/clients/api/api.client.ts +113 -0
- package/templates/src/core/clients/api/index.ts +1 -0
- package/templates/src/core/clients/storage/index.ts +1 -0
- package/templates/src/core/clients/storage/storage.client.ts +121 -0
- package/templates/src/core/constants/index.ts +19 -0
- package/templates/src/core/core.ts +40 -0
- package/templates/src/core/index.ts +10 -0
- package/templates/src/global.css +87 -0
- package/templates/src/hooks/index.ts +6 -0
- package/templates/src/hooks/use-debounce.ts +23 -0
- package/templates/src/hooks/use-mounted.ts +21 -0
- package/templates/src/index.ts +28 -0
- package/templates/src/lib/index.ts +5 -0
- package/templates/src/lib/utils.ts +115 -0
- package/templates/src/modules/.gitkeep +6 -0
- package/templates/src/navigation/index.ts +8 -0
- package/templates/src/navigation/navigation-provider.tsx +36 -0
- package/templates/src/navigation/router.tsx +137 -0
- package/templates/src/providers/app.provider.tsx +29 -0
- package/templates/src/providers/index.ts +5 -0
- package/templates/src/routes/(tabs)/_layout.tsx +42 -0
- package/templates/src/routes/(tabs)/explore.tsx +161 -0
- package/templates/src/routes/(tabs)/home.tsx +138 -0
- package/templates/src/routes/(tabs)/profile.tsx +151 -0
- package/templates/src/routes/_layout.tsx +18 -0
- package/templates/src/routes/settings.tsx +194 -0
- package/templates/src/screens/auth/index.ts +6 -0
- package/templates/src/screens/auth/login.tsx +165 -0
- package/templates/src/screens/auth/register.tsx +203 -0
- package/templates/src/screens/home.tsx +204 -0
- package/templates/src/screens/index.ts +17 -0
- package/templates/src/screens/profile.tsx +210 -0
- package/templates/src/screens/settings.tsx +216 -0
- package/templates/src/screens/welcome.tsx +101 -0
- package/templates/src/styles/index.ts +103 -0
- package/templates/src/types/common.ts +71 -0
- package/templates/src/types/index.ts +5 -0
- package/templates/tsconfig.json +14 -0
- package/README.md +0 -15
- package/assets/favicon.ico +0 -0
- package/dist/commands/dev/dev.d.ts +0 -22
- package/dist/commands/dev/dev.js +0 -56
- package/dist/commands/dev/dev.js.map +0 -1
- package/dist/commands/init/init-teardown.d.ts +0 -9
- package/dist/commands/init/init-teardown.js +0 -27
- package/dist/commands/init/init-teardown.js.map +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -21
- package/dist/index.js.map +0 -1
- package/dist/modules/dev/dev-menu/keyboard-handler.d.ts +0 -21
- package/dist/modules/dev/dev-menu/keyboard-handler.js +0 -139
- package/dist/modules/dev/dev-menu/keyboard-handler.js.map +0 -1
- package/dist/modules/dev/dev-menu/open-debugger-keyboard-handler.d.ts +0 -18
- package/dist/modules/dev/dev-menu/open-debugger-keyboard-handler.js +0 -106
- package/dist/modules/dev/dev-menu/open-debugger-keyboard-handler.js.map +0 -1
- package/dist/modules/dev/dev-server/cdp/cdp.adapter.d.ts +0 -6
- package/dist/modules/dev/dev-server/cdp/cdp.adapter.js +0 -13
- package/dist/modules/dev/dev-server/cdp/cdp.adapter.js.map +0 -1
- package/dist/modules/dev/dev-server/cdp/index.d.ts +0 -2
- package/dist/modules/dev/dev-server/cdp/index.js +0 -19
- package/dist/modules/dev/dev-server/cdp/index.js.map +0 -1
- package/dist/modules/dev/dev-server/cdp/types.d.ts +0 -107
- package/dist/modules/dev/dev-server/cdp/types.js +0 -3
- package/dist/modules/dev/dev-server/cdp/types.js.map +0 -1
- package/dist/modules/dev/dev-server/dev-server-checker.d.ts +0 -22
- package/dist/modules/dev/dev-server/dev-server-checker.js +0 -73
- package/dist/modules/dev/dev-server/dev-server-checker.js.map +0 -1
- package/dist/modules/dev/dev-server/dev-server.d.ts +0 -74
- package/dist/modules/dev/dev-server/dev-server.js +0 -272
- package/dist/modules/dev/dev-server/dev-server.js.map +0 -1
- package/dist/modules/dev/dev-server/inspector/device.d.ts +0 -46
- package/dist/modules/dev/dev-server/inspector/device.event-reporter.d.ts +0 -37
- package/dist/modules/dev/dev-server/inspector/device.event-reporter.js +0 -166
- package/dist/modules/dev/dev-server/inspector/device.event-reporter.js.map +0 -1
- package/dist/modules/dev/dev-server/inspector/device.js +0 -578
- package/dist/modules/dev/dev-server/inspector/device.js.map +0 -1
- package/dist/modules/dev/dev-server/inspector/inspector.d.ts +0 -27
- package/dist/modules/dev/dev-server/inspector/inspector.js +0 -225
- package/dist/modules/dev/dev-server/inspector/inspector.js.map +0 -1
- package/dist/modules/dev/dev-server/inspector/types.d.ts +0 -156
- package/dist/modules/dev/dev-server/inspector/types.js +0 -3
- package/dist/modules/dev/dev-server/inspector/types.js.map +0 -1
- package/dist/modules/dev/dev-server/inspector/wss/servers/debugger-connection.server.d.ts +0 -14
- package/dist/modules/dev/dev-server/inspector/wss/servers/debugger-connection.server.js +0 -63
- package/dist/modules/dev/dev-server/inspector/wss/servers/debugger-connection.server.js.map +0 -1
- package/dist/modules/dev/dev-server/inspector/wss/servers/device-connection.server.d.ts +0 -19
- package/dist/modules/dev/dev-server/inspector/wss/servers/device-connection.server.js +0 -66
- package/dist/modules/dev/dev-server/inspector/wss/servers/device-connection.server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/devtools.plugin.d.ts +0 -1
- package/dist/modules/dev/dev-server/plugins/devtools.plugin.js +0 -51
- package/dist/modules/dev/dev-server/plugins/devtools.plugin.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/favicon.plugin.d.ts +0 -1
- package/dist/modules/dev/dev-server/plugins/favicon.plugin.js +0 -19
- package/dist/modules/dev/dev-server/plugins/favicon.plugin.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/multipart.plugin.d.ts +0 -1
- package/dist/modules/dev/dev-server/plugins/multipart.plugin.js +0 -63
- package/dist/modules/dev/dev-server/plugins/multipart.plugin.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/systrace.plugin.d.ts +0 -1
- package/dist/modules/dev/dev-server/plugins/systrace.plugin.js +0 -29
- package/dist/modules/dev/dev-server/plugins/systrace.plugin.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/types.d.ts +0 -11
- package/dist/modules/dev/dev-server/plugins/types.js +0 -3
- package/dist/modules/dev/dev-server/plugins/types.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/index.d.ts +0 -3
- package/dist/modules/dev/dev-server/plugins/wss/index.js +0 -20
- package/dist/modules/dev/dev-server/plugins/wss/index.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-api.server.d.ts +0 -37
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-api.server.js +0 -67
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-api.server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-debugger.server.d.ts +0 -63
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-debugger.server.js +0 -129
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-debugger.server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-dev-client.server.d.ts +0 -32
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-dev-client.server.js +0 -76
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-dev-client.server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-events.server.d.ts +0 -75
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-events.server.js +0 -199
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-events.server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-hmr.server.d.ts +0 -44
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-hmr.server.js +0 -121
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-hmr.server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-message.server.d.ts +0 -135
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-message.server.js +0 -364
- package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-message.server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/types.d.ts +0 -6
- package/dist/modules/dev/dev-server/plugins/wss/types.js +0 -3
- package/dist/modules/dev/dev-server/plugins/wss/types.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-router.d.ts +0 -32
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-router.js +0 -58
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-router.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-server-adapter.d.ts +0 -13
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-server-adapter.js +0 -27
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-server-adapter.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-server.d.ts +0 -39
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-server.js +0 -47
- package/dist/modules/dev/dev-server/plugins/wss/web-socket-server.js.map +0 -1
- package/dist/modules/dev/dev-server/plugins/wss/wss.plugin.d.ts +0 -24
- package/dist/modules/dev/dev-server/plugins/wss/wss.plugin.js +0 -56
- package/dist/modules/dev/dev-server/plugins/wss/wss.plugin.js.map +0 -1
- package/dist/modules/dev/dev-server/sybmolicate/sybmolicate.plugin.d.ts +0 -7
- package/dist/modules/dev/dev-server/sybmolicate/sybmolicate.plugin.js +0 -41
- package/dist/modules/dev/dev-server/sybmolicate/sybmolicate.plugin.js.map +0 -1
- package/dist/modules/dev/dev-server/sybmolicate/types.d.ts +0 -64
- package/dist/modules/dev/dev-server/sybmolicate/types.js +0 -3
- package/dist/modules/dev/dev-server/sybmolicate/types.js.map +0 -1
- package/dist/modules/dev/terminal/base.terminal.reporter.d.ts +0 -25
- package/dist/modules/dev/terminal/base.terminal.reporter.js +0 -79
- package/dist/modules/dev/terminal/base.terminal.reporter.js.map +0 -1
- package/dist/modules/dev/terminal/terminal.reporter.d.ts +0 -13
- package/dist/modules/dev/terminal/terminal.reporter.js +0 -83
- package/dist/modules/dev/terminal/terminal.reporter.js.map +0 -1
- package/dist/modules/dev/types.d.ts +0 -20
- package/dist/modules/dev/types.js +0 -3
- package/dist/modules/dev/types.js.map +0 -1
- package/dist/modules/dev/utils/log.d.ts +0 -23
- package/dist/modules/dev/utils/log.js +0 -74
- package/dist/modules/dev/utils/log.js.map +0 -1
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebSocketMessageServer = void 0;
|
|
4
|
-
const node_url_1 = require("node:url");
|
|
5
|
-
const web_socket_server_1 = require("../web-socket-server");
|
|
6
|
-
/**
|
|
7
|
-
* Class for creating a WebSocket server and sending messages between development server
|
|
8
|
-
* and the React Native applications.
|
|
9
|
-
*
|
|
10
|
-
* Based on: https://github.com/react-native-community/cli/blob/v4.14.0/packages/cli-server-api/src/websocket/messageSocketServer.ts
|
|
11
|
-
*
|
|
12
|
-
* @category Development server
|
|
13
|
-
*/
|
|
14
|
-
class WebSocketMessageServer extends web_socket_server_1.WebSocketServer {
|
|
15
|
-
static PROTOCOL_VERSION = 2;
|
|
16
|
-
/**
|
|
17
|
-
* Check if message is a broadcast request.
|
|
18
|
-
*
|
|
19
|
-
* @param message Message to check.
|
|
20
|
-
* @returns True if message is a broadcast request and should be broadcasted
|
|
21
|
-
* with {@link sendBroadcast}.
|
|
22
|
-
*/
|
|
23
|
-
static isBroadcast(message) {
|
|
24
|
-
return (typeof message.method === "string" &&
|
|
25
|
-
message.id === undefined &&
|
|
26
|
-
message.target === undefined);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Check if message is a method request.
|
|
30
|
-
*
|
|
31
|
-
* @param message Message to check.
|
|
32
|
-
* @returns True if message is a request.
|
|
33
|
-
*/
|
|
34
|
-
static isRequest(message) {
|
|
35
|
-
return (typeof message.method === "string" && typeof message.target === "string");
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Check if message is a response with results of performing some request.
|
|
39
|
-
*
|
|
40
|
-
* @param message Message to check.
|
|
41
|
-
* @returns True if message is a response.
|
|
42
|
-
*/
|
|
43
|
-
static isResponse(message) {
|
|
44
|
-
return (typeof message.id === "object" &&
|
|
45
|
-
typeof message.id.requestId !== "undefined" &&
|
|
46
|
-
typeof message.id.clientId === "string" &&
|
|
47
|
-
(message.result !== undefined || message.error !== undefined));
|
|
48
|
-
}
|
|
49
|
-
clients = new Map();
|
|
50
|
-
nextClientId = 0;
|
|
51
|
-
/**
|
|
52
|
-
* Create new instance of WebSocketMessageServer and attach it to the given Fastify instance.
|
|
53
|
-
* Any logging information, will be passed through standard `fastify.log` API.
|
|
54
|
-
*
|
|
55
|
-
* @param fastify Fastify instance to attach the WebSocket server to.
|
|
56
|
-
*/
|
|
57
|
-
constructor(fastify) {
|
|
58
|
-
super(fastify, "/message");
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Parse stringified message into a {@link ReactNativeMessage}.
|
|
62
|
-
*
|
|
63
|
-
* @param data Stringified message.
|
|
64
|
-
* @param binary Additional binary data if any.
|
|
65
|
-
* @returns Parsed message or `undefined` if parsing failed.
|
|
66
|
-
*/
|
|
67
|
-
parseMessage(data, binary) {
|
|
68
|
-
console.log("parseMessage", data, binary);
|
|
69
|
-
if (binary) {
|
|
70
|
-
this.fastify.log.error({
|
|
71
|
-
msg: "Failed to parse message - expected text message, got binary",
|
|
72
|
-
});
|
|
73
|
-
return undefined;
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
const message = JSON.parse(data);
|
|
77
|
-
if (message.version === WebSocketMessageServer.PROTOCOL_VERSION.toString()) {
|
|
78
|
-
return message;
|
|
79
|
-
}
|
|
80
|
-
this.fastify.log.error({
|
|
81
|
-
msg: "Received message had wrong protocol version",
|
|
82
|
-
message,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
catch {
|
|
86
|
-
this.fastify.log.error({
|
|
87
|
-
msg: "Failed to parse the message as JSON",
|
|
88
|
-
data,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Get client's WebSocket connection for given `clientId`.
|
|
95
|
-
* Throws if no such client is connected.
|
|
96
|
-
*
|
|
97
|
-
* @param clientId Id of the client.
|
|
98
|
-
* @returns WebSocket connection.
|
|
99
|
-
*/
|
|
100
|
-
getClientSocket(clientId) {
|
|
101
|
-
console.log("getClientSocket", clientId);
|
|
102
|
-
const socket = this.clients.get(clientId);
|
|
103
|
-
if (socket === undefined) {
|
|
104
|
-
throw new Error(`Could not find client with id "${clientId}"`);
|
|
105
|
-
}
|
|
106
|
-
return socket;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Process error by sending an error message to the client whose message caused the error
|
|
110
|
-
* to occur.
|
|
111
|
-
*
|
|
112
|
-
* @param clientId Id of the client whose message caused an error.
|
|
113
|
-
* @param message Original message which caused the error.
|
|
114
|
-
* @param error Concrete instance of an error that occurred.
|
|
115
|
-
*/
|
|
116
|
-
handleError(clientId, message, error) {
|
|
117
|
-
console.log("handleError", clientId, message, error);
|
|
118
|
-
const errorMessage = {
|
|
119
|
-
id: message.id,
|
|
120
|
-
method: message.method,
|
|
121
|
-
target: message.target,
|
|
122
|
-
error: message.error === undefined ? "undefined" : "defined",
|
|
123
|
-
params: message.params === undefined ? "undefined" : "defined",
|
|
124
|
-
result: message.result === undefined ? "undefined" : "defined",
|
|
125
|
-
};
|
|
126
|
-
if (message.id === undefined) {
|
|
127
|
-
this.fastify.log.error({
|
|
128
|
-
msg: "Handling message failed",
|
|
129
|
-
clientId,
|
|
130
|
-
error,
|
|
131
|
-
errorMessage,
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
try {
|
|
136
|
-
const socket = this.getClientSocket(clientId);
|
|
137
|
-
socket.send(JSON.stringify({
|
|
138
|
-
version: WebSocketMessageServer.PROTOCOL_VERSION,
|
|
139
|
-
error,
|
|
140
|
-
id: message.id,
|
|
141
|
-
}));
|
|
142
|
-
}
|
|
143
|
-
catch (error) {
|
|
144
|
-
this.fastify.log.error("Failed to reply", {
|
|
145
|
-
clientId,
|
|
146
|
-
error,
|
|
147
|
-
errorMessage,
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Send given request `message` to it's designated client's socket based on `message.target`.
|
|
154
|
-
* The target client must be connected, otherwise it will throw an error.
|
|
155
|
-
*
|
|
156
|
-
* @param clientId Id of the client that requested the forward.
|
|
157
|
-
* @param message Message to forward.
|
|
158
|
-
*/
|
|
159
|
-
forwardRequest(clientId, message) {
|
|
160
|
-
console.log("forwardRequest", clientId, message);
|
|
161
|
-
if (!message.target) {
|
|
162
|
-
this.fastify.log.error({
|
|
163
|
-
msg: "Failed to forward request - message.target is missing",
|
|
164
|
-
clientId,
|
|
165
|
-
message,
|
|
166
|
-
});
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
const socket = this.getClientSocket(message.target);
|
|
170
|
-
socket.send(JSON.stringify({
|
|
171
|
-
version: WebSocketMessageServer.PROTOCOL_VERSION,
|
|
172
|
-
method: message.method,
|
|
173
|
-
params: message.params,
|
|
174
|
-
id: message.id === undefined
|
|
175
|
-
? undefined
|
|
176
|
-
: { requestId: message.id, clientId },
|
|
177
|
-
}));
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Send given response `message` to it's designated client's socket based
|
|
181
|
-
* on `message.id.clientId`.
|
|
182
|
-
* The target client must be connected, otherwise it will throw an error.
|
|
183
|
-
*
|
|
184
|
-
* @param message Message to forward.
|
|
185
|
-
*/
|
|
186
|
-
forwardResponse(message) {
|
|
187
|
-
console.log("forwardResponse", message);
|
|
188
|
-
if (!message.id) {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
const socket = this.getClientSocket(message.id.clientId);
|
|
192
|
-
socket.send(JSON.stringify({
|
|
193
|
-
version: WebSocketMessageServer.PROTOCOL_VERSION,
|
|
194
|
-
result: message.result,
|
|
195
|
-
error: message.error,
|
|
196
|
-
id: message.id.requestId,
|
|
197
|
-
}));
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Process request message targeted towards this {@link WebSocketMessageServer}
|
|
201
|
-
* and send back the results.
|
|
202
|
-
*
|
|
203
|
-
* @param clientId Id of the client who send the message.
|
|
204
|
-
* @param message The message to process by the server.
|
|
205
|
-
*/
|
|
206
|
-
processServerRequest(clientId, message) {
|
|
207
|
-
console.log("processServerRequest", clientId, message);
|
|
208
|
-
let result;
|
|
209
|
-
switch (message.method) {
|
|
210
|
-
case "getid":
|
|
211
|
-
result = clientId;
|
|
212
|
-
break;
|
|
213
|
-
case "getpeers": {
|
|
214
|
-
const output = {};
|
|
215
|
-
this.clients.forEach((peerSocket, peerId) => {
|
|
216
|
-
if (clientId !== peerId) {
|
|
217
|
-
const { searchParams } = new node_url_1.URL(peerSocket.upgradeReq?.url || "");
|
|
218
|
-
output[peerId] = [...searchParams.entries()].reduce((acc, [key, value]) => {
|
|
219
|
-
acc[key] = value;
|
|
220
|
-
return acc;
|
|
221
|
-
}, {});
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
result = output;
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
default:
|
|
228
|
-
throw new Error(`Cannot process server request - unknown method ${JSON.stringify({
|
|
229
|
-
clientId,
|
|
230
|
-
message,
|
|
231
|
-
})}`);
|
|
232
|
-
}
|
|
233
|
-
const socket = this.getClientSocket(clientId);
|
|
234
|
-
socket.send(JSON.stringify({
|
|
235
|
-
version: WebSocketMessageServer.PROTOCOL_VERSION,
|
|
236
|
-
result,
|
|
237
|
-
id: message.id,
|
|
238
|
-
}));
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Broadcast given message to all connected clients.
|
|
242
|
-
*
|
|
243
|
-
* @param broadcasterId Id of the client who is broadcasting.
|
|
244
|
-
* @param message Message to broadcast.
|
|
245
|
-
*/
|
|
246
|
-
sendBroadcast(broadcasterId, message) {
|
|
247
|
-
const forwarded = {
|
|
248
|
-
version: WebSocketMessageServer.PROTOCOL_VERSION,
|
|
249
|
-
method: message.method,
|
|
250
|
-
params: message.params,
|
|
251
|
-
};
|
|
252
|
-
if (this.clients.size === 0) {
|
|
253
|
-
this.fastify.log.warn({
|
|
254
|
-
msg:
|
|
255
|
-
// biome-ignore lint/style/useTemplate: <explanation>
|
|
256
|
-
"No apps connected. " +
|
|
257
|
-
`Sending "${message.method}" to all React Native apps failed. ` +
|
|
258
|
-
"Make sure your app is running in the simulator or on a phone connected via USB.",
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
for (const [clientId, socket] of this.clients) {
|
|
262
|
-
if (clientId !== broadcasterId) {
|
|
263
|
-
try {
|
|
264
|
-
socket.send(JSON.stringify(forwarded));
|
|
265
|
-
}
|
|
266
|
-
catch (error) {
|
|
267
|
-
this.fastify.log.error({
|
|
268
|
-
msg: "Failed to send broadcast",
|
|
269
|
-
clientId,
|
|
270
|
-
error,
|
|
271
|
-
forwarded,
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Send method broadcast to all connected clients.
|
|
279
|
-
*
|
|
280
|
-
* @param method Method name to broadcast.
|
|
281
|
-
* @param params Method parameters.
|
|
282
|
-
*/
|
|
283
|
-
broadcast(method, params) {
|
|
284
|
-
this.sendBroadcast(undefined, { method, params });
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Process new client's WebSocket connection.
|
|
288
|
-
*
|
|
289
|
-
* @param socket Incoming WebSocket connection.
|
|
290
|
-
* @param request Upgrade request for the connection.
|
|
291
|
-
*/
|
|
292
|
-
onConnection(socket, request) {
|
|
293
|
-
const clientId = `client#${this.nextClientId++}`;
|
|
294
|
-
const client = socket;
|
|
295
|
-
client.upgradeReq = request;
|
|
296
|
-
this.clients.set(clientId, client);
|
|
297
|
-
this.fastify.log.debug({ msg: "Message client connected", clientId });
|
|
298
|
-
const cleanup = () => {
|
|
299
|
-
this.fastify.log.debug({ msg: "Cleaning up message client", clientId });
|
|
300
|
-
socket.removeAllListeners();
|
|
301
|
-
this.clients.delete(clientId);
|
|
302
|
-
};
|
|
303
|
-
const onClose = (close) => {
|
|
304
|
-
this.fastify.log.debug({
|
|
305
|
-
msg: "Message client closed",
|
|
306
|
-
clientId,
|
|
307
|
-
close,
|
|
308
|
-
});
|
|
309
|
-
cleanup();
|
|
310
|
-
};
|
|
311
|
-
const onError = (error) => {
|
|
312
|
-
this.fastify.log.error({ msg: "Message client error", clientId, error });
|
|
313
|
-
cleanup();
|
|
314
|
-
};
|
|
315
|
-
socket.addEventListener("error", onError);
|
|
316
|
-
socket.addEventListener("close", onClose);
|
|
317
|
-
socket.addEventListener("message", (event) => {
|
|
318
|
-
const message = this.parseMessage(event.data.toString(),
|
|
319
|
-
// @ts-ignore
|
|
320
|
-
event.binary);
|
|
321
|
-
if (!message) {
|
|
322
|
-
this.fastify.log.error({
|
|
323
|
-
msg: "Received message not matching protocol",
|
|
324
|
-
clientId,
|
|
325
|
-
message,
|
|
326
|
-
});
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
console.info("message", message);
|
|
330
|
-
try {
|
|
331
|
-
if (WebSocketMessageServer.isBroadcast(message)) {
|
|
332
|
-
console.info("broadcast", message);
|
|
333
|
-
this.sendBroadcast(clientId, message);
|
|
334
|
-
}
|
|
335
|
-
else if (WebSocketMessageServer.isRequest(message)) {
|
|
336
|
-
console.info("request", message);
|
|
337
|
-
if (message.target === "server") {
|
|
338
|
-
this.processServerRequest(clientId, message);
|
|
339
|
-
}
|
|
340
|
-
else {
|
|
341
|
-
this.forwardRequest(clientId, message);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
else if (WebSocketMessageServer.isResponse(message)) {
|
|
345
|
-
console.info("response", message);
|
|
346
|
-
this.forwardResponse(message);
|
|
347
|
-
}
|
|
348
|
-
else {
|
|
349
|
-
console.info("invalid message", message);
|
|
350
|
-
throw new Error(`Invalid message, did not match the protocol ${JSON.stringify({
|
|
351
|
-
clientId,
|
|
352
|
-
message,
|
|
353
|
-
})}`);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
catch (error) {
|
|
357
|
-
console.info("error", error);
|
|
358
|
-
this.handleError(clientId, message, error);
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
exports.WebSocketMessageServer = WebSocketMessageServer;
|
|
364
|
-
//# sourceMappingURL=web-socket-message.server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web-socket-message.server.js","sourceRoot":"","sources":["../../../../../../../src/modules/dev/dev-server/plugins/wss/servers/web-socket-message.server.ts"],"names":[],"mappings":";;;AACA,uCAA+B;AAG/B,4DAAuD;AAyBvD;;;;;;;GAOG;AACH,MAAa,sBAAuB,SAAQ,mCAAe;IAC1D,MAAM,CAAU,gBAAgB,GAAG,CAAC,CAAC;IAErC;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,OAAoC;QACtD,OAAO,CAC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1,32 +0,0 @@
|
|
|
1
|
-
import type { FastifyInstance } from "fastify";
|
|
2
|
-
import type { WebSocketServerInterface } from "./types";
|
|
3
|
-
/**
|
|
4
|
-
* Class for creating a WebSocket router to forward connections to the
|
|
5
|
-
* respective {@link WebSocketServer} as long as the connection is accepted for the upgrade by the
|
|
6
|
-
* server.
|
|
7
|
-
*
|
|
8
|
-
* If the connection is not accepted by any `WebSocketServer`, it will be destroyed to avoid
|
|
9
|
-
* creating handling connections and potentially throwing `ECONNRESET` errors.
|
|
10
|
-
*
|
|
11
|
-
* @category Development server
|
|
12
|
-
*/
|
|
13
|
-
export declare class WebSocketRouter {
|
|
14
|
-
private fastify;
|
|
15
|
-
/** The list of all register WebSocket servers. */
|
|
16
|
-
protected servers: WebSocketServerInterface[];
|
|
17
|
-
/**
|
|
18
|
-
* Create new instance of `WebSocketRouter` and attach it to the given Fastify instance.
|
|
19
|
-
* Any logging information, will be passed through standard `fastify.log` API.
|
|
20
|
-
*
|
|
21
|
-
* @param fastify Fastify instance to attach the WebSocket router to.
|
|
22
|
-
*/
|
|
23
|
-
constructor(fastify: FastifyInstance);
|
|
24
|
-
/**
|
|
25
|
-
* Register a new {@link WebSocketServer}. New connection will now
|
|
26
|
-
* check if the given server will accept them and forward them.
|
|
27
|
-
*
|
|
28
|
-
* @param server WebSocket server to register.
|
|
29
|
-
* @returns The same instance of the WebSocket server after it's been registered.
|
|
30
|
-
*/
|
|
31
|
-
registerServer<T extends WebSocketServerInterface>(server: T): T;
|
|
32
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebSocketRouter = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Class for creating a WebSocket router to forward connections to the
|
|
6
|
-
* respective {@link WebSocketServer} as long as the connection is accepted for the upgrade by the
|
|
7
|
-
* server.
|
|
8
|
-
*
|
|
9
|
-
* If the connection is not accepted by any `WebSocketServer`, it will be destroyed to avoid
|
|
10
|
-
* creating handling connections and potentially throwing `ECONNRESET` errors.
|
|
11
|
-
*
|
|
12
|
-
* @category Development server
|
|
13
|
-
*/
|
|
14
|
-
class WebSocketRouter {
|
|
15
|
-
fastify;
|
|
16
|
-
/** The list of all register WebSocket servers. */
|
|
17
|
-
servers = [];
|
|
18
|
-
/**
|
|
19
|
-
* Create new instance of `WebSocketRouter` and attach it to the given Fastify instance.
|
|
20
|
-
* Any logging information, will be passed through standard `fastify.log` API.
|
|
21
|
-
*
|
|
22
|
-
* @param fastify Fastify instance to attach the WebSocket router to.
|
|
23
|
-
*/
|
|
24
|
-
constructor(fastify) {
|
|
25
|
-
this.fastify = fastify;
|
|
26
|
-
this.fastify.server.on("upgrade", (request, socket, head) => {
|
|
27
|
-
const { pathname } = new URL(request.url || "", "http://localhost");
|
|
28
|
-
let matched = false;
|
|
29
|
-
for (const server of this.servers) {
|
|
30
|
-
if (server.shouldUpgrade(pathname)) {
|
|
31
|
-
matched = true;
|
|
32
|
-
server.upgrade(request, socket, head);
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (!matched) {
|
|
37
|
-
this.fastify.log.debug({
|
|
38
|
-
msg: "Destroying socket connection as no server was matched",
|
|
39
|
-
pathname,
|
|
40
|
-
});
|
|
41
|
-
socket.destroy();
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Register a new {@link WebSocketServer}. New connection will now
|
|
47
|
-
* check if the given server will accept them and forward them.
|
|
48
|
-
*
|
|
49
|
-
* @param server WebSocket server to register.
|
|
50
|
-
* @returns The same instance of the WebSocket server after it's been registered.
|
|
51
|
-
*/
|
|
52
|
-
registerServer(server) {
|
|
53
|
-
this.servers.push(server);
|
|
54
|
-
return server;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.WebSocketRouter = WebSocketRouter;
|
|
58
|
-
//# sourceMappingURL=web-socket-router.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web-socket-router.js","sourceRoot":"","sources":["../../../../../../src/modules/dev/dev-server/plugins/wss/web-socket-router.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;GASG;AACH,MAAa,eAAe;IAUP;IATpB,kDAAkD;IACxC,OAAO,GAA+B,EAAE,CAAC;IAEnD;;;;;OAKG;IACH,YAAoB,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;QAC3C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CACrB,SAAS,EACT,CAAC,OAAwB,EAAE,MAAc,EAAE,IAAY,EAAE,EAAE;YAC1D,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,kBAAkB,CAAC,CAAC;YACpE,IAAI,OAAO,GAAG,KAAK,CAAC;YACpB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACnC,IAAI,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;oBACpC,OAAO,GAAG,IAAI,CAAC;oBACf,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;oBACtC,MAAM;gBACP,CAAC;YACF,CAAC;YAED,IAAI,CAAC,OAAO,EAAE,CAAC;gBACd,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;oBACtB,GAAG,EAAE,uDAAuD;oBAC5D,QAAQ;iBACR,CAAC,CAAC;gBACH,MAAM,CAAC,OAAO,EAAE,CAAC;YAClB,CAAC;QACF,CAAC,CACD,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,cAAc,CAAqC,MAAS;QAC3D,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1B,OAAO,MAAM,CAAC;IACf,CAAC;CACD;AA9CD,0CA8CC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage } from "node:http";
|
|
2
|
-
import type { Socket } from "node:net";
|
|
3
|
-
import type { FastifyInstance } from "fastify";
|
|
4
|
-
import type { WebSocketServer } from "ws";
|
|
5
|
-
import type { WebSocketServerInterface } from "./types";
|
|
6
|
-
export declare class WebSocketServerAdapter implements WebSocketServerInterface {
|
|
7
|
-
private fastify;
|
|
8
|
-
private path;
|
|
9
|
-
private server?;
|
|
10
|
-
constructor(fastify: FastifyInstance, path: string, server?: WebSocketServer);
|
|
11
|
-
shouldUpgrade(pathname: string): boolean;
|
|
12
|
-
upgrade(request: IncomingMessage, socket: Socket, head: Buffer): void;
|
|
13
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebSocketServerAdapter = void 0;
|
|
4
|
-
class WebSocketServerAdapter {
|
|
5
|
-
fastify;
|
|
6
|
-
path;
|
|
7
|
-
server;
|
|
8
|
-
constructor(fastify, path, server) {
|
|
9
|
-
this.fastify = fastify;
|
|
10
|
-
this.path = path;
|
|
11
|
-
this.server = server;
|
|
12
|
-
}
|
|
13
|
-
shouldUpgrade(pathname) {
|
|
14
|
-
if (!this.server) {
|
|
15
|
-
this.fastify.log.warn({ msg: `No handler active for ${this.path}` });
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
return this.path === pathname;
|
|
19
|
-
}
|
|
20
|
-
upgrade(request, socket, head) {
|
|
21
|
-
this.server?.handleUpgrade(request, socket, head, (webSocket) => {
|
|
22
|
-
this.server?.emit("connection", webSocket, request);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.WebSocketServerAdapter = WebSocketServerAdapter;
|
|
27
|
-
//# sourceMappingURL=web-socket-server-adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web-socket-server-adapter.js","sourceRoot":"","sources":["../../../../../../src/modules/dev/dev-server/plugins/wss/web-socket-server-adapter.ts"],"names":[],"mappings":";;;AAMA,MAAa,sBAAsB;IAEzB;IACA;IACA;IAHT,YACS,OAAwB,EACxB,IAAY,EACZ,MAAwB;QAFxB,YAAO,GAAP,OAAO,CAAiB;QACxB,SAAI,GAAJ,IAAI,CAAQ;QACZ,WAAM,GAAN,MAAM,CAAkB;IAC9B,CAAC;IAEJ,aAAa,CAAC,QAAgB;QAC7B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YAClB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,yBAAyB,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACrE,OAAO,KAAK,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;IAC/B,CAAC;IAED,OAAO,CAAC,OAAwB,EAAE,MAAc,EAAE,IAAY;QAC7D,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,EAAE;YAC/D,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AApBD,wDAoBC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage } from "node:http";
|
|
2
|
-
import type { Socket } from "node:net";
|
|
3
|
-
import type { FastifyInstance } from "fastify";
|
|
4
|
-
import { type ServerOptions, type WebSocket, WebSocketServer as WebSocketServerImpl } from "ws";
|
|
5
|
-
import type { WebSocketServerInterface } from "./types";
|
|
6
|
-
/**
|
|
7
|
-
/**
|
|
8
|
-
* Abstract class for providing common logic (eg routing) for all WebSocket servers.
|
|
9
|
-
*
|
|
10
|
-
* @category Development server
|
|
11
|
-
*/
|
|
12
|
-
export declare abstract class WebSocketServer implements WebSocketServerInterface {
|
|
13
|
-
/** An instance of the underlying WebSocket server. */
|
|
14
|
-
protected server: WebSocketServerImpl;
|
|
15
|
-
/** Fastify instance from which {@link server} will receive upgrade connections. */
|
|
16
|
-
protected fastify: FastifyInstance;
|
|
17
|
-
protected paths: string[];
|
|
18
|
-
/**
|
|
19
|
-
* Create a new instance of the WebSocketServer.
|
|
20
|
-
* Any logging information, will be passed through standard `fastify.log` API.
|
|
21
|
-
*
|
|
22
|
-
* @param fastify Fastify instance to which the WebSocket will be attached to.
|
|
23
|
-
* @param path Path on which this WebSocketServer will be accepting connections.
|
|
24
|
-
* @param wssOptions WebSocket Server options.
|
|
25
|
-
*/
|
|
26
|
-
constructor(fastify: FastifyInstance, path: string | string[], wssOptions?: Omit<ServerOptions, "noServer" | "server" | "host" | "port" | "path">);
|
|
27
|
-
shouldUpgrade(pathname: string): boolean;
|
|
28
|
-
upgrade(request: IncomingMessage, socket: Socket, head: Buffer): void;
|
|
29
|
-
/**
|
|
30
|
-
* Process incoming WebSocket connection.
|
|
31
|
-
*
|
|
32
|
-
* @param socket Incoming WebSocket connection.
|
|
33
|
-
* @param request Upgrade request for the connection.
|
|
34
|
-
*/
|
|
35
|
-
abstract onConnection(socket: WebSocket, request: IncomingMessage): void;
|
|
36
|
-
onError(error: Error): void;
|
|
37
|
-
onMessage(message: string): void;
|
|
38
|
-
onClose(socket: WebSocket): void;
|
|
39
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebSocketServer = void 0;
|
|
4
|
-
const ws_1 = require("ws");
|
|
5
|
-
/**
|
|
6
|
-
/**
|
|
7
|
-
* Abstract class for providing common logic (eg routing) for all WebSocket servers.
|
|
8
|
-
*
|
|
9
|
-
* @category Development server
|
|
10
|
-
*/
|
|
11
|
-
class WebSocketServer {
|
|
12
|
-
/** An instance of the underlying WebSocket server. */
|
|
13
|
-
server;
|
|
14
|
-
/** Fastify instance from which {@link server} will receive upgrade connections. */
|
|
15
|
-
fastify;
|
|
16
|
-
paths;
|
|
17
|
-
/**
|
|
18
|
-
* Create a new instance of the WebSocketServer.
|
|
19
|
-
* Any logging information, will be passed through standard `fastify.log` API.
|
|
20
|
-
*
|
|
21
|
-
* @param fastify Fastify instance to which the WebSocket will be attached to.
|
|
22
|
-
* @param path Path on which this WebSocketServer will be accepting connections.
|
|
23
|
-
* @param wssOptions WebSocket Server options.
|
|
24
|
-
*/
|
|
25
|
-
constructor(fastify, path, wssOptions = {}) {
|
|
26
|
-
this.fastify = fastify;
|
|
27
|
-
this.server = new ws_1.WebSocketServer({ noServer: true, ...wssOptions });
|
|
28
|
-
this.server.on("connection", this.onConnection.bind(this));
|
|
29
|
-
this.server.on("error", this.onError.bind(this));
|
|
30
|
-
this.server.on("message", this.onMessage.bind(this));
|
|
31
|
-
this.server.on("close", this.onClose.bind(this));
|
|
32
|
-
this.paths = Array.isArray(path) ? path : [path];
|
|
33
|
-
}
|
|
34
|
-
shouldUpgrade(pathname) {
|
|
35
|
-
return this.paths.includes(pathname);
|
|
36
|
-
}
|
|
37
|
-
upgrade(request, socket, head) {
|
|
38
|
-
this.server.handleUpgrade(request, socket, head, (webSocket) => {
|
|
39
|
-
this.server.emit("connection", webSocket, request);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
onError(error) { }
|
|
43
|
-
onMessage(message) { }
|
|
44
|
-
onClose(socket) { }
|
|
45
|
-
}
|
|
46
|
-
exports.WebSocketServer = WebSocketServer;
|
|
47
|
-
//# sourceMappingURL=web-socket-server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web-socket-server.js","sourceRoot":"","sources":["../../../../../../src/modules/dev/dev-server/plugins/wss/web-socket-server.ts"],"names":[],"mappings":";;;AAYA,2BAIY;AAeZ;;;;;GAKG;AACH,MAAsB,eAAe;IACpC,sDAAsD;IAC5C,MAAM,CAAsB;IAEtC,mFAAmF;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ACJ,CAAC;IAUD,OAAO,CAAC,KAAY,IAAG,CAAC;IAExB,SAAS,CAAC,OAAe,IAAG,CAAC;IAE7B,OAAO,CAAC,MAAiB,IAAG,CAAC;CAC7B;AAzDD,0CAyDC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { WebSocketApiServer } from "./servers/web-socket-api.server";
|
|
2
|
-
import { WebSocketDebuggerServer } from "./servers/web-socket-debugger.server";
|
|
3
|
-
import { WebSocketDevClientServer } from "./servers/web-socket-dev-client.server";
|
|
4
|
-
import type { WebSocketEventsServer } from "./servers/web-socket-events.server";
|
|
5
|
-
import { WebSocketHMRServer } from "./servers/web-socket-hmr.server";
|
|
6
|
-
import type { WebSocketMessageServer } from "./servers/web-socket-message.server";
|
|
7
|
-
import { WebSocketRouter } from "./web-socket-router";
|
|
8
|
-
import { WebSocketServerAdapter } from "./web-socket-server-adapter";
|
|
9
|
-
declare module "fastify" {
|
|
10
|
-
interface FastifyInstance {
|
|
11
|
-
wss: {
|
|
12
|
-
debuggerServer: WebSocketDebuggerServer;
|
|
13
|
-
devClientServer: WebSocketDevClientServer;
|
|
14
|
-
messageServer: WebSocketMessageServer;
|
|
15
|
-
eventsServer: WebSocketEventsServer;
|
|
16
|
-
apiServer: WebSocketApiServer;
|
|
17
|
-
hmrServer: WebSocketHMRServer;
|
|
18
|
-
deviceConnectionServer: WebSocketServerAdapter;
|
|
19
|
-
debuggerConnectionServer: WebSocketServerAdapter;
|
|
20
|
-
router: WebSocketRouter;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export declare const wssPlugin: any;
|