@teardown/cli 1.2.39 → 2.0.41

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.
Files changed (260) hide show
  1. package/bin/teardown.js +11 -1
  2. package/package.json +77 -57
  3. package/src/cli/commands/init.ts +254 -0
  4. package/src/cli/commands/plugins.ts +93 -0
  5. package/src/cli/commands/prebuild.ts +168 -0
  6. package/src/cli/commands/run.ts +727 -0
  7. package/src/cli/commands/start.ts +87 -0
  8. package/src/cli/commands/validate.ts +62 -0
  9. package/src/cli/index.ts +59 -0
  10. package/src/config/index.ts +45 -0
  11. package/src/config/loader.ts +366 -0
  12. package/src/config/schema.ts +235 -0
  13. package/src/config/types.ts +322 -0
  14. package/src/index.ts +177 -0
  15. package/src/pipeline/cache.ts +179 -0
  16. package/src/pipeline/index.ts +10 -0
  17. package/src/pipeline/stages.ts +692 -0
  18. package/src/plugins/base.ts +370 -0
  19. package/src/plugins/capabilities/biometrics.ts +64 -0
  20. package/src/plugins/capabilities/bluetooth.ts +86 -0
  21. package/src/plugins/capabilities/calendar.ts +57 -0
  22. package/src/plugins/capabilities/camera.ts +77 -0
  23. package/src/plugins/capabilities/contacts.ts +57 -0
  24. package/src/plugins/capabilities/deep-linking.ts +124 -0
  25. package/src/plugins/capabilities/firebase.ts +138 -0
  26. package/src/plugins/capabilities/index.ts +96 -0
  27. package/src/plugins/capabilities/location.ts +87 -0
  28. package/src/plugins/capabilities/photo-library.ts +80 -0
  29. package/src/plugins/capabilities/push-notifications.ts +98 -0
  30. package/src/plugins/capabilities/sign-in-with-apple.ts +53 -0
  31. package/src/plugins/context.ts +220 -0
  32. package/src/plugins/index.ts +26 -0
  33. package/src/plugins/resolver.ts +321 -0
  34. package/src/templates/generator.ts +507 -0
  35. package/src/templates/index.ts +9 -0
  36. package/src/templates/paths.ts +25 -0
  37. package/src/transformers/android/gradle.ts +400 -0
  38. package/src/transformers/android/index.ts +19 -0
  39. package/src/transformers/android/manifest.ts +506 -0
  40. package/src/transformers/index.ts +39 -0
  41. package/src/transformers/ios/entitlements.ts +283 -0
  42. package/src/transformers/ios/index.ts +10 -0
  43. package/src/transformers/ios/pbxproj.ts +267 -0
  44. package/src/transformers/ios/plist.ts +198 -0
  45. package/src/utils/fs.ts +429 -0
  46. package/src/utils/index.ts +21 -0
  47. package/src/utils/logger.ts +203 -0
  48. package/templates/.gitignore +63 -0
  49. package/templates/Gemfile +3 -0
  50. package/templates/android/app/build.gradle.kts +97 -0
  51. package/templates/android/app/proguard-rules.pro +10 -0
  52. package/templates/android/app/src/main/AndroidManifest.xml +26 -0
  53. package/templates/android/app/src/main/java/com/appname/MainActivity.kt +22 -0
  54. package/templates/android/app/src/main/java/com/appname/MainApplication.kt +44 -0
  55. package/templates/android/app/src/main/res/values/strings.xml +3 -0
  56. package/templates/android/app/src/main/res/values/styles.xml +7 -0
  57. package/templates/android/build.gradle.kts +44 -0
  58. package/templates/android/gradle.properties +39 -0
  59. package/templates/android/settings.gradle.kts +12 -0
  60. package/templates/babel.config.js +15 -0
  61. package/templates/index.js +7 -0
  62. package/templates/ios/.xcode.env +11 -0
  63. package/templates/ios/AppName/AppDelegate.swift +25 -0
  64. package/templates/ios/AppName/AppName-Bridging-Header.h +4 -0
  65. package/templates/ios/AppName/AppName.entitlements +6 -0
  66. package/templates/ios/AppName/Images.xcassets/AppIcon.appiconset/Contents.json +35 -0
  67. package/templates/ios/AppName/Images.xcassets/Contents.json +6 -0
  68. package/templates/ios/AppName/Info.plist +49 -0
  69. package/templates/ios/AppName/LaunchScreen.storyboard +38 -0
  70. package/templates/ios/AppName.xcodeproj/project.pbxproj +402 -0
  71. package/templates/ios/AppName.xcodeproj/xcshareddata/xcschemes/AppName.xcscheme +78 -0
  72. package/templates/ios/Podfile +35 -0
  73. package/templates/metro.config.js +41 -0
  74. package/templates/package.json +57 -0
  75. package/templates/react-native.config.js +8 -0
  76. package/templates/src/app/index.tsx +34 -0
  77. package/templates/src/assets/fonts/.gitkeep +1 -0
  78. package/templates/src/assets/images/.gitkeep +1 -0
  79. package/templates/src/components/ui/accordion.tsx +114 -0
  80. package/templates/src/components/ui/avatar.tsx +75 -0
  81. package/templates/src/components/ui/button.tsx +93 -0
  82. package/templates/src/components/ui/card.tsx +120 -0
  83. package/templates/src/components/ui/checkbox.tsx +133 -0
  84. package/templates/src/components/ui/chip.tsx +95 -0
  85. package/templates/src/components/ui/dialog.tsx +134 -0
  86. package/templates/src/components/ui/divider.tsx +67 -0
  87. package/templates/src/components/ui/error-view.tsx +82 -0
  88. package/templates/src/components/ui/form-field.tsx +101 -0
  89. package/templates/src/components/ui/index.ts +100 -0
  90. package/templates/src/components/ui/popover.tsx +92 -0
  91. package/templates/src/components/ui/pressable-feedback.tsx +88 -0
  92. package/templates/src/components/ui/radio-group.tsx +153 -0
  93. package/templates/src/components/ui/scroll-shadow.tsx +108 -0
  94. package/templates/src/components/ui/select.tsx +165 -0
  95. package/templates/src/components/ui/skeleton-group.tsx +97 -0
  96. package/templates/src/components/ui/skeleton.tsx +87 -0
  97. package/templates/src/components/ui/spinner.tsx +87 -0
  98. package/templates/src/components/ui/surface.tsx +95 -0
  99. package/templates/src/components/ui/switch.tsx +124 -0
  100. package/templates/src/components/ui/tabs.tsx +154 -0
  101. package/templates/src/components/ui/text-field.tsx +106 -0
  102. package/templates/src/components/ui/toast.tsx +129 -0
  103. package/templates/src/contexts/.gitkeep +2 -0
  104. package/templates/src/core/clients/api/api.client.ts +113 -0
  105. package/templates/src/core/clients/api/index.ts +1 -0
  106. package/templates/src/core/clients/storage/index.ts +1 -0
  107. package/templates/src/core/clients/storage/storage.client.ts +121 -0
  108. package/templates/src/core/constants/index.ts +19 -0
  109. package/templates/src/core/core.ts +40 -0
  110. package/templates/src/core/index.ts +10 -0
  111. package/templates/src/global.css +87 -0
  112. package/templates/src/hooks/index.ts +6 -0
  113. package/templates/src/hooks/use-debounce.ts +23 -0
  114. package/templates/src/hooks/use-mounted.ts +21 -0
  115. package/templates/src/index.ts +28 -0
  116. package/templates/src/lib/index.ts +5 -0
  117. package/templates/src/lib/utils.ts +115 -0
  118. package/templates/src/modules/.gitkeep +6 -0
  119. package/templates/src/navigation/index.ts +8 -0
  120. package/templates/src/navigation/navigation-provider.tsx +36 -0
  121. package/templates/src/navigation/router.tsx +137 -0
  122. package/templates/src/providers/app.provider.tsx +29 -0
  123. package/templates/src/providers/index.ts +5 -0
  124. package/templates/src/routes/(tabs)/_layout.tsx +42 -0
  125. package/templates/src/routes/(tabs)/explore.tsx +161 -0
  126. package/templates/src/routes/(tabs)/home.tsx +138 -0
  127. package/templates/src/routes/(tabs)/profile.tsx +151 -0
  128. package/templates/src/routes/_layout.tsx +18 -0
  129. package/templates/src/routes/settings.tsx +194 -0
  130. package/templates/src/screens/auth/index.ts +6 -0
  131. package/templates/src/screens/auth/login.tsx +165 -0
  132. package/templates/src/screens/auth/register.tsx +203 -0
  133. package/templates/src/screens/home.tsx +204 -0
  134. package/templates/src/screens/index.ts +17 -0
  135. package/templates/src/screens/profile.tsx +210 -0
  136. package/templates/src/screens/settings.tsx +216 -0
  137. package/templates/src/screens/welcome.tsx +101 -0
  138. package/templates/src/styles/index.ts +103 -0
  139. package/templates/src/types/common.ts +71 -0
  140. package/templates/src/types/index.ts +5 -0
  141. package/templates/tsconfig.json +14 -0
  142. package/README.md +0 -15
  143. package/assets/favicon.ico +0 -0
  144. package/dist/commands/dev/dev.d.ts +0 -22
  145. package/dist/commands/dev/dev.js +0 -56
  146. package/dist/commands/dev/dev.js.map +0 -1
  147. package/dist/commands/init/init-teardown.d.ts +0 -9
  148. package/dist/commands/init/init-teardown.js +0 -27
  149. package/dist/commands/init/init-teardown.js.map +0 -1
  150. package/dist/index.d.ts +0 -1
  151. package/dist/index.js +0 -21
  152. package/dist/index.js.map +0 -1
  153. package/dist/modules/dev/dev-menu/keyboard-handler.d.ts +0 -21
  154. package/dist/modules/dev/dev-menu/keyboard-handler.js +0 -139
  155. package/dist/modules/dev/dev-menu/keyboard-handler.js.map +0 -1
  156. package/dist/modules/dev/dev-menu/open-debugger-keyboard-handler.d.ts +0 -18
  157. package/dist/modules/dev/dev-menu/open-debugger-keyboard-handler.js +0 -106
  158. package/dist/modules/dev/dev-menu/open-debugger-keyboard-handler.js.map +0 -1
  159. package/dist/modules/dev/dev-server/cdp/cdp.adapter.d.ts +0 -6
  160. package/dist/modules/dev/dev-server/cdp/cdp.adapter.js +0 -13
  161. package/dist/modules/dev/dev-server/cdp/cdp.adapter.js.map +0 -1
  162. package/dist/modules/dev/dev-server/cdp/index.d.ts +0 -2
  163. package/dist/modules/dev/dev-server/cdp/index.js +0 -19
  164. package/dist/modules/dev/dev-server/cdp/index.js.map +0 -1
  165. package/dist/modules/dev/dev-server/cdp/types.d.ts +0 -107
  166. package/dist/modules/dev/dev-server/cdp/types.js +0 -3
  167. package/dist/modules/dev/dev-server/cdp/types.js.map +0 -1
  168. package/dist/modules/dev/dev-server/dev-server-checker.d.ts +0 -22
  169. package/dist/modules/dev/dev-server/dev-server-checker.js +0 -73
  170. package/dist/modules/dev/dev-server/dev-server-checker.js.map +0 -1
  171. package/dist/modules/dev/dev-server/dev-server.d.ts +0 -74
  172. package/dist/modules/dev/dev-server/dev-server.js +0 -272
  173. package/dist/modules/dev/dev-server/dev-server.js.map +0 -1
  174. package/dist/modules/dev/dev-server/inspector/device.d.ts +0 -46
  175. package/dist/modules/dev/dev-server/inspector/device.event-reporter.d.ts +0 -37
  176. package/dist/modules/dev/dev-server/inspector/device.event-reporter.js +0 -166
  177. package/dist/modules/dev/dev-server/inspector/device.event-reporter.js.map +0 -1
  178. package/dist/modules/dev/dev-server/inspector/device.js +0 -578
  179. package/dist/modules/dev/dev-server/inspector/device.js.map +0 -1
  180. package/dist/modules/dev/dev-server/inspector/inspector.d.ts +0 -27
  181. package/dist/modules/dev/dev-server/inspector/inspector.js +0 -225
  182. package/dist/modules/dev/dev-server/inspector/inspector.js.map +0 -1
  183. package/dist/modules/dev/dev-server/inspector/types.d.ts +0 -156
  184. package/dist/modules/dev/dev-server/inspector/types.js +0 -3
  185. package/dist/modules/dev/dev-server/inspector/types.js.map +0 -1
  186. package/dist/modules/dev/dev-server/inspector/wss/servers/debugger-connection.server.d.ts +0 -14
  187. package/dist/modules/dev/dev-server/inspector/wss/servers/debugger-connection.server.js +0 -63
  188. package/dist/modules/dev/dev-server/inspector/wss/servers/debugger-connection.server.js.map +0 -1
  189. package/dist/modules/dev/dev-server/inspector/wss/servers/device-connection.server.d.ts +0 -19
  190. package/dist/modules/dev/dev-server/inspector/wss/servers/device-connection.server.js +0 -66
  191. package/dist/modules/dev/dev-server/inspector/wss/servers/device-connection.server.js.map +0 -1
  192. package/dist/modules/dev/dev-server/plugins/devtools.plugin.d.ts +0 -1
  193. package/dist/modules/dev/dev-server/plugins/devtools.plugin.js +0 -51
  194. package/dist/modules/dev/dev-server/plugins/devtools.plugin.js.map +0 -1
  195. package/dist/modules/dev/dev-server/plugins/favicon.plugin.d.ts +0 -1
  196. package/dist/modules/dev/dev-server/plugins/favicon.plugin.js +0 -19
  197. package/dist/modules/dev/dev-server/plugins/favicon.plugin.js.map +0 -1
  198. package/dist/modules/dev/dev-server/plugins/multipart.plugin.d.ts +0 -1
  199. package/dist/modules/dev/dev-server/plugins/multipart.plugin.js +0 -63
  200. package/dist/modules/dev/dev-server/plugins/multipart.plugin.js.map +0 -1
  201. package/dist/modules/dev/dev-server/plugins/systrace.plugin.d.ts +0 -1
  202. package/dist/modules/dev/dev-server/plugins/systrace.plugin.js +0 -29
  203. package/dist/modules/dev/dev-server/plugins/systrace.plugin.js.map +0 -1
  204. package/dist/modules/dev/dev-server/plugins/types.d.ts +0 -11
  205. package/dist/modules/dev/dev-server/plugins/types.js +0 -3
  206. package/dist/modules/dev/dev-server/plugins/types.js.map +0 -1
  207. package/dist/modules/dev/dev-server/plugins/wss/index.d.ts +0 -3
  208. package/dist/modules/dev/dev-server/plugins/wss/index.js +0 -20
  209. package/dist/modules/dev/dev-server/plugins/wss/index.js.map +0 -1
  210. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-api.server.d.ts +0 -37
  211. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-api.server.js +0 -67
  212. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-api.server.js.map +0 -1
  213. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-debugger.server.d.ts +0 -63
  214. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-debugger.server.js +0 -129
  215. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-debugger.server.js.map +0 -1
  216. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-dev-client.server.d.ts +0 -32
  217. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-dev-client.server.js +0 -76
  218. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-dev-client.server.js.map +0 -1
  219. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-events.server.d.ts +0 -75
  220. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-events.server.js +0 -199
  221. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-events.server.js.map +0 -1
  222. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-hmr.server.d.ts +0 -44
  223. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-hmr.server.js +0 -121
  224. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-hmr.server.js.map +0 -1
  225. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-message.server.d.ts +0 -135
  226. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-message.server.js +0 -364
  227. package/dist/modules/dev/dev-server/plugins/wss/servers/web-socket-message.server.js.map +0 -1
  228. package/dist/modules/dev/dev-server/plugins/wss/types.d.ts +0 -6
  229. package/dist/modules/dev/dev-server/plugins/wss/types.js +0 -3
  230. package/dist/modules/dev/dev-server/plugins/wss/types.js.map +0 -1
  231. package/dist/modules/dev/dev-server/plugins/wss/web-socket-router.d.ts +0 -32
  232. package/dist/modules/dev/dev-server/plugins/wss/web-socket-router.js +0 -58
  233. package/dist/modules/dev/dev-server/plugins/wss/web-socket-router.js.map +0 -1
  234. package/dist/modules/dev/dev-server/plugins/wss/web-socket-server-adapter.d.ts +0 -13
  235. package/dist/modules/dev/dev-server/plugins/wss/web-socket-server-adapter.js +0 -27
  236. package/dist/modules/dev/dev-server/plugins/wss/web-socket-server-adapter.js.map +0 -1
  237. package/dist/modules/dev/dev-server/plugins/wss/web-socket-server.d.ts +0 -39
  238. package/dist/modules/dev/dev-server/plugins/wss/web-socket-server.js +0 -47
  239. package/dist/modules/dev/dev-server/plugins/wss/web-socket-server.js.map +0 -1
  240. package/dist/modules/dev/dev-server/plugins/wss/wss.plugin.d.ts +0 -24
  241. package/dist/modules/dev/dev-server/plugins/wss/wss.plugin.js +0 -56
  242. package/dist/modules/dev/dev-server/plugins/wss/wss.plugin.js.map +0 -1
  243. package/dist/modules/dev/dev-server/sybmolicate/sybmolicate.plugin.d.ts +0 -7
  244. package/dist/modules/dev/dev-server/sybmolicate/sybmolicate.plugin.js +0 -41
  245. package/dist/modules/dev/dev-server/sybmolicate/sybmolicate.plugin.js.map +0 -1
  246. package/dist/modules/dev/dev-server/sybmolicate/types.d.ts +0 -64
  247. package/dist/modules/dev/dev-server/sybmolicate/types.js +0 -3
  248. package/dist/modules/dev/dev-server/sybmolicate/types.js.map +0 -1
  249. package/dist/modules/dev/terminal/base.terminal.reporter.d.ts +0 -25
  250. package/dist/modules/dev/terminal/base.terminal.reporter.js +0 -79
  251. package/dist/modules/dev/terminal/base.terminal.reporter.js.map +0 -1
  252. package/dist/modules/dev/terminal/terminal.reporter.d.ts +0 -13
  253. package/dist/modules/dev/terminal/terminal.reporter.js +0 -83
  254. package/dist/modules/dev/terminal/terminal.reporter.js.map +0 -1
  255. package/dist/modules/dev/types.d.ts +0 -20
  256. package/dist/modules/dev/types.js +0 -3
  257. package/dist/modules/dev/types.js.map +0 -1
  258. package/dist/modules/dev/utils/log.d.ts +0 -23
  259. package/dist/modules/dev/utils/log.js +0 -74
  260. package/dist/modules/dev/utils/log.js.map +0 -1
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.faviconPlugin = void 0;
7
- const fastify_favicon_1 = __importDefault(require("fastify-favicon"));
8
- const fastify_plugin_1 = __importDefault(require("fastify-plugin"));
9
- const node_path_1 = __importDefault(require("node:path"));
10
- const node_url_1 = require("node:url");
11
- // @ts-ignore
12
- const dirname = node_path_1.default.dirname((0, node_url_1.fileURLToPath)(import.meta.url));
13
- const pathToImgDir = node_path_1.default.join(dirname, "../../../../../assets");
14
- exports.faviconPlugin = (0, fastify_plugin_1.default)(async (instance) => {
15
- instance.register(fastify_favicon_1.default, { path: pathToImgDir });
16
- }, {
17
- name: "favicon-plugin",
18
- });
19
- //# sourceMappingURL=favicon.plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"favicon.plugin.js","sourceRoot":"","sources":["../../../../../src/modules/dev/dev-server/plugins/favicon.plugin.ts"],"names":[],"mappings":";;;;;;AAAA,sEAA6C;AAC7C,oEAA2C;AAC3C,0DAA6B;AAC7B,uCAAyC;AAEzC,aAAa;AACb,MAAM,OAAO,GAAG,mBAAI,CAAC,OAAO,CAAC,IAAA,wBAAa,EAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7D,MAAM,YAAY,GAAG,mBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC;AAEpD,QAAA,aAAa,GAAG,IAAA,wBAAa,EACzC,KAAK,EAAE,QAAQ,EAAE,EAAE;IAClB,QAAQ,CAAC,QAAQ,CAAC,yBAAc,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;AAC3D,CAAC,EACD;IACC,IAAI,EAAE,gBAAgB;CACtB,CACD,CAAC"}
@@ -1 +0,0 @@
1
- export declare const multipartPlugin: any;
@@ -1,63 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.multipartPlugin = void 0;
7
- const fastify_plugin_1 = __importDefault(require("fastify-plugin"));
8
- const node_stream_1 = require("node:stream");
9
- /**
10
- * Implementation is based on:
11
- * https://github.com/facebook/metro/blob/347b1d7ed87995d7951aaa9fd597c04b06013dac/packages/metro/src/Server/MultipartResponse.js
12
- */
13
- const CRLF = "\r\n";
14
- const BOUNDARY = "3beqjf3apnqeu3h5jqorms4i";
15
- exports.multipartPlugin = (0, fastify_plugin_1.default)(async (instance) => {
16
- function asMultipart() {
17
- // We should check if is included in accept or if accept has multipart/* or */*,
18
- // but React Native will set accept to exactly `multipart/mixed`, so a simple check
19
- // will suffice.
20
- if (this.request.headers.accept !== "multipart/mixed") {
21
- return undefined;
22
- }
23
- const headers = {};
24
- const stream = new node_stream_1.PassThrough();
25
- this.code(200)
26
- .header("Content-Type", `multipart/mixed; boundary="${BOUNDARY}"`)
27
- .send(stream);
28
- function serializeHeaders(headers) {
29
- return Object.keys(headers)
30
- .map((key) => `${key}: ${headers[key]}`)
31
- .join(CRLF);
32
- }
33
- function writeChunk(headers, data, isLast) {
34
- let chunk = `${CRLF}--${BOUNDARY}${CRLF}`;
35
- if (headers) {
36
- chunk += serializeHeaders(headers) + CRLF + CRLF;
37
- }
38
- if (data) {
39
- chunk += data;
40
- }
41
- if (isLast) {
42
- chunk += `${CRLF}--${BOUNDARY}--${CRLF}`;
43
- }
44
- stream.write(chunk);
45
- }
46
- function setHeader(name, value) {
47
- headers[name] = value;
48
- }
49
- function end(data) {
50
- writeChunk(headers, data, true);
51
- stream.end();
52
- }
53
- return {
54
- writeChunk,
55
- setHeader,
56
- end,
57
- };
58
- }
59
- instance.decorateReply("asMultipart", asMultipart);
60
- }, {
61
- name: "multipart-plugin",
62
- });
63
- //# sourceMappingURL=multipart.plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multipart.plugin.js","sourceRoot":"","sources":["../../../../../src/modules/dev/dev-server/plugins/multipart.plugin.ts"],"names":[],"mappings":";;;;;;AACA,oEAA2C;AAE3C,6CAA0C;AAG1C;;;GAGG;AAEH,MAAM,IAAI,GAAG,MAAM,CAAC;AACpB,MAAM,QAAQ,GAAG,0BAA0B,CAAC;AAE/B,QAAA,eAAe,GAAG,IAAA,wBAAa,EAC3C,KAAK,EAAE,QAAQ,EAAE,EAAE;IAClB,SAAS,WAAW;QACnB,gFAAgF;QAChF,mFAAmF;QACnF,gBAAgB;QAChB,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,iBAAiB,EAAE,CAAC;YACvD,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,MAAM,OAAO,GAAwB,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,IAAI,yBAAW,EAAE,CAAC;QAEjC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;aACZ,MAAM,CAAC,cAAc,EAAE,8BAA8B,QAAQ,GAAG,CAAC;aACjE,IAAI,CAAC,MAAM,CAAC,CAAC;QAEf,SAAS,gBAAgB,CAAC,OAA4B;YACrD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;iBACzB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;iBACvC,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,CAAC;QAED,SAAS,UAAU,CAClB,OAA4B,EAC5B,IAAO,EACP,MAAgB;YAEhB,IAAI,KAAK,GAAG,GAAG,IAAI,KAAK,QAAQ,GAAG,IAAI,EAAE,CAAC;YAC1C,IAAI,OAAO,EAAE,CAAC;gBACb,KAAK,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;YAClD,CAAC;YAED,IAAI,IAAI,EAAE,CAAC;gBACV,KAAK,IAAI,IAAI,CAAC;YACf,CAAC;YAED,IAAI,MAAM,EAAE,CAAC;gBACZ,KAAK,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC1C,CAAC;YAED,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;QAED,SAAS,SAAS,CAAC,IAAY,EAAE,KAAoC;YACpE,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QACvB,CAAC;QAED,SAAS,GAAG,CAAI,IAAO;YACtB,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YAChC,MAAM,CAAC,GAAG,EAAE,CAAC;QACd,CAAC;QAED,OAAO;YACN,UAAU;YACV,SAAS;YACT,GAAG;SACH,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,aAAa,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;AACpD,CAAC,EACD;IACC,IAAI,EAAE,kBAAkB;CACxB,CACD,CAAC"}
@@ -1 +0,0 @@
1
- export declare const systracePlugin: any;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.systracePlugin = void 0;
7
- const fastify_plugin_1 = __importDefault(require("fastify-plugin"));
8
- const node_fs_1 = __importDefault(require("node:fs"));
9
- const cli_tools_1 = require("@react-native-community/cli-tools");
10
- exports.systracePlugin = (0, fastify_plugin_1.default)(async (instance) => {
11
- instance.post("/systrace", async (request, reply) => {
12
- cli_tools_1.logger.info("Dumping profile information...");
13
- const dumpName = `/tmp/dump_${Date.now()}.json`;
14
- // Get the raw body from the request
15
- const rawBody = await request.body;
16
- node_fs_1.default.writeFileSync(dumpName, JSON.stringify(rawBody));
17
- const response =
18
- // biome-ignore lint/style/useTemplate: <explanation>
19
- `Your profile was saved at:\n${dumpName}\n\n` +
20
- 'On Google Chrome navigate to chrome://tracing and then click on "load" ' +
21
- "to load and visualise your profile.\n\n" +
22
- "This message is also printed to your console by the packager so you can copy it :)";
23
- cli_tools_1.logger.info(response);
24
- return reply.send(response);
25
- });
26
- }, {
27
- name: "systrace-plugin",
28
- });
29
- //# sourceMappingURL=systrace.plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"systrace.plugin.js","sourceRoot":"","sources":["../../../../../src/modules/dev/dev-server/plugins/systrace.plugin.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2C;AAC3C,sDAAyB;AACzB,iEAA2D;AAG9C,QAAA,cAAc,GAAG,IAAA,wBAAa,EAC1C,KAAK,EAAE,QAAQ,EAAE,EAAE;IAClB,QAAQ,CAAC,IAAI,CACZ,WAAW,EACX,KAAK,EAAE,OAAuB,EAAE,KAAmB,EAAE,EAAE;QACtD,kBAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAE9C,MAAM,QAAQ,GAAG,aAAa,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC;QAEhD,oCAAoC;QACpC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;QACnC,iBAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAEpD,MAAM,QAAQ;QACb,qDAAqD;QACrD,+BAA+B,QAAQ,MAAM;YAC7C,yEAAyE;YACzE,yCAAyC;YACzC,oFAAoF,CAAC;QAEtF,kBAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtB,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC,CACD,CAAC;AACH,CAAC,EACD;IACC,IAAI,EAAE,iBAAiB;CACvB,CACD,CAAC"}
@@ -1,11 +0,0 @@
1
- import type { IncomingHttpHeaders } from 'node:http';
2
- export interface MultipartHandler {
3
- writeChunk: <T>(headers: IncomingHttpHeaders, data: T, isLast?: boolean) => void;
4
- setHeader: (name: string, value: string | string[] | undefined) => void;
5
- end: <T>(data: T) => void;
6
- }
7
- declare module 'fastify' {
8
- interface FastifyReply {
9
- asMultipart: () => MultipartHandler | undefined;
10
- }
11
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/modules/dev/dev-server/plugins/types.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export * from "./wss.plugin";
2
- export * from "./web-socket-server";
3
- export * from "./types";
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./wss.plugin"), exports);
18
- __exportStar(require("./web-socket-server"), exports);
19
- __exportStar(require("./types"), exports);
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/modules/dev/dev-server/plugins/wss/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,sDAAoC;AACpC,0CAAwB"}
@@ -1,37 +0,0 @@
1
- import type { FastifyInstance } from "fastify";
2
- import type { TerminalReportableEvent } from "metro/src/lib/TerminalReporter";
3
- import type WebSocket from "ws";
4
- import { WebSocketServer } from "../web-socket-server";
5
- export type WebSocketApiEvent = {
6
- type: "metro_event";
7
- event: TerminalReportableEvent;
8
- };
9
- /**
10
- * Class for creating a WebSocket server for API clients.
11
- * Useful to listening for compilation events and new logs.
12
- *
13
- * @category Development server
14
- */
15
- export declare class WebSocketApiServer extends WebSocketServer {
16
- private clients;
17
- private nextClientId;
18
- /**
19
- * Create new instance of WebSocketApiServer 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 server to.
23
- */
24
- constructor(fastify: FastifyInstance);
25
- /**
26
- * Send message to all connected API clients.
27
- *
28
- * @param event Event string or object to send.
29
- */
30
- send(event: unknown | WebSocketApiEvent): void;
31
- /**
32
- * Process new WebSocket connection from client application.
33
- *
34
- * @param socket Incoming client's WebSocket connection.
35
- */
36
- onConnection(socket: WebSocket): void;
37
- }
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebSocketApiServer = void 0;
4
- const web_socket_server_1 = require("../web-socket-server");
5
- /**
6
- * Class for creating a WebSocket server for API clients.
7
- * Useful to listening for compilation events and new logs.
8
- *
9
- * @category Development server
10
- */
11
- class WebSocketApiServer extends web_socket_server_1.WebSocketServer {
12
- clients = new Map();
13
- nextClientId = 0;
14
- /**
15
- * Create new instance of WebSocketApiServer and attach it to the given Fastify instance.
16
- * Any logging information, will be passed through standard `fastify.log` API.
17
- *
18
- * @param fastify Fastify instance to attach the WebSocket server to.
19
- */
20
- constructor(fastify) {
21
- super(fastify, "/api-console");
22
- }
23
- /**
24
- * Send message to all connected API clients.
25
- *
26
- * @param event Event string or object to send.
27
- */
28
- send(event) {
29
- if (this.clients.size === 0) {
30
- return;
31
- }
32
- const data = typeof event === "string" ? event : JSON.stringify(event);
33
- for (const [, socket] of this.clients.entries()) {
34
- try {
35
- socket.send(data);
36
- }
37
- catch (error) {
38
- this.fastify.log.error("Error sending message to API client", {
39
- error,
40
- });
41
- }
42
- }
43
- }
44
- /**
45
- * Process new WebSocket connection from client application.
46
- *
47
- * @param socket Incoming client's WebSocket connection.
48
- */
49
- onConnection(socket) {
50
- const clientId = `client#${this.nextClientId++}`;
51
- this.clients.set(clientId, socket);
52
- this.fastify.log.info("API client connected", {
53
- clientId,
54
- });
55
- this.clients.set(clientId, socket);
56
- const onClose = () => {
57
- this.fastify.log.info("API client disconnected", {
58
- clientId,
59
- });
60
- this.clients.delete(clientId);
61
- };
62
- socket.addEventListener("error", onClose);
63
- socket.addEventListener("close", onClose);
64
- }
65
- }
66
- exports.WebSocketApiServer = WebSocketApiServer;
67
- //# sourceMappingURL=web-socket-api.server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"web-socket-api.server.js","sourceRoot":"","sources":["../../../../../../../src/modules/dev/dev-server/plugins/wss/servers/web-socket-api.server.ts"],"names":[],"mappings":";;;AAGA,4DAAuD;AAOvD;;;;;GAKG;AACH,MAAa,kBAAmB,SAAQ,mCAAe;IAC9C,OAAO,GAAG,IAAI,GAAG,EAAqB,CAAC;IACvC,YAAY,GAAG,CAAC,CAAC;IAEzB;;;;;OAKG;IACH,YAAY,OAAwB;QACnC,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,KAAkC;QACtC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO;QACR,CAAC;QAED,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACvE,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;YACjD,IAAI,CAAC;gBACJ,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,qCAAqC,EAAE;oBAC7D,KAAK;iBACL,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;IACF,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,MAAiB;QAC7B,MAAM,QAAQ,GAAG,UAAU,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;QACjD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAEnC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,EAAE;YAC7C,QAAQ;SACR,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAEnC,MAAM,OAAO,GAAG,GAAG,EAAE;YACpB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,yBAAyB,EAAE;gBAChD,QAAQ;aACR,CAAC,CAAC;YACH,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1C,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;CACD;AA5DD,gDA4DC"}
@@ -1,63 +0,0 @@
1
- import type { IncomingMessage } from "node:http";
2
- import type { FastifyInstance } from "fastify";
3
- import type WebSocket from "ws";
4
- import { WebSocketServer } from "../web-socket-server";
5
- /**
6
- * Class for creating a WebSocket server and providing a bridge between
7
- * debugger UI (Remote JS debugger) and the running React Native application.
8
- *
9
- * React Native application (aka client) will send and receive messages from the debugger UI
10
- * which runs inside a browser.
11
- *
12
- * @category Development server
13
- */
14
- export declare class WebSocketDebuggerServer extends WebSocketServer {
15
- /**
16
- * A WebSocket connection with the debugger UI.
17
- */
18
- private debuggerSocket;
19
- /**
20
- * A WebSocket connection with the client (React Native app).
21
- */
22
- private clientSocket;
23
- /**
24
- * Create new instance of WebSocketDebuggerServer and attach it to the given Fastify instance.
25
- * Any logging information, will be passed through standard `fastify.log` API.
26
- *
27
- * @param fastify Fastify instance to attach the WebSocket server to.
28
- */
29
- constructor(fastify: FastifyInstance);
30
- /**
31
- * Check if debugger UI is connected to the WebSocketDebuggerServer.
32
- */
33
- isDebuggerConnected(): boolean;
34
- /**
35
- * Send a message to a given WebSocket connection.
36
- *
37
- * @param socket WebSocket connection to send the message to.
38
- * @param message Message to send.
39
- */
40
- send(socket: WebSocket | undefined, message: string): void;
41
- /**
42
- * Process new WebSocket connection. The upgrade request should contain `role` query param
43
- * for determining the type of the connection.
44
- *
45
- * @param socket Incoming WebSocket connection.
46
- * @param request Upgrade request for the connection.
47
- */
48
- onConnection(socket: WebSocket, request: IncomingMessage): void;
49
- /**
50
- * Process new WebSocket connection from Debugger UI (Remote JS Debugger).
51
- * If there's already open connection, the new one gets closed automatically.
52
- *
53
- * @param socket Incoming debugger WebSocket connection.
54
- */
55
- onDebuggerConnection(socket: WebSocket): void;
56
- /**
57
- * Process new WebSocket connection from React Native app (client)
58
- * and close any previous connection.
59
- *
60
- * @param socket Incoming client WebSocket connection.
61
- */
62
- onClientConnection(socket: WebSocket): void;
63
- }
@@ -1,129 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebSocketDebuggerServer = void 0;
4
- const web_socket_server_1 = require("../web-socket-server");
5
- /**
6
- * Class for creating a WebSocket server and providing a bridge between
7
- * debugger UI (Remote JS debugger) and the running React Native application.
8
- *
9
- * React Native application (aka client) will send and receive messages from the debugger UI
10
- * which runs inside a browser.
11
- *
12
- * @category Development server
13
- */
14
- class WebSocketDebuggerServer extends web_socket_server_1.WebSocketServer {
15
- /**
16
- * A WebSocket connection with the debugger UI.
17
- */
18
- debuggerSocket;
19
- /**
20
- * A WebSocket connection with the client (React Native app).
21
- */
22
- clientSocket;
23
- /**
24
- * Create new instance of WebSocketDebuggerServer and attach it to the given Fastify instance.
25
- * Any logging information, will be passed through standard `fastify.log` API.
26
- *
27
- * @param fastify Fastify instance to attach the WebSocket server to.
28
- */
29
- constructor(fastify) {
30
- super(fastify, "/debugger-proxy");
31
- }
32
- /**
33
- * Check if debugger UI is connected to the WebSocketDebuggerServer.
34
- */
35
- isDebuggerConnected() {
36
- return Boolean(this.debuggerSocket);
37
- }
38
- /**
39
- * Send a message to a given WebSocket connection.
40
- *
41
- * @param socket WebSocket connection to send the message to.
42
- * @param message Message to send.
43
- */
44
- send(socket, message) {
45
- try {
46
- socket?.send(message);
47
- }
48
- catch (error) {
49
- this.fastify.log.warn({ msg: "Failed to send data to socket", error });
50
- }
51
- }
52
- /**
53
- * Process new WebSocket connection. The upgrade request should contain `role` query param
54
- * for determining the type of the connection.
55
- *
56
- * @param socket Incoming WebSocket connection.
57
- * @param request Upgrade request for the connection.
58
- */
59
- onConnection(socket, request) {
60
- console.log("WebSocketDebuggerServer onConnection");
61
- const { url = "" } = request;
62
- if (url.indexOf("role=debugger") >= 0) {
63
- this.fastify.log.info({ msg: "Remote debugger connected" });
64
- this.onDebuggerConnection(socket);
65
- }
66
- else if (url.indexOf("role=client") >= 0) {
67
- this.fastify.log.info({ msg: "React Native app connected to debugger" });
68
- this.onClientConnection(socket);
69
- }
70
- else {
71
- socket.close(1011, "Missing role param");
72
- }
73
- }
74
- /**
75
- * Process new WebSocket connection from Debugger UI (Remote JS Debugger).
76
- * If there's already open connection, the new one gets closed automatically.
77
- *
78
- * @param socket Incoming debugger WebSocket connection.
79
- */
80
- onDebuggerConnection(socket) {
81
- if (this.debuggerSocket) {
82
- socket.close(1011, "Another debugger is already connected");
83
- return;
84
- }
85
- this.debuggerSocket = socket;
86
- const onClose = () => {
87
- this.fastify.log.info({ msg: "Remote debugger disconnected" });
88
- this.debuggerSocket = undefined;
89
- if (this.clientSocket) {
90
- this.clientSocket.removeAllListeners();
91
- this.clientSocket.close(1011, "Debugger was disconnected");
92
- }
93
- };
94
- this.debuggerSocket.addEventListener("error", onClose);
95
- this.debuggerSocket.addEventListener("close", onClose);
96
- this.debuggerSocket.addEventListener("message", ({ data }) => {
97
- this.send(this.clientSocket, data.toString());
98
- });
99
- }
100
- /**
101
- * Process new WebSocket connection from React Native app (client)
102
- * and close any previous connection.
103
- *
104
- * @param socket Incoming client WebSocket connection.
105
- */
106
- onClientConnection(socket) {
107
- console.log("WebSocketDebuggerServer onClientConnection");
108
- if (this.clientSocket) {
109
- this.clientSocket.removeAllListeners();
110
- this.clientSocket.close(1011, "Another client is connected");
111
- this.clientSocket = undefined;
112
- }
113
- const onClose = () => {
114
- this.fastify.log.info({
115
- msg: "React Native app disconnected from debugger",
116
- });
117
- this.clientSocket = undefined;
118
- this.send(this.debuggerSocket, JSON.stringify({ method: "$disconnected" }));
119
- };
120
- this.clientSocket = socket;
121
- this.clientSocket.addEventListener("error", onClose);
122
- this.clientSocket.addEventListener("close", onClose);
123
- this.clientSocket.addEventListener("message", ({ data }) => {
124
- this.send(this.debuggerSocket, data.toString());
125
- });
126
- }
127
- }
128
- exports.WebSocketDebuggerServer = WebSocketDebuggerServer;
129
- //# sourceMappingURL=web-socket-debugger.server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"web-socket-debugger.server.js","sourceRoot":"","sources":["../../../../../../../src/modules/dev/dev-server/plugins/wss/servers/web-socket-debugger.server.ts"],"names":[],"mappings":";;;AAGA,4DAAuD;AAEvD;;;;;;;;GAQG;AACH,MAAa,uBAAwB,SAAQ,mCAAe;IAC3D;;OAEG;IACK,cAAc,CAAwB;IAE9C;;OAEG;IACK,YAAY,CAAwB;IAE5C;;;;;OAKG;IACH,YAAY,OAAwB;QACnC,KAAK,CAAC,OAAO,E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AAE;YACpB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;gBACrB,GAAG,EAAE,6CAA6C;aAClD,CAAC,CAAC;YACH,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;YAC9B,IAAI,CAAC,IAAI,CACR,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC,CAC3C,CAAC;QACH,CAAC,CAAC;QAEF,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;QAC3B,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrD,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrD,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;YAC1D,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AA3HD,0DA2HC"}
@@ -1,32 +0,0 @@
1
- import type { FastifyInstance } from "fastify";
2
- import type WebSocket from "ws";
3
- import { WebSocketServer } from "../web-socket-server";
4
- /**
5
- * Class for creating a WebSocket server for communication with React Native clients.
6
- * All client logs - logs from React Native application - are processed here.
7
- *
8
- * @category Development server
9
- */
10
- export declare class WebSocketDevClientServer extends WebSocketServer {
11
- private clients;
12
- private nextClientId;
13
- /**
14
- * Create new instance of WebSocketDevClientServer and attach it to the given Fastify instance.
15
- * Any logging information, will be passed through standard `fastify.log` API.
16
- *
17
- * @param fastify Fastify instance to attach the WebSocket server to.
18
- */
19
- constructor(fastify: FastifyInstance);
20
- /**
21
- * Process client message.
22
- *
23
- * @param message Stringified client message.
24
- */
25
- processMessage(message: string): void;
26
- /**
27
- * Process new WebSocket connection from client application.
28
- *
29
- * @param socket Incoming client's WebSocket connection.
30
- */
31
- onConnection(socket: WebSocket): void;
32
- }
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebSocketDevClientServer = void 0;
4
- const web_socket_server_1 = require("../web-socket-server");
5
- /**
6
- * Class for creating a WebSocket server for communication with React Native clients.
7
- * All client logs - logs from React Native application - are processed here.
8
- *
9
- * @category Development server
10
- */
11
- class WebSocketDevClientServer extends web_socket_server_1.WebSocketServer {
12
- clients = new Map();
13
- nextClientId = 0;
14
- /**
15
- * Create new instance of WebSocketDevClientServer and attach it to the given Fastify instance.
16
- * Any logging information, will be passed through standard `fastify.log` API.
17
- *
18
- * @param fastify Fastify instance to attach the WebSocket server to.
19
- */
20
- constructor(fastify) {
21
- super(fastify, "/__client");
22
- }
23
- /**
24
- * Process client message.
25
- *
26
- * @param message Stringified client message.
27
- */
28
- processMessage(message) {
29
- console.log("WebSocketDevClientServer processMessage", message);
30
- const { type, ...body } = JSON.parse(message);
31
- switch (type) {
32
- case "client-log":
33
- if (body.level === "error") {
34
- this.fastify.log.error({ issuer: "Console", msg: body.data });
35
- }
36
- else if (body.level === "warn") {
37
- this.fastify.log.warn({ issuer: "Console", msg: body.data });
38
- }
39
- else if (body.level === "info" || body.level === "log") {
40
- this.fastify.log.info({ issuer: "Console", msg: body.data });
41
- }
42
- else {
43
- // body.level === 'debug' || body.level === 'trace'
44
- this.fastify.log.debug({ issuer: "Console", msg: body.data });
45
- }
46
- break;
47
- default:
48
- this.fastify.log.warn({ msg: "Unknown client message", message });
49
- }
50
- }
51
- /**
52
- * Process new WebSocket connection from client application.
53
- *
54
- * @param socket Incoming client's WebSocket connection.
55
- */
56
- onConnection(socket) {
57
- const clientId = `client#${this.nextClientId++}`;
58
- console.log("WebSocketDevClientServer onConnection", clientId);
59
- this.clients.set(clientId, socket);
60
- this.fastify.log.debug({ msg: "React Native client connected", clientId });
61
- const onClose = () => {
62
- this.fastify.log.debug({
63
- msg: "React Native client disconnected",
64
- clientId,
65
- });
66
- this.clients.delete(clientId);
67
- };
68
- socket.addEventListener("error", onClose);
69
- socket.addEventListener("close", onClose);
70
- socket.addEventListener("message", (event) => {
71
- this.processMessage(event.data.toString());
72
- });
73
- }
74
- }
75
- exports.WebSocketDevClientServer = WebSocketDevClientServer;
76
- //# sourceMappingURL=web-socket-dev-client.server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"web-socket-dev-client.server.js","sourceRoot":"","sources":["../../../../../../../src/modules/dev/dev-server/plugins/wss/servers/web-socket-dev-client.server.ts"],"names":[],"mappings":";;;AAEA,4DAAuD;AAEvD;;;;;GAKG;AACH,MAAa,wBAAyB,SAAQ,mCAAe;IACpD,OAAO,GAAG,IAAI,GAAG,EAAqB,CAAC;IACvC,YAAY,GAAG,CAAC,CAAC;IAEzB;;;;;OAKG;IACH,YAAY,OAAwB;QACnC,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,OAAe;QAC7B,OAAO,CAAC,GAAG,CAAC,yCAAyC,EAAE,OAAO,CAAC,CAAC;QAChE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9C,QAAQ,IAAI,EAAE,CAAC;YACd,KAAK,YAAY;gBAChB,IAAI,IAAI,CAAC,KAAK,KAAK,OAAO,EAAE,CAAC;oBAC5B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC/D,CAAC;qBAAM,IAAI,IAAI,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;oBAClC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,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