nativescript 9.0.0-alpha.2 → 9.0.0-alpha.4

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 (326) hide show
  1. package/lib/android-tools-info.js +12 -0
  2. package/lib/base-package-manager.js +7 -0
  3. package/lib/bootstrap.js +5 -1
  4. package/lib/bun-package-manager.js +14 -1
  5. package/lib/color.js +3 -0
  6. package/lib/commands/add-platform.js +1 -0
  7. package/lib/commands/apple-login.js +1 -0
  8. package/lib/commands/appstore-list.js +1 -0
  9. package/lib/commands/appstore-upload.js +3 -0
  10. package/lib/commands/build.js +3 -2
  11. package/lib/commands/clean.js +22 -1
  12. package/lib/commands/command-base.js +1 -0
  13. package/lib/commands/config.js +4 -0
  14. package/lib/commands/create-project.js +6 -0
  15. package/lib/commands/debug.js +6 -1
  16. package/lib/commands/deploy.js +3 -2
  17. package/lib/commands/embedding/embed.js +7 -0
  18. package/lib/commands/extensibility/install-extension.js +1 -0
  19. package/lib/commands/extensibility/list-extensions.js +1 -0
  20. package/lib/commands/extensibility/uninstall-extension.js +1 -0
  21. package/lib/commands/fonts.js +1 -0
  22. package/lib/commands/generate-assets.js +1 -0
  23. package/lib/commands/generate-help.js +1 -0
  24. package/lib/commands/generate.js +48 -1
  25. package/lib/commands/info.js +1 -0
  26. package/lib/commands/install.js +1 -0
  27. package/lib/commands/list-platforms.js +1 -0
  28. package/lib/commands/migrate.js +1 -0
  29. package/lib/commands/native-add.js +5 -0
  30. package/lib/commands/platform-clean.js +1 -0
  31. package/lib/commands/plugin/add-plugin.js +1 -0
  32. package/lib/commands/plugin/build-plugin.js +1 -0
  33. package/lib/commands/plugin/create-plugin.js +5 -0
  34. package/lib/commands/plugin/list-plugins.js +1 -0
  35. package/lib/commands/plugin/remove-plugin.js +2 -0
  36. package/lib/commands/plugin/update-plugin.js +1 -0
  37. package/lib/commands/post-install.js +6 -0
  38. package/lib/commands/prepare.js +4 -3
  39. package/lib/commands/preview.js +2 -0
  40. package/lib/commands/remove-platform.js +1 -0
  41. package/lib/commands/resources/resources-update.js +2 -0
  42. package/lib/commands/run.js +1 -0
  43. package/lib/commands/setup.js +1 -0
  44. package/lib/commands/start.js +1 -0
  45. package/lib/commands/test-init.js +4 -0
  46. package/lib/commands/test.js +9 -2
  47. package/lib/commands/typings.js +2 -1
  48. package/lib/commands/update-platform.js +5 -0
  49. package/lib/commands/update.js +2 -0
  50. package/lib/commands/widget.js +20 -1
  51. package/lib/common/bootstrap.js +1 -0
  52. package/lib/common/child-process.js +3 -0
  53. package/lib/common/codeGeneration/code-entity.js +1 -0
  54. package/lib/common/codeGeneration/code-printer.js +1 -0
  55. package/lib/common/command-params.js +1 -0
  56. package/lib/common/commands/analytics.js +3 -0
  57. package/lib/common/commands/autocompletion.js +3 -0
  58. package/lib/common/commands/device/device-log-stream.js +1 -0
  59. package/lib/common/commands/device/get-file.js +2 -0
  60. package/lib/common/commands/device/list-applications.js +1 -0
  61. package/lib/common/commands/device/list-devices.js +3 -0
  62. package/lib/common/commands/device/list-files.js +2 -0
  63. package/lib/common/commands/device/put-file.js +2 -0
  64. package/lib/common/commands/device/run-application.js +1 -0
  65. package/lib/common/commands/device/stop-application.js +1 -0
  66. package/lib/common/commands/device/uninstall-application.js +1 -0
  67. package/lib/common/commands/doctor.js +3 -2
  68. package/lib/common/commands/generate-messages.js +1 -0
  69. package/lib/common/commands/help.js +1 -0
  70. package/lib/common/commands/package-manager-get.js +1 -0
  71. package/lib/common/commands/package-manager-set.js +1 -0
  72. package/lib/common/commands/post-install.js +1 -0
  73. package/lib/common/commands/preuninstall.js +11 -2
  74. package/lib/common/commands/proxy/proxy-base.js +4 -0
  75. package/lib/common/commands/proxy/proxy-clear.js +1 -0
  76. package/lib/common/commands/proxy/proxy-get.js +1 -0
  77. package/lib/common/commands/proxy/proxy-set.js +1 -0
  78. package/lib/common/common-lib.js +1 -0
  79. package/lib/common/constants.js +11 -0
  80. package/lib/common/decorators.js +48 -0
  81. package/lib/common/dispatchers.js +10 -1
  82. package/lib/common/errors.js +13 -3
  83. package/lib/common/file-system.js +13 -2
  84. package/lib/common/header.js +3 -0
  85. package/lib/common/helpers.js +89 -3
  86. package/lib/common/host-info.js +4 -0
  87. package/lib/common/http-client.js +20 -0
  88. package/lib/common/logger/appenders/cli-appender.js +4 -0
  89. package/lib/common/logger/appenders/emit-appender.js +4 -0
  90. package/lib/common/logger/layouts/cli-layout.js +1 -0
  91. package/lib/common/logger/logger.js +5 -0
  92. package/lib/common/messages/messages.js +6 -0
  93. package/lib/common/mobile/android/android-application-manager.js +20 -1
  94. package/lib/common/mobile/android/android-debug-bridge-result-handler.js +1 -0
  95. package/lib/common/mobile/android/android-debug-bridge.js +6 -0
  96. package/lib/common/mobile/android/android-device-file-system.js +4 -0
  97. package/lib/common/mobile/android/android-device-hash-service.js +3 -0
  98. package/lib/common/mobile/android/android-device.js +8 -0
  99. package/lib/common/mobile/android/android-emulator-services.js +11 -8
  100. package/lib/common/mobile/android/android-ini-file-parser.js +9 -0
  101. package/lib/common/mobile/android/android-log-filter.js +4 -0
  102. package/lib/common/mobile/android/android-virtual-device-service.js +26 -0
  103. package/lib/common/mobile/android/device-android-debug-bridge.js +1 -0
  104. package/lib/common/mobile/android/genymotion/genymotion-service.js +6 -1
  105. package/lib/common/mobile/android/genymotion/virtualbox-service.js +11 -0
  106. package/lib/common/mobile/android/logcat-helper.js +13 -0
  107. package/lib/common/mobile/application-manager-base.js +6 -0
  108. package/lib/common/mobile/device-emitter.js +4 -0
  109. package/lib/common/mobile/device-log-emitter.js +1 -0
  110. package/lib/common/mobile/device-log-provider-base.js +1 -0
  111. package/lib/common/mobile/device-log-provider.js +23 -0
  112. package/lib/common/mobile/device-platforms-constants.js +1 -0
  113. package/lib/common/mobile/emulator-helper.js +4 -0
  114. package/lib/common/mobile/ios/device/ios-application-manager.js +3 -0
  115. package/lib/common/mobile/ios/device/ios-device-file-system.js +1 -0
  116. package/lib/common/mobile/ios/device/ios-device-operations.js +4 -0
  117. package/lib/common/mobile/ios/device/ios-device.js +4 -0
  118. package/lib/common/mobile/ios/ios-device-base.js +1 -0
  119. package/lib/common/mobile/ios/ios-device-product-name-mapper.js +2 -0
  120. package/lib/common/mobile/ios/ios-log-filter.js +1 -0
  121. package/lib/common/mobile/ios/simulator/ios-emulator-services.js +4 -0
  122. package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +1 -0
  123. package/lib/common/mobile/ios/simulator/ios-simulator-application-manager.js +6 -0
  124. package/lib/common/mobile/ios/simulator/ios-simulator-device.js +5 -0
  125. package/lib/common/mobile/ios/simulator/ios-simulator-file-system.js +1 -0
  126. package/lib/common/mobile/ios/simulator/ios-simulator-log-provider.js +1 -0
  127. package/lib/common/mobile/local-to-device-path-data-factory.js +1 -0
  128. package/lib/common/mobile/log-filter.js +2 -0
  129. package/lib/common/mobile/logging-levels.js +1 -0
  130. package/lib/common/mobile/mobile-core/android-device-discovery.js +2 -0
  131. package/lib/common/mobile/mobile-core/android-emulator-discovery.js +3 -0
  132. package/lib/common/mobile/mobile-core/android-process-service.js +32 -0
  133. package/lib/common/mobile/mobile-core/device-discovery.js +1 -0
  134. package/lib/common/mobile/mobile-core/devices-service.js +69 -0
  135. package/lib/common/mobile/mobile-core/ios-device-discovery.js +2 -0
  136. package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +3 -0
  137. package/lib/common/mobile/mobile-helper.js +1 -0
  138. package/lib/common/mobile/wp8/wp8-emulator-services.js +1 -0
  139. package/lib/common/opener.js +1 -0
  140. package/lib/common/os-info.js +1 -0
  141. package/lib/common/plist-parser.js +1 -0
  142. package/lib/common/project-helper.js +1 -0
  143. package/lib/common/prompter.js +9 -1
  144. package/lib/common/queue.js +1 -0
  145. package/lib/common/resource-loader.js +1 -0
  146. package/lib/common/services/auto-completion-service.js +13 -1
  147. package/lib/common/services/cancellation.js +2 -1
  148. package/lib/common/services/commands-service.js +17 -6
  149. package/lib/common/services/help-service.js +11 -3
  150. package/lib/common/services/hooks-service.js +14 -1
  151. package/lib/common/services/ios-notification-service.js +1 -0
  152. package/lib/common/services/json-file-settings-service.js +6 -0
  153. package/lib/common/services/lock-service.js +6 -0
  154. package/lib/common/services/message-contract-generator.js +1 -0
  155. package/lib/common/services/messages-service.js +1 -0
  156. package/lib/common/services/micro-templating-service.js +6 -0
  157. package/lib/common/services/net-service.js +3 -0
  158. package/lib/common/services/project-files-manager.js +5 -0
  159. package/lib/common/services/project-files-provider-base.js +1 -0
  160. package/lib/common/services/proxy-service.js +1 -0
  161. package/lib/common/services/qr.js +1 -0
  162. package/lib/common/services/settings-service.js +1 -0
  163. package/lib/common/services/xcode-select-service.js +1 -0
  164. package/lib/common/utils.js +1 -0
  165. package/lib/common/validators/project-name-validator.js +1 -0
  166. package/lib/common/validators/validation-result.js +1 -0
  167. package/lib/common/verify-node-version.js +8 -1
  168. package/lib/common/yok.js +32 -11
  169. package/lib/config.js +22 -1
  170. package/lib/constants-provider.js +1 -0
  171. package/lib/constants.js +53 -0
  172. package/lib/controllers/build-controller.js +4 -3
  173. package/lib/controllers/debug-controller.js +8 -3
  174. package/lib/controllers/deploy-controller.js +1 -0
  175. package/lib/controllers/migrate-controller.js +90 -4
  176. package/lib/controllers/platform-controller.js +9 -1
  177. package/lib/controllers/prepare-controller.js +17 -4
  178. package/lib/controllers/run-controller.js +17 -1
  179. package/lib/controllers/update-controller-base.js +1 -0
  180. package/lib/controllers/update-controller.js +11 -0
  181. package/lib/data/build-data.js +1 -0
  182. package/lib/data/controller-data-base.js +1 -0
  183. package/lib/data/debug-data.js +1 -0
  184. package/lib/data/platform-data.js +1 -0
  185. package/lib/data/prepare-data.js +1 -0
  186. package/lib/data/run-data.js +1 -0
  187. package/lib/detached-processes/cleanup-js-subprocess.js +8 -2
  188. package/lib/detached-processes/cleanup-process.js +18 -14
  189. package/lib/detached-processes/file-log-service.js +2 -1
  190. package/lib/device-path-provider.js +1 -0
  191. package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +7 -0
  192. package/lib/device-sockets/ios/notification.js +3 -0
  193. package/lib/device-sockets/ios/socket-request-executor.js +3 -0
  194. package/lib/helpers/android-bundle-validator-helper.js +2 -1
  195. package/lib/helpers/deploy-command-helper.js +1 -0
  196. package/lib/helpers/key-command-helper.js +4 -2
  197. package/lib/helpers/livesync-command-helper.js +4 -1
  198. package/lib/helpers/network-connectivity-validator.js +1 -0
  199. package/lib/helpers/options-track-helper.js +3 -2
  200. package/lib/helpers/package-path-helper.js +1 -0
  201. package/lib/helpers/platform-command-helper.js +7 -2
  202. package/lib/helpers/version-validator-helper.js +1 -0
  203. package/lib/key-commands/bootstrap.js +3 -2
  204. package/lib/key-commands/index.js +5 -4
  205. package/lib/nativescript-cli-lib-bootstrap.js +4 -0
  206. package/lib/nativescript-cli-lib.js +1 -0
  207. package/lib/nativescript-cli.js +10 -1
  208. package/lib/node/pbxproj-dom-xcode.js +1 -0
  209. package/lib/node/xcode.js +1 -0
  210. package/lib/node-package-manager.js +11 -1
  211. package/lib/options.js +144 -119
  212. package/lib/package-installation-manager.js +8 -1
  213. package/lib/package-manager.js +2 -0
  214. package/lib/platform-command-param.js +1 -0
  215. package/lib/pnpm-package-manager.js +4 -1
  216. package/lib/project-data.js +12 -0
  217. package/lib/providers/project-files-provider.js +1 -0
  218. package/lib/resolvers/livesync-service-resolver.js +1 -0
  219. package/lib/services/analytics/analytics-broker-process.js +10 -6
  220. package/lib/services/analytics/analytics-broker.js +2 -1
  221. package/lib/services/analytics/analytics-service.js +29 -25
  222. package/lib/services/analytics/google-analytics-provider.js +13 -12
  223. package/lib/services/analytics-settings-service.js +5 -0
  224. package/lib/services/android/android-bundle-tool-service.js +1 -0
  225. package/lib/services/android/gradle-build-args-service.js +3 -0
  226. package/lib/services/android/gradle-build-service.js +1 -0
  227. package/lib/services/android/gradle-command-service.js +1 -0
  228. package/lib/services/android-device-debug-service.js +6 -0
  229. package/lib/services/android-plugin-build-service.js +31 -2
  230. package/lib/services/android-project-service.js +71 -4
  231. package/lib/services/android-resources-migration-service.js +7 -0
  232. package/lib/services/apple-portal/apple-portal-application-service.js +1 -0
  233. package/lib/services/apple-portal/apple-portal-cookie-service.js +1 -0
  234. package/lib/services/apple-portal/apple-portal-session-service.js +6 -4
  235. package/lib/services/apple-portal/srp/srp-wrapper.js +4 -1
  236. package/lib/services/assets-generation/assets-generation-service.js +10 -5
  237. package/lib/services/build-artifacts-service.js +2 -1
  238. package/lib/services/build-data-service.js +1 -0
  239. package/lib/services/build-info-file-service.js +1 -0
  240. package/lib/services/bundler/bundler-compiler-service.js +45 -1
  241. package/lib/services/bundler/bundler.js +1 -0
  242. package/lib/services/cleanup-service.js +13 -9
  243. package/lib/services/cocoapods-platform-manager.js +9 -0
  244. package/lib/services/cocoapods-service.js +21 -1
  245. package/lib/services/debug-data-service.js +1 -0
  246. package/lib/services/debug-service-base.js +7 -0
  247. package/lib/services/device/device-install-app-service.js +2 -1
  248. package/lib/services/doctor-service.js +21 -6
  249. package/lib/services/extensibility-service.js +8 -0
  250. package/lib/services/files-hash-service.js +1 -0
  251. package/lib/services/hmr-status-service.js +2 -0
  252. package/lib/services/info-service.js +1 -0
  253. package/lib/services/initialize-service.js +5 -1
  254. package/lib/services/ios/export-options-plist-service.js +4 -0
  255. package/lib/services/ios/ios-signing-service.js +4 -0
  256. package/lib/services/ios/spm-service.js +11 -0
  257. package/lib/services/ios/xcodebuild-args-service.js +9 -0
  258. package/lib/services/ios/xcodebuild-command-service.js +1 -0
  259. package/lib/services/ios/xcodebuild-service.js +2 -1
  260. package/lib/services/ios-debugger-port-service.js +1 -0
  261. package/lib/services/ios-device-debug-service.js +1 -0
  262. package/lib/services/ios-entitlements-service.js +1 -0
  263. package/lib/services/ios-extensions-service.js +1 -0
  264. package/lib/services/ios-log-filter.js +20 -0
  265. package/lib/services/ios-native-target-service.js +6 -4
  266. package/lib/services/ios-project-service.js +91 -1
  267. package/lib/services/ios-provision-service.js +3 -0
  268. package/lib/services/ios-watch-app-service.js +1 -0
  269. package/lib/services/ip-service.js +2 -0
  270. package/lib/services/itmstransporter-service.js +1 -0
  271. package/lib/services/karma-execution.js +2 -0
  272. package/lib/services/livesync/android-device-livesync-service-base.js +1 -0
  273. package/lib/services/livesync/android-device-livesync-service.js +2 -0
  274. package/lib/services/livesync/android-device-livesync-sockets-service.js +3 -0
  275. package/lib/services/livesync/android-livesync-service.js +1 -0
  276. package/lib/services/livesync/android-livesync-tool.js +4 -0
  277. package/lib/services/livesync/device-livesync-service-base.js +2 -0
  278. package/lib/services/livesync/ios-device-livesync-service.js +7 -0
  279. package/lib/services/livesync/ios-livesync-service.js +2 -0
  280. package/lib/services/livesync/livesync-socket.js +1 -0
  281. package/lib/services/livesync/platform-livesync-service-base.js +5 -0
  282. package/lib/services/livesync-process-data-service.js +1 -0
  283. package/lib/services/log-parser-service.js +1 -0
  284. package/lib/services/log-source-map-service.js +15 -0
  285. package/lib/services/marking-mode-service.js +8 -5
  286. package/lib/services/metadata-filtering-service.js +1 -0
  287. package/lib/services/npm-config-service.js +4 -0
  288. package/lib/services/pacote-service.js +7 -0
  289. package/lib/services/performance-service.js +3 -1
  290. package/lib/services/platform/add-platform-service.js +49 -2
  291. package/lib/services/platform/platform-validation-service.js +1 -0
  292. package/lib/services/platform/prepare-native-platform-service.js +5 -2
  293. package/lib/services/platform-environment-requirements.js +8 -3
  294. package/lib/services/platform-project-service-base.js +1 -0
  295. package/lib/services/platforms-data-service.js +1 -0
  296. package/lib/services/plugins-service.js +20 -2
  297. package/lib/services/prepare-data-service.js +1 -0
  298. package/lib/services/project-backup-service.js +4 -0
  299. package/lib/services/project-changes-service.js +14 -3
  300. package/lib/services/project-cleanup-service.js +2 -0
  301. package/lib/services/project-config-service.js +21 -2
  302. package/lib/services/project-data-service.js +36 -7
  303. package/lib/services/project-name-service.js +1 -0
  304. package/lib/services/project-service.js +10 -0
  305. package/lib/services/project-templates-service.js +3 -2
  306. package/lib/services/qr-code-terminal-service.js +1 -0
  307. package/lib/services/require-service.js +1 -0
  308. package/lib/services/start-service.js +1 -0
  309. package/lib/services/temp-service.js +1 -0
  310. package/lib/services/terminal-spinner-service.js +2 -0
  311. package/lib/services/test-execution-service.js +9 -2
  312. package/lib/services/test-initialization-service.js +4 -0
  313. package/lib/services/timeline-profiler-service.js +1 -0
  314. package/lib/services/user-settings-service.js +1 -0
  315. package/lib/services/versions-service.js +6 -4
  316. package/lib/services/watch-ignore-list-service.js +1 -0
  317. package/lib/services/xcconfig-service.js +2 -0
  318. package/lib/services/xcproj-service.js +1 -0
  319. package/lib/shared-event-bus.js +6 -0
  320. package/lib/sys-info.js +2 -1
  321. package/lib/tools/config-manipulation/config-transformer.js +12 -0
  322. package/lib/tools/node-modules/node-modules-builder.js +1 -0
  323. package/lib/tools/node-modules/node-modules-dependencies-builder.js +6 -0
  324. package/lib/yarn-package-manager.js +1 -0
  325. package/lib/yarn2-package-manager.js +3 -0
  326. package/package.json +6 -4
@@ -40,6 +40,7 @@ class LogcatHelper {
40
40
  }
41
41
  }
42
42
  catch (err) {
43
+ // Ignore the error, the process is dead.
43
44
  }
44
45
  });
45
46
  lineStream.on("data", (lineBuffer) => {
@@ -60,6 +61,7 @@ class LogcatHelper {
60
61
  return;
61
62
  const lines = (lineBuffer.toString() || "").split("\n");
62
63
  for (let line of lines) {
64
+ // 2024-06-26 16:43:22.286 630-659 ActivityManager system_server I Start proc 8854:org.nativescript.uitestsapp/u0a190 for next-top-activity {org.nativescript.uitestsapp/com.tns.NativeScriptActivity}
63
65
  const startProc = /Start proc (?<pid>[0-9]+):(?<appId>.+?)\//.exec(line);
64
66
  if (startProc &&
65
67
  ((_b = startProc.groups) === null || _b === void 0 ? void 0 : _b.appId) === options.appId &&
@@ -86,6 +88,9 @@ class LogcatHelper {
86
88
  lineStream.removeAllListeners();
87
89
  });
88
90
  }
91
+ /**
92
+ * Stops the logcat process for the specified device if keepSingleProcess is not passed on start
93
+ */
89
94
  stop(deviceIdentifier) {
90
95
  if (this.mapDevicesLoggingData[deviceIdentifier] &&
91
96
  !this.mapDevicesLoggingData[deviceIdentifier].keepSingleProcess) {
@@ -102,6 +107,9 @@ class LogcatHelper {
102
107
  (_e = loggingData.lineStream) === null || _e === void 0 ? void 0 : _e.removeAllListeners();
103
108
  delete this.mapDevicesLoggingData[deviceIdentifier];
104
109
  }
110
+ /**
111
+ * @deprecated - we likely don't need this anymore, and can simplify the code...
112
+ */
105
113
  async isLogcatPidSupported(deviceIdentifier) {
106
114
  const device = await this.$devicesService.getDevice(deviceIdentifier);
107
115
  const minAndroidWithLogcatPidSupport = "7.0.0";
@@ -111,6 +119,7 @@ class LogcatHelper {
111
119
  async getLogcatStream(deviceIdentifier, pid) {
112
120
  const isLogcatPidSupported = await this.isLogcatPidSupported(deviceIdentifier);
113
121
  const adb = this.$injector.resolve(device_android_debug_bridge_1.DeviceAndroidDebugBridge, { identifier: deviceIdentifier });
122
+ // -T 1 - shows only new logs after starting adb logcat
114
123
  const logcatCommand = ["logcat", "-T", "1"];
115
124
  const acceptedTags = [
116
125
  "chromium",
@@ -123,6 +132,7 @@ class LogcatHelper {
123
132
  if (pid && isLogcatPidSupported) {
124
133
  logcatCommand.push(`--pid=${pid}`);
125
134
  acceptedTags.forEach((tag) => {
135
+ // -s <tag> - shows only logs with the specified tag
126
136
  logcatCommand.push("-s", tag);
127
137
  });
128
138
  }
@@ -133,6 +143,8 @@ class LogcatHelper {
133
143
  }
134
144
  async getAppStartTrackingLogcatStream(deviceIdentifier, appId) {
135
145
  const adb = this.$injector.resolve(device_android_debug_bridge_1.DeviceAndroidDebugBridge, { identifier: deviceIdentifier });
146
+ // -b system - shows the system buffer/logs only
147
+ // -T 1 - shows only new logs after starting adb logcat
136
148
  const logcatCommand = [
137
149
  `logcat`,
138
150
  `-b`,
@@ -153,3 +165,4 @@ class LogcatHelper {
153
165
  }
154
166
  exports.LogcatHelper = LogcatHelper;
155
167
  yok_1.injector.register("logcatHelper", LogcatHelper);
168
+ //# sourceMappingURL=logcat-helper.js.map
@@ -36,6 +36,9 @@ class ApplicationManagerBase extends events_1.EventEmitter {
36
36
  if (!this.checkForApplicationUpdatesPromise) {
37
37
  this.checkForApplicationUpdatesPromise = new Promise(async (resolve, reject) => {
38
38
  let isFulfilled = false;
39
+ // As this method is called on 500ms, but it's execution may last much longer
40
+ // use locking, so the next executions will not get into the body, while the first one is still working.
41
+ // In case we do not break the next executions, we'll report each app as newly installed several times.
39
42
  try {
40
43
  const currentlyInstalledAppIdentifiers = await this.getInstalledApplications();
41
44
  const previouslyInstalledAppIdentifiers = this.lastInstalledAppIdentifiers || [];
@@ -80,6 +83,7 @@ class ApplicationManagerBase extends events_1.EventEmitter {
80
83
  _.each(notAvailableAppsForDebugging, (appInfo) => {
81
84
  this.emit("debuggableAppLost", appInfo);
82
85
  if (_.has(this.lastAvailableDebuggableAppViews, appInfo.appIdentifier)) {
86
+ // Prevent emitting debuggableViewLost when application cannot be debugged anymore.
83
87
  delete this.lastAvailableDebuggableAppViews[appInfo.appIdentifier];
84
88
  }
85
89
  });
@@ -98,6 +102,7 @@ class ApplicationManagerBase extends events_1.EventEmitter {
98
102
  _.each(newAvailableViews, (debugWebViewInfo) => {
99
103
  this.emit("debuggableViewFound", appIdentifier, debugWebViewInfo);
100
104
  });
105
+ // Determine which of the views had changed since last check and raise debuggableViewChanged event for them:
101
106
  const keptViews = _.differenceBy(currentlyAvailableViews, newAvailableViews, "id");
102
107
  _.each(keptViews, (view) => {
103
108
  const previousTimeViewInfo = _.find(previouslyAvailableViews, (previousView) => previousView.id === view.id);
@@ -111,3 +116,4 @@ class ApplicationManagerBase extends events_1.EventEmitter {
111
116
  }
112
117
  }
113
118
  exports.ApplicationManagerBase = ApplicationManagerBase;
119
+ //# sourceMappingURL=application-manager-base.js.map
@@ -15,7 +15,10 @@ class DeviceEmitter extends events_1.EventEmitter {
15
15
  this.$devicesService.on(constants_1.DeviceDiscoveryEventNames.DEVICE_FOUND, (device) => {
16
16
  this.emit(constants_1.DeviceDiscoveryEventNames.DEVICE_FOUND, device.deviceInfo);
17
17
  this.attachApplicationChangedHandlers(device);
18
+ // await: Do not await as this will require to mark the lambda with async keyword, but there's no way to await the lambda itself.
19
+ /* tslint:disable:no-floating-promises */
18
20
  device.openDeviceLogStream();
21
+ /* tslint:enable:no-floating-promises */
19
22
  });
20
23
  this.$devicesService.on(constants_1.DeviceDiscoveryEventNames.DEVICE_LOST, (device) => {
21
24
  this.emit(constants_1.DeviceDiscoveryEventNames.DEVICE_LOST, device.deviceInfo);
@@ -59,3 +62,4 @@ class DeviceEmitter extends events_1.EventEmitter {
59
62
  }
60
63
  exports.DeviceEmitter = DeviceEmitter;
61
64
  yok_1.injector.register("deviceEmitter", DeviceEmitter);
65
+ //# sourceMappingURL=device-emitter.js.map
@@ -38,3 +38,4 @@ class DeviceLogEmitter extends device_log_provider_base_1.DeviceLogProviderBase
38
38
  }
39
39
  exports.DeviceLogEmitter = DeviceLogEmitter;
40
40
  yok_1.injector.register("deviceLogProvider", DeviceLogEmitter);
41
+ //# sourceMappingURL=device-log-emitter.js.map
@@ -63,3 +63,4 @@ class DeviceLogProviderBase extends events_1.EventEmitter {
63
63
  }
64
64
  }
65
65
  exports.DeviceLogProviderBase = DeviceLogProviderBase;
66
+ //# sourceMappingURL=device-log-provider-base.js.map
@@ -36,6 +36,7 @@ class DeviceLogProvider extends device_log_provider_base_1.DeviceLogProviderBase
36
36
  this.colorPoolIndex = 0;
37
37
  }
38
38
  logData(lineText, platform, deviceIdentifier) {
39
+ // console.log(lineText)
39
40
  const loggingOptions = this.getDeviceLogOptionsForDevice(deviceIdentifier);
40
41
  let data = this.$logFilter.filterData(platform, lineText, loggingOptions);
41
42
  data = this.$logSourceMapService.replaceWithOriginalFileLocations(platform, data, loggingOptions);
@@ -53,6 +54,7 @@ class DeviceLogProvider extends device_log_provider_base_1.DeviceLogProviderBase
53
54
  return this.deviceColorMap.get(deviceIdentifier);
54
55
  }
55
56
  const color = this.colorPool[this.colorPoolIndex];
57
+ // wrap around if we have no more colors in the pool
56
58
  this.colorPoolIndex =
57
59
  this.colorPoolIndex === this.colorPool.length - 1
58
60
  ? 0
@@ -62,10 +64,13 @@ class DeviceLogProvider extends device_log_provider_base_1.DeviceLogProviderBase
62
64
  }
63
65
  logDataCore(data, deviceIdentifier) {
64
66
  var _a, _b, _c;
67
+ // todo: use config to set logger - --env.classicLogs is temporary!
65
68
  if ("classicLogs" in ((_a = this.$options.env) !== null && _a !== void 0 ? _a : {})) {
69
+ // legacy logging
66
70
  this.$logger.info(data, { [constants_2.LoggerConfigData.skipNewLine]: true });
67
71
  return;
68
72
  }
73
+ // todo: extract into an injectable printer/logger service
69
74
  let shouldPrepend = false;
70
75
  let splitIndexes = [];
71
76
  const lines = data
@@ -120,7 +125,25 @@ class DeviceLogProvider extends device_log_provider_base_1.DeviceLogProviderBase
120
125
  printLine(prefix, ...parts) {
121
126
  const fullLine = parts.join(" ");
122
127
  console.log(prefix, fullLine);
128
+ /**
129
+ * Note: Disabled
130
+ *
131
+ * This splits the output into lines that fit within the current
132
+ * terminal width, however this makes copying json objects that
133
+ * span across multiple lines difficult, as it introduces
134
+ * whitespace & line breaks
135
+ */
136
+ // const maxWidth = process.stdout.columns - 2;
137
+ // if (!maxWidth || maxWidth < 10 || fullLine.length < maxWidth) {
138
+ // console.log(prefix, fullLine);
139
+ // } else {
140
+ // for (let i = 0; i < fullLine.length; i += maxWidth) {
141
+ // const part = fullLine.substring(i, i + maxWidth);
142
+ // console.log(prefix, part);
143
+ // }
144
+ // }
123
145
  }
124
146
  }
125
147
  exports.DeviceLogProvider = DeviceLogProvider;
126
148
  yok_1.injector.register("deviceLogProvider", DeviceLogProvider);
149
+ //# sourceMappingURL=device-log-provider.js.map
@@ -20,3 +20,4 @@ class DevicePlatformsConstants {
20
20
  }
21
21
  exports.DevicePlatformsConstants = DevicePlatformsConstants;
22
22
  yok_1.injector.register("devicePlatformsConstants", DevicePlatformsConstants);
23
+ //# sourceMappingURL=device-platforms-constants.js.map
@@ -6,7 +6,9 @@ const _ = require("lodash");
6
6
  const yok_1 = require("../yok");
7
7
  class EmulatorHelper {
8
8
  constructor() {
9
+ // https://developer.android.com/guide/topics/manifest/uses-sdk-element
9
10
  this.mapAndroidApiLevelToVersion = {
11
+ "android-36": "16.0.0",
10
12
  "android-35": "15.0.0",
11
13
  "android-34": "14.0.0",
12
14
  "android-33": "13.0.0",
@@ -79,7 +81,9 @@ class EmulatorHelper {
79
81
  emulator.identifier = emulatorId;
80
82
  emulator.status = constants_1.RUNNING_EMULATOR_STATUS;
81
83
  emulator.type = constants_1.DeviceTypes.Device;
84
+ //emulator.isTablet; // TODO: consider to do this here!!!
82
85
  }
83
86
  }
84
87
  exports.EmulatorHelper = EmulatorHelper;
85
88
  yok_1.injector.register("emulatorHelper", EmulatorHelper);
89
+ //# sourceMappingURL=emulator-helper.js.map
@@ -115,9 +115,11 @@ class IOSApplicationManager extends application_manager_base_1.ApplicationManage
115
115
  await this.device.openDeviceLogStream();
116
116
  }
117
117
  getDebuggableApps() {
118
+ // Implement when we can find debuggable applications for iOS.
118
119
  return Promise.resolve([]);
119
120
  }
120
121
  getDebuggableAppViews(appIdentifiers) {
122
+ // Implement when we can find debuggable applications for iOS.
121
123
  return Promise.resolve(null);
122
124
  }
123
125
  }
@@ -128,3 +130,4 @@ __decorate([
128
130
  __decorate([
129
131
  (0, decorators_1.cache)()
130
132
  ], IOSApplicationManager.prototype, "startDeviceLog", null);
133
+ //# sourceMappingURL=ios-application-manager.js.map
@@ -104,3 +104,4 @@ class IOSDeviceFileSystem {
104
104
  }
105
105
  exports.IOSDeviceFileSystem = IOSDeviceFileSystem;
106
106
  IOSDeviceFileSystem.AFC_DELETE_FILE_NOT_FOUND_ERROR = 8;
107
+ //# sourceMappingURL=ios-device-file-system.js.map
@@ -44,6 +44,7 @@ class IOSDeviceOperations extends events_1.EventEmitter {
44
44
  if (options && options.shouldReturnImmediateResult) {
45
45
  return;
46
46
  }
47
+ // We need this because we need to make sure that we have devices.
47
48
  await new Promise((resolve, reject) => {
48
49
  let iterationsCount = 0;
49
50
  const maxIterationsCount = 3;
@@ -125,6 +126,8 @@ class IOSDeviceOperations extends events_1.EventEmitter {
125
126
  return this.getMultipleResults(() => this.deviceLib.stop(stopArray), errorHandler);
126
127
  }
127
128
  dispose(signal) {
129
+ // We need to check if we should dispose the device lib.
130
+ // For example we do not want to dispose it when we start printing the device logs.
128
131
  if (this.shouldDispose && this.deviceLib) {
129
132
  this.deviceLib.removeAllListeners();
130
133
  this.deviceLib.dispose(signal);
@@ -195,3 +198,4 @@ __decorate([
195
198
  (0, decorators_1.cache)()
196
199
  ], IOSDeviceOperations.prototype, "attacheDeviceLogDataHandler", null);
197
200
  yok_1.injector.register("iosDeviceOperations", IOSDeviceOperations);
201
+ //# sourceMappingURL=ios-device-operations.js.map
@@ -106,6 +106,7 @@ class IOSDevice extends ios_device_base_1.IOSDeviceBase {
106
106
  const majorVersionAsString = productType.match(/.*?(\d+)\,(\d+)/)[1];
107
107
  const majorVersion = parseInt(majorVersionAsString);
108
108
  let isArm64Architecture = false;
109
+ //https://en.wikipedia.org/wiki/List_of_iOS_devices
109
110
  if (_.startsWith(productType, "iphone")) {
110
111
  isArm64Architecture = majorVersion >= 6;
111
112
  }
@@ -116,6 +117,7 @@ class IOSDevice extends ios_device_base_1.IOSDeviceBase {
116
117
  isArm64Architecture = majorVersion >= 7;
117
118
  }
118
119
  else if (_.startsWith(productType, "realitydevice")) {
120
+ // visionos
119
121
  isArm64Architecture = true;
120
122
  }
121
123
  activeArchitecture = isArm64Architecture ? "arm64" : "armv7";
@@ -125,6 +127,7 @@ class IOSDevice extends ios_device_base_1.IOSDeviceBase {
125
127
  getPlatform(productType) {
126
128
  productType = productType.toLowerCase().trim();
127
129
  if (_.startsWith(productType, "realitydevice")) {
130
+ // visionos
128
131
  return this.$devicePlatformsConstants.visionOS;
129
132
  }
130
133
  return this.$devicePlatformsConstants.iOS;
@@ -135,3 +138,4 @@ __decorate([
135
138
  (0, decorators_1.cache)()
136
139
  ], IOSDevice.prototype, "openDeviceLogStream", null);
137
140
  yok_1.injector.register("iOSDevice", IOSDevice);
141
+ //# sourceMappingURL=ios-device.js.map
@@ -83,3 +83,4 @@ exports.IOSDeviceBase = IOSDeviceBase;
83
83
  __decorate([
84
84
  (0, decorators_1.performanceLog)()
85
85
  ], IOSDeviceBase.prototype, "getDebugSocket", null);
86
+ //# sourceMappingURL=ios-device-base.js.map
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const yok_1 = require("../../yok");
4
4
  class IosDeviceProductNameMapper {
5
5
  constructor() {
6
+ // http://support.hockeyapp.net/kb/client-integration-ios-mac-os-x/ios-device-types
6
7
  this.map = {
7
8
  "iPhone1,1": "iPhone",
8
9
  "iPhone1,2": "iPhone 3G",
@@ -63,3 +64,4 @@ class IosDeviceProductNameMapper {
63
64
  }
64
65
  }
65
66
  yok_1.injector.register("iOSDeviceProductNameMapper", IosDeviceProductNameMapper);
67
+ //# sourceMappingURL=ios-device-product-name-mapper.js.map
@@ -22,3 +22,4 @@ class IOSLogFilter {
22
22
  }
23
23
  exports.IOSLogFilter = IOSLogFilter;
24
24
  yok_1.injector.register("iOSLogFilter", IOSLogFilter);
25
+ //# sourceMappingURL=ios-log-filter.js.map
@@ -18,6 +18,7 @@ class IosEmulatorServices {
18
18
  try {
19
19
  if (options.platform === this.$devicePlatformsConstants.visionOS &&
20
20
  !options.emulatorIdOrName) {
21
+ // find first available visionOS simulator (for now).
21
22
  const { devices } = await this.tryGetiOSSimDevices();
22
23
  options.emulatorIdOrName = (_a = devices.find((device) => device.platform === this.$devicePlatformsConstants.visionOS)) === null || _a === void 0 ? void 0 : _a.id;
23
24
  }
@@ -51,6 +52,8 @@ class IosEmulatorServices {
51
52
  }
52
53
  async connectToPort(data) {
53
54
  try {
55
+ // node v17+ resolves localhost to ::1 (ipv6) instead of 127.0.0.1 (ipv4)
56
+ // so we explicitly pass ipv4
54
57
  const socket = net.connect(data.port, "127.0.0.1");
55
58
  return socket;
56
59
  }
@@ -108,3 +111,4 @@ class IosEmulatorServices {
108
111
  }
109
112
  }
110
113
  yok_1.injector.register("iOSEmulatorServices", IosEmulatorServices);
114
+ //# sourceMappingURL=ios-emulator-services.js.map
@@ -21,3 +21,4 @@ exports.IOSSimResolver = IOSSimResolver;
21
21
  IOSSimResolver.iOSSimName = "ios-sim-portable";
22
22
  IOSSimResolver.iOSStandaloneExecutableName = "ios-sim-standalone.js";
23
23
  yok_1.injector.register("iOSSimResolver", IOSSimResolver);
24
+ //# sourceMappingURL=ios-sim-resolver.js.map
@@ -73,8 +73,13 @@ class IOSSimulatorApplicationManager extends application_manager_base_1.Applicat
73
73
  return [];
74
74
  }
75
75
  async getDebuggableAppViews(appIdentifiers) {
76
+ // Implement when we can find debuggable applications for iOS.
76
77
  return Promise.resolve(null);
77
78
  }
79
+ // iOS will kill the app if we freeze it in the NativeScript Runtime and wait for debug-brk.
80
+ // In order to avoid that, we are attaching lldb and passing it "process continue".
81
+ // In this way, iOS will not kill the app because it has a native debugger attached
82
+ // and the users will be able to attach a debug session using the debug-brk flag.
78
83
  attachNativeDebugger(appId, pid) {
79
84
  this._lldbProcesses[appId] = this.$childProcess.spawn("lldb", ["-p", pid]);
80
85
  if (log4js.levels.TRACE.isGreaterThanOrEqualTo(this.$logger.getLevel())) {
@@ -116,3 +121,4 @@ __decorate([
116
121
  __decorate([
117
122
  (0, decorators_1.cache)()
118
123
  ], IOSSimulatorApplicationManager.prototype, "startDeviceLog", null);
124
+ //# sourceMappingURL=ios-simulator-application-manager.js.map
@@ -65,11 +65,15 @@ class IOSSimulator extends ios_device_base_1.IOSDeviceBase {
65
65
  let socket;
66
66
  const attachRequestMessage = this.$iOSNotification.getAttachRequest(appId, this.deviceInfo.identifier);
67
67
  await this.$iOSEmulatorServices.postDarwinNotification(attachRequestMessage, this.deviceInfo.identifier);
68
+ // Retry posting the notification every five seconds, in case the AttachRequest
69
+ // event handler wasn't registered when the first one was sent
68
70
  const postNotificationRetryInterval = setInterval(() => {
69
71
  this.$iOSEmulatorServices
70
72
  .postDarwinNotification(attachRequestMessage, this.deviceInfo.identifier)
71
73
  .catch((e) => this.$logger.error(e));
72
74
  }, 5e3);
75
+ // the internal retry-mechanism of getDebuggerPort will ensure the above
76
+ // interval has a chance to execute multiple times
73
77
  const port = await super.getDebuggerPort(appId).finally(() => {
74
78
  clearInterval(postNotificationRetryInterval);
75
79
  });
@@ -88,3 +92,4 @@ exports.IOSSimulator = IOSSimulator;
88
92
  __decorate([
89
93
  (0, decorators_1.cache)()
90
94
  ], IOSSimulator.prototype, "openDeviceLogStream", null);
95
+ //# sourceMappingURL=ios-simulator-device.js.map
@@ -54,3 +54,4 @@ class IOSSimulatorFileSystem {
54
54
  }
55
55
  }
56
56
  exports.IOSSimulatorFileSystem = IOSSimulatorFileSystem;
57
+ //# sourceMappingURL=ios-simulator-file-system.js.map
@@ -56,3 +56,4 @@ class IOSSimulatorLogProvider extends events_1.EventEmitter {
56
56
  }
57
57
  exports.IOSSimulatorLogProvider = IOSSimulatorLogProvider;
58
58
  yok_1.injector.register("iOSSimulatorLogProvider", IOSSimulatorLogProvider);
59
+ //# sourceMappingURL=ios-simulator-log-provider.js.map
@@ -35,3 +35,4 @@ class LocalToDevicePathDataFactory {
35
35
  }
36
36
  exports.LocalToDevicePathDataFactory = LocalToDevicePathDataFactory;
37
37
  yok_1.injector.register("localToDevicePathDataFactory", LocalToDevicePathDataFactory);
38
+ //# sourceMappingURL=local-to-device-path-data-factory.js.map
@@ -24,6 +24,7 @@ class LogFilter {
24
24
  if (deviceLogFilter) {
25
25
  return deviceLogFilter.filterData(data, loggingOptions);
26
26
  }
27
+ // In case the platform is not valid, just return the data without filtering.
27
28
  return data;
28
29
  }
29
30
  getDeviceLogFilterInstance(platform) {
@@ -49,3 +50,4 @@ class LogFilter {
49
50
  }
50
51
  exports.LogFilter = LogFilter;
51
52
  yok_1.injector.register("logFilter", LogFilter);
53
+ //# sourceMappingURL=log-filter.js.map
@@ -10,3 +10,4 @@ class LoggingLevels {
10
10
  }
11
11
  exports.LoggingLevels = LoggingLevels;
12
12
  yok_1.injector.register("loggingLevels", LoggingLevels);
13
+ //# sourceMappingURL=logging-levels.js.map
@@ -38,6 +38,7 @@ class AndroidDeviceDiscovery extends device_discovery_1.DeviceDiscovery {
38
38
  }
39
39
  async checkCurrentData(result) {
40
40
  const currentDevices = result.map((element) => {
41
+ // http://developer.android.com/tools/help/adb.html#devicestatus
41
42
  const data = element.split("\t");
42
43
  const identifier = data[0];
43
44
  const status = data[1];
@@ -70,3 +71,4 @@ class AndroidDeviceDiscovery extends device_discovery_1.DeviceDiscovery {
70
71
  }
71
72
  exports.AndroidDeviceDiscovery = AndroidDeviceDiscovery;
72
73
  yok_1.injector.register("androidDeviceDiscovery", AndroidDeviceDiscovery);
74
+ //# sourceMappingURL=android-device-discovery.js.map
@@ -21,9 +21,11 @@ class AndroidEmulatorDiscovery extends events_1.EventEmitter {
21
21
  const availableEmulatorsOutput = await this.$androidEmulatorServices.getEmulatorImages();
22
22
  const currentEmulators = availableEmulatorsOutput.devices;
23
23
  const cachedEmulators = _.values(this._emulators);
24
+ // Remove old emulators
24
25
  const lostEmulators = _(cachedEmulators)
25
26
  .reject((e) => _.some(currentEmulators, (emulator) => emulator && e && emulator.imageIdentifier === e.imageIdentifier))
26
27
  .value();
28
+ // Add new emulators
27
29
  const foundEmulators = _(currentEmulators)
28
30
  .reject((e) => _.some(cachedEmulators, (emulator) => emulator && e && emulator.imageIdentifier === e.imageIdentifier))
29
31
  .value();
@@ -52,3 +54,4 @@ class AndroidEmulatorDiscovery extends events_1.EventEmitter {
52
54
  }
53
55
  exports.AndroidEmulatorDiscovery = AndroidEmulatorDiscovery;
54
56
  yok_1.injector.register("androidEmulatorDiscovery", AndroidEmulatorDiscovery);
57
+ //# sourceMappingURL=android-emulator-discovery.js.map
@@ -71,6 +71,19 @@ class AndroidProcessService {
71
71
  async getDebuggableApps(deviceIdentifier) {
72
72
  const adb = this.getAdb(deviceIdentifier);
73
73
  const androidWebViewPortInformation = (await this.getAbstractPortsInformation(adb)).split(os_1.EOL);
74
+ // TODO: Add tests and make sure only unique names are returned. Input before groupBy is:
75
+ // [ { deviceIdentifier: 'SH26BW100473',
76
+ // appIdentifier: 'com.telerik.EmptyNS',
77
+ // framework: 'NativeScript' },
78
+ // { deviceIdentifier: 'SH26BW100473',
79
+ // appIdentifier: 'com.telerik.EmptyNS',
80
+ // framework: 'Cordova' },
81
+ // { deviceIdentifier: 'SH26BW100473',
82
+ // appIdentifier: 'chrome',
83
+ // framework: 'Cordova' },
84
+ // { deviceIdentifier: 'SH26BW100473',
85
+ // appIdentifier: 'chrome',
86
+ // framework: 'Cordova' } ]
74
87
  const portInformation = await Promise.all(_.map(androidWebViewPortInformation, async (line) => (await this.getApplicationInfoFromWebViewPortInformation(adb, deviceIdentifier, line)) ||
75
88
  (await this.getNativeScriptApplicationInformation(adb, deviceIdentifier, line))));
76
89
  return _(portInformation)
@@ -109,6 +122,7 @@ class AndroidProcessService {
109
122
  return adb;
110
123
  }
111
124
  async getApplicationInfoFromWebViewPortInformation(adb, deviceIdentifier, information) {
125
+ // Need to search by processId to check for old Android webviews (@webview_devtools_remote_<processId>).
112
126
  const processIdRegExp = /@webview_devtools_remote_(.+)/g;
113
127
  const processIdMatches = processIdRegExp.exec(information);
114
128
  let cordovaAppIdentifier;
@@ -117,6 +131,7 @@ class AndroidProcessService {
117
131
  cordovaAppIdentifier = await this.getApplicationIdentifierFromPid(adb, processId);
118
132
  }
119
133
  else {
134
+ // Search for appIdentifier (@<appIdentifier>_devtools_remote).
120
135
  const chromeAppIdentifierRegExp = /@(.+)_devtools_remote\s?/g;
121
136
  const chromeAppIdentifierMatches = chromeAppIdentifierRegExp.exec(information);
122
137
  if (chromeAppIdentifierMatches && chromeAppIdentifierMatches.length > 0) {
@@ -133,6 +148,7 @@ class AndroidProcessService {
133
148
  return null;
134
149
  }
135
150
  async getNativeScriptApplicationInformation(adb, deviceIdentifier, information) {
151
+ // Search for appIdentifier (@<appIdentifier-debug>).
136
152
  const nativeScriptAppIdentifierRegExp = /@(.+)-(debug|inspectorServer)/g;
137
153
  const nativeScriptAppIdentifierMatches = nativeScriptAppIdentifierRegExp.exec(information);
138
154
  if (nativeScriptAppIdentifierMatches &&
@@ -147,6 +163,10 @@ class AndroidProcessService {
147
163
  return null;
148
164
  }
149
165
  async getAbstractPortForApplication(adb, processId, appIdentifier, abstractPortsInformation, framework) {
166
+ // The result will look like this (without the columns names):
167
+ // Num RefCount Protocol Flags Type St Inode Path
168
+ // 0000000000000000: 00000002 00000000 00010000 0001 01 189004 @webview_devtools_remote_25512
169
+ // The Path column is the abstract port.
150
170
  framework = framework || "";
151
171
  switch (framework.toLowerCase()) {
152
172
  case constants_1.TARGET_FRAMEWORK_IDENTIFIERS.Cordova.toLowerCase():
@@ -173,6 +193,9 @@ class AndroidProcessService {
173
193
  return match && match[1];
174
194
  }
175
195
  async getProcessIds(adb, appIdentifiers) {
196
+ // Process information will look like this (without the columns names):
197
+ // USER PID PPID VSIZE RSS WCHAN PC NAME
198
+ // u0_a63 25512 1334 1519560 96040 ffffffff f76a8f75 S com.telerik.appbuildertabstest
176
199
  const result = {};
177
200
  const processIdInformation = await adb.executeShellCommand(["ps"]);
178
201
  _.each(appIdentifiers, (appIdentifier) => {
@@ -183,6 +206,11 @@ class AndroidProcessService {
183
206
  }
184
207
  async getAlreadyMappedPort(adb, deviceIdentifier, abstractPort, adbForwardList) {
185
208
  const allForwardedPorts = adbForwardList || (await adb.executeCommand(["forward", "--list"])) || "";
209
+ // Sample output:
210
+ // 5e2e580b tcp:62503 localabstract:webview_devtools_remote_7985
211
+ // 5e2e580b tcp:62524 localabstract:webview_devtools_remote_7986
212
+ // 5e2e580b tcp:63160 localabstract:webview_devtools_remote_7987
213
+ // 5e2e580b tcp:57577 localabstract:com.telerik.nrel-debug
186
214
  const regex = new RegExp(`${deviceIdentifier}\\s+?tcp:(\\d+?)\\s+?.*?${abstractPort}$`);
187
215
  return this.getFirstMatchingGroupFromMultilineResult(allForwardedPorts, regex);
188
216
  }
@@ -196,6 +224,9 @@ class AndroidProcessService {
196
224
  }
197
225
  async getApplicationIdentifierFromPid(adb, pid, psData) {
198
226
  psData = psData || (await adb.executeShellCommand(["ps"]));
227
+ // Process information will look like this (without the columns names):
228
+ // USER PID PPID VSIZE RSS WCHAN PC NAME
229
+ // u0_a63 25512 1334 1519560 96040 ffffffff f76a8f75 S com.telerik.appbuildertabstest
199
230
  return this.getFirstMatchingGroupFromMultilineResult(psData, new RegExp(`\\s+${pid}(?:\\s+\\d+){3}\\s+.*\\s+(.*?)$`));
200
231
  }
201
232
  getFirstMatchingGroupFromMultilineResult(input, regex) {
@@ -218,3 +249,4 @@ __decorate([
218
249
  (0, decorators_1.exported)("androidProcessService")
219
250
  ], AndroidProcessService.prototype, "getAppProcessId", null);
220
251
  yok_1.injector.register("androidProcessService", AndroidProcessService);
252
+ //# sourceMappingURL=android-process-service.js.map
@@ -51,3 +51,4 @@ class DeviceDiscovery extends events_1.EventEmitter {
51
51
  }
52
52
  exports.DeviceDiscovery = DeviceDiscovery;
53
53
  yok_1.injector.register("deviceDiscovery", DeviceDiscovery);
54
+ //# sourceMappingURL=device-discovery.js.map