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
@@ -65,6 +65,9 @@ class HostInfo {
65
65
  catch (err) {
66
66
  this.$logger.trace(`Unable to get macOS version from ${systemProfileCommand}. Error is: ${err}`);
67
67
  }
68
+ // https://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
69
+ // Each macOS version is labeled 10.<version>, where it looks like <versions> is taken from the major version returned by os.release() (16.x.x for example) and subtracting 4 from it.
70
+ // So the version becomes "10.12" in this case.
68
71
  const osRelease = this.$osInfo.release();
69
72
  const majorVersion = osRelease && _.first(osRelease.split("."));
70
73
  macOSVersion = majorVersion && `10.${+majorVersion - 4}`;
@@ -118,3 +121,4 @@ __decorate([
118
121
  (0, decorators_1.cache)()
119
122
  ], HostInfo.prototype, "getMacOSVersion", null);
120
123
  yok_1.injector.register("hostInfo", HostInfo);
124
+ //# sourceMappingURL=host-info.js.map
@@ -26,6 +26,9 @@ class HttpClient {
26
26
  catch (err) {
27
27
  if (err.message === HttpClient.STUCK_REQUEST_ERROR_MESSAGE ||
28
28
  err.message === HttpClient.STUCK_RESPONSE_ERROR_MESSAGE) {
29
+ // Retry the request immediately because there are at least 10 seconds between the two requests.
30
+ // We have to retry only once the sporadically stuck requests/responses.
31
+ // We can add exponential backoff retry here if we decide that we need to workaround bigger network issues on the client side.
29
32
  this.$logger.warn("%s Retrying request to %s...", err.message, options.url || options);
30
33
  const retryResult = await this.httpRequestCore(options, proxySettings);
31
34
  return {
@@ -51,6 +54,7 @@ class HttpClient {
51
54
  await this.useProxySettings(proxySettings, cliProxySettings, options, headers, requestProto);
52
55
  if (!headers["User-Agent"]) {
53
56
  if (!this.defaultUserAgent) {
57
+ //TODO: the user agent client name is also passed explicitly during login and should be kept in sync
54
58
  this.defaultUserAgent = `${this.$staticConfig.USER_AGENT_NAME}/${this.$staticConfig.version} (Node.js ${process.versions.node}; ${process.platform}; ${process.arch})`;
55
59
  this.$logger.trace("User-Agent: %s", this.defaultUserAgent);
56
60
  }
@@ -79,14 +83,19 @@ class HttpClient {
79
83
  }).catch((err) => {
80
84
  this.$logger.trace("An error occurred while sending the request:", err);
81
85
  if (err.response) {
86
+ // The request was made and the server responded with a status code
87
+ // that falls out of the range of 2xx
82
88
  const errorMessage = this.getErrorMessage(err.response.status, null);
83
89
  err.proxyAuthenticationRequired =
84
90
  err.response.status === constants_1.HttpStatusCodes.PROXY_AUTHENTICATION_REQUIRED;
85
91
  err.message = errorMessage || err.message;
86
92
  }
87
93
  else if (err.request) {
94
+ // The request was made but no response was received
95
+ // `err.request` is an instance of XMLHttpRequest in the browser and an instance of
88
96
  }
89
97
  else {
98
+ // Something happened in setting up the request that triggered an Error
90
99
  }
91
100
  throw err;
92
101
  });
@@ -132,8 +141,17 @@ class HttpClient {
132
141
  return body;
133
142
  }
134
143
  }
144
+ /**
145
+ * This method respects the proxySettings (or proxyCache) by modifying headers and options passed to http(s) module.
146
+ * @param {IProxySettings} proxySettings The settings passed for this specific call.
147
+ * @param {IProxySettings} cliProxySettings The globally set proxy for this CLI.
148
+ * @param {any}options The object that will be passed to http(s) module.
149
+ * @param {any} headers Headers of the current request.
150
+ * @param {string} requestProto The protocol used for the current request - http or https.
151
+ */
135
152
  async useProxySettings(proxySettings, cliProxySettings, options, headers, requestProto) {
136
153
  const isLocalRequest = options.host === "localhost" || options.host === "127.0.0.1";
154
+ // don't use the proxy for requests to localhost
137
155
  if (!isLocalRequest && (proxySettings || cliProxySettings)) {
138
156
  const proto = (proxySettings && proxySettings.protocol) ||
139
157
  cliProxySettings.protocol ||
@@ -144,6 +162,7 @@ class HttpClient {
144
162
  if (cliProxySettings.username && cliProxySettings.password) {
145
163
  credentialsPart = `${cliProxySettings.username}:${cliProxySettings.password}@`;
146
164
  }
165
+ // Note that proto ends with :
147
166
  options.proxy = `${proto}//${credentialsPart}${host}:${port}`;
148
167
  options.rejectUnauthorized = proxySettings
149
168
  ? proxySettings.rejectUnauthorized
@@ -156,3 +175,4 @@ exports.HttpClient = HttpClient;
156
175
  HttpClient.STUCK_REQUEST_ERROR_MESSAGE = "The request can't receive any response.";
157
176
  HttpClient.STUCK_RESPONSE_ERROR_MESSAGE = "Can't receive all parts of the response.";
158
177
  yok_1.injector.register("httpClient", HttpClient);
178
+ //# sourceMappingURL=http-client.js.map
@@ -15,9 +15,13 @@ function cliAppender(layout) {
15
15
  return appender;
16
16
  }
17
17
  function configure(config, layouts) {
18
+ // the default layout for the appender
18
19
  let layout = layouts.messagePassThroughLayout;
20
+ // check if there is another layout specified
19
21
  if (config.layout) {
20
22
  layout = layouts.layout(config.layout.type, config.layout);
21
23
  }
24
+ // create a new appender instance
22
25
  return cliAppender(layout);
23
26
  }
27
+ //# sourceMappingURL=cli-appender.js.map
@@ -21,9 +21,13 @@ function configure(config, layouts) {
21
21
  if (!config.emitter.emit || typeof config.emitter.emit !== "function") {
22
22
  throw new Error("The passed emitter must be instance of EventEmitter");
23
23
  }
24
+ // the default layout for the appender
24
25
  let layout = layouts.messagePassThroughLayout;
26
+ // check if there is another layout specified
25
27
  if (config.layout) {
26
28
  layout = layouts.layout(config.layout.type, config.layout);
27
29
  }
30
+ // create a new appender instance
28
31
  return emitAppender(layout, config.emitter);
29
32
  }
33
+ //# sourceMappingURL=emit-appender.js.map
@@ -30,3 +30,4 @@ function layout(config) {
30
30
  return msg;
31
31
  };
32
32
  }
33
+ //# sourceMappingURL=cli-layout.js.map
@@ -98,9 +98,11 @@ class Logger {
98
98
  if (typeof item === "string") {
99
99
  return item;
100
100
  }
101
+ // do not try to read streams, because they may not be rewindable
101
102
  if (item instanceof stream.Readable) {
102
103
  return "[ReadableStream]";
103
104
  }
105
+ // There's no point in printing buffers
104
106
  if (item instanceof Buffer) {
105
107
  return "[Buffer]";
106
108
  }
@@ -153,12 +155,14 @@ class Logger {
153
155
  getLogOptionsForMessage(data) {
154
156
  const loggerOptionKeys = _.keys(constants_1.LoggerConfigData);
155
157
  const dataToCheck = data.filter((el) => {
158
+ // objects created with Object.create(null) do not have `hasOwnProperty` function
156
159
  if (!!el &&
157
160
  typeof el === "object" &&
158
161
  el.hasOwnProperty &&
159
162
  typeof el.hasOwnProperty === "function") {
160
163
  for (const key of loggerOptionKeys) {
161
164
  if (el.hasOwnProperty(key)) {
165
+ // include only the elements which have one of the keys we've specified as logger options
162
166
  return true;
163
167
  }
164
168
  }
@@ -197,3 +201,4 @@ __decorate([
197
201
  (0, decorators_1.cache)()
198
202
  ], Logger.prototype, "initialize", null);
199
203
  yok_1.injector.register("logger", Logger);
204
+ //# sourceMappingURL=logger.js.map
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
+ //
3
+ // automatically generated code; do not edit manually!
4
+ //
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.Messages = void 0;
4
7
  const yok_1 = require("../yok");
8
+ /* tslint:disable:all */
5
9
  class Messages {
6
10
  constructor() {
7
11
  this.Devices = {
@@ -13,3 +17,5 @@ class Messages {
13
17
  }
14
18
  exports.Messages = Messages;
15
19
  yok_1.injector.register("messages", Messages);
20
+ /* tslint:enable */
21
+ //# sourceMappingURL=messages.js.map
@@ -29,7 +29,7 @@ class AndroidApplicationManager extends application_manager_base_1.ApplicationMa
29
29
  this.$deviceLogProvider = $deviceLogProvider;
30
30
  this.$errors = $errors;
31
31
  this.PID_CHECK_INTERVAL = 100;
32
- this.PID_CHECK_TIMEOUT = 10000;
32
+ this.PID_CHECK_TIMEOUT = 10000; // 10 secs
33
33
  }
34
34
  async getInstalledApplications() {
35
35
  const result = (await this.adb.executeShellCommand(["pm", "list", "packages"])) || "";
@@ -67,6 +67,7 @@ class AndroidApplicationManager extends application_manager_base_1.ApplicationMa
67
67
  }
68
68
  }
69
69
  uninstallApplication(appIdentifier) {
70
+ // Need to set the treatErrorsAsWarnings to true because when using tns run command if the application is not installed on the device it will throw error
70
71
  return this.adb.executeShellCommand(["pm", "uninstall", `${appIdentifier}`], { treatErrorsAsWarnings: true });
71
72
  }
72
73
  async startApplication(appData) {
@@ -75,9 +76,24 @@ class AndroidApplicationManager extends application_manager_base_1.ApplicationMa
75
76
  `cat /dev/null > ${constants_1.LiveSyncPaths.ANDROID_TMP_DIR_NAME}/${appData.appId}-debugbreak`,
76
77
  ]);
77
78
  }
79
+ // If the app is debuggable, the Runtime will update the file when its ready for debugging
80
+ // and we will be able to take decisions and synchronize the debug experience based on the content
78
81
  await this.adb.executeShellCommand([
79
82
  `cat /dev/null > ${constants_1.LiveSyncPaths.ANDROID_TMP_DIR_NAME}/${appData.appId}-debugger-started`,
80
83
  ]);
84
+ /*
85
+ Example "pm dump <app_identifier> | grep -A 1 MAIN" output"
86
+ android.intent.action.MAIN:
87
+ 3b2df03 org.nativescript.cliapp/com.tns.NativeScriptActivity filter 50dd82e
88
+ Action: "android.intent.action.MAIN"
89
+ Category: "android.intent.category.LAUNCHER"
90
+ --
91
+ intent={act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.nativescript.cliapp/com.tns.NativeScriptActivity}
92
+ realActivity=org.nativescript.cliapp/com.tns.NativeScriptActivity
93
+ --
94
+ Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.nativescript.cliapp/com.tns.NativeScriptActivity }
95
+ frontOfTask=true task=TaskRecord{fe592ac #449 A=org.nativescript.cliapp U=0 StackId=1 sz=1}
96
+ */
81
97
  const appIdentifier = appData.appId;
82
98
  const pmDumpOutput = await this.adb.executeShellCommand([
83
99
  "pm",
@@ -127,6 +143,8 @@ class AndroidApplicationManager extends application_manager_base_1.ApplicationMa
127
143
  pid: processIdentifier,
128
144
  appId: appIdentifier,
129
145
  onAppRestarted: () => {
146
+ // If the app restarts, we update the PID and
147
+ // restart log helper.
130
148
  this.onAppLaunch(appData);
131
149
  },
132
150
  });
@@ -205,3 +223,4 @@ __decorate([
205
223
  __decorate([
206
224
  (0, decorators_1.cache)()
207
225
  ], AndroidApplicationManager.prototype, "getFullyQualifiedActivityRegex", null);
226
+ //# sourceMappingURL=android-application-manager.js.map
@@ -330,3 +330,4 @@ AndroidDebugBridgeResultHandler.ANDROID_DEBUG_BRIDGE_ERRORS = [
330
330
  },
331
331
  ];
332
332
  yok_1.injector.register("androidDebugBridgeResultHandler", AndroidDebugBridgeResultHandler);
333
+ //# sourceMappingURL=android-debug-bridge-result-handler.js.map
@@ -38,11 +38,15 @@ class AndroidDebugBridge {
38
38
  return this.$childProcess.spawn(command.command, command.args);
39
39
  }
40
40
  }
41
+ // If adb -s <invalid device id> install <smth> is executed the childProcess won't get any response
42
+ // because the adb will be waiting for valid device and will not send close or exit event.
43
+ // For example `adb -s <invalid device id> install <smth>` throws error 'error: device \'030939f508e6c773\' not found\r\n' exitCode 4294967295
41
44
  const result = await this.$childProcess.spawnFromEvent(command.command, command.args, event, childProcessOptions, { throwError: false });
42
45
  const errors = this.$androidDebugBridgeResultHandler.checkForErrors(result);
43
46
  if (errors && errors.length > 0) {
44
47
  this.$androidDebugBridgeResultHandler.handleErrors(errors, treatErrorsAsWarnings);
45
48
  }
49
+ // Some adb commands returns array of strings instead of object with stdout and stderr. (adb start-server)
46
50
  return result.stdout === undefined || result.stdout === null
47
51
  ? result
48
52
  : result.stdout;
@@ -121,6 +125,7 @@ class AndroidDebugBridge {
121
125
  }
122
126
  async pushFile(localFilePath, deviceFilePath) {
123
127
  const fileDirectory = (0, helpers_1.fromWindowsRelativePathToUnix)(path.dirname(deviceFilePath));
128
+ // starting from API level 28, the push command is returning an error if the directory does not exist
124
129
  await this.executeShellCommand(["mkdir", "-p", fileDirectory]);
125
130
  await this.executeCommand(["push", localFilePath, deviceFilePath]);
126
131
  await this.executeShellCommand(["chmod", "0777", fileDirectory]);
@@ -140,3 +145,4 @@ __decorate([
140
145
  (0, decorators_1.invokeInit)()
141
146
  ], AndroidDebugBridge.prototype, "getDevices", null);
142
147
  yok_1.injector.register("adb", AndroidDebugBridge);
148
+ //# sourceMappingURL=android-debug-bridge.js.map
@@ -74,6 +74,8 @@ class AndroidDeviceFileSystem {
74
74
  return transferredFiles;
75
75
  }
76
76
  async transferDirectory(deviceAppData, localToDevicePaths, projectFilesPath) {
77
+ // starting from Android 9, adb push is throwing an exception when there are subfolders
78
+ // the check could be removed when we start supporting only runtime versions with sockets
77
79
  const minAndroidWithoutAdbPushDir = "9.0.0";
78
80
  const isAdbPushDirSupported = semver.lt(semver.coerce(deviceAppData.device.deviceInfo.version), minAndroidWithoutAdbPushDir);
79
81
  const deviceProjectDir = await deviceAppData.getDeviceProjectRootPath();
@@ -120,6 +122,7 @@ class AndroidDeviceFileSystem {
120
122
  const hostTmpDir = await this.$tempService.mkdirSync("application-");
121
123
  const commandsFileHostPath = path.join(hostTmpDir, "temp.commands.file");
122
124
  this.$fs.writeFile(commandsFileHostPath, fileContent);
125
+ // copy it to the device
123
126
  await this.transferFile(commandsFileHostPath, deviceFilePath);
124
127
  await this.adb.executeShellCommand(["chmod", "0777", deviceFilePath]);
125
128
  }
@@ -141,3 +144,4 @@ class AndroidDeviceFileSystem {
141
144
  }
142
145
  }
143
146
  exports.AndroidDeviceFileSystem = AndroidDeviceFileSystem;
147
+ //# sourceMappingURL=android-device-file-system.js.map
@@ -51,6 +51,8 @@ class AndroidDeviceHashService {
51
51
  const action = async (localToDevicePathData) => {
52
52
  const localPath = localToDevicePathData.getLocalPath();
53
53
  if (this.$fs.getFsStats(localPath).isFile()) {
54
+ // TODO: Use relative to project path for key
55
+ // This will speed up livesync on the same device for the same project on different PCs.
54
56
  initialShasums[localPath] = await this.$fs.getFileShasum(localPath);
55
57
  }
56
58
  };
@@ -106,3 +108,4 @@ __decorate([
106
108
  __decorate([
107
109
  (0, decorators_1.cache)()
108
110
  ], AndroidDeviceHashService.prototype, "getTempDir", null);
111
+ //# sourceMappingURL=android-device-hash-service.js.map
@@ -32,6 +32,8 @@ class AndroidDevice {
32
32
  this.fileSystem = this.$injector.resolve(fileSystemPath.AndroidDeviceFileSystem, { adb: this.adb });
33
33
  let details = await this.getDeviceDetails(["getprop"]);
34
34
  if (!details || !details.name) {
35
+ // In older CLI versions we are calling cat /system/build.prop to get details.
36
+ // Keep this logic for compatibility and possibly for devices for which getprop is not working
35
37
  details = await this.getDeviceDetails(["cat", "/system/build.prop"]);
36
38
  }
37
39
  this.$logger.trace(details);
@@ -88,6 +90,9 @@ class AndroidDevice {
88
90
  try {
89
91
  const details = await this.adb.executeShellCommand(shellCommandArgs);
90
92
  details.split(/\r?\n|\r/).forEach((value) => {
93
+ // sample line is "ro.build.version.release=4.4" in /system/build.prop
94
+ // sample line from getprop is: [ro.build.version.release]: [6.0]
95
+ // NOTE: some props do not have value: [ro.build.version.base_os]: []
91
96
  const match = /(?:\[?ro\.build\.version|ro\.product|ro\.build)\.(.+?)]?(?:\:|=)(?:\s*?\[)?(.*?)]?$/.exec(value);
92
97
  if (match) {
93
98
  parsedDetails[match[1]] = match[2];
@@ -101,6 +106,7 @@ class AndroidDevice {
101
106
  return parsedDetails;
102
107
  }
103
108
  getIsTablet(details) {
109
+ //version 3.x.x (also known as Honeycomb) is a tablet only version
104
110
  return (details &&
105
111
  (_.startsWith(details.release, "3.") ||
106
112
  _.includes((details.characteristics || "").toLowerCase(), "tablet")));
@@ -114,6 +120,7 @@ class AndroidDevice {
114
120
  }
115
121
  }
116
122
  exports.AndroidDevice = AndroidDevice;
123
+ // http://stackoverflow.com/questions/31178195/what-does-adb-device-status-mean
117
124
  AndroidDevice.ADB_DEVICE_STATUS_INFO = {
118
125
  device: {
119
126
  errorHelp: null,
@@ -139,3 +146,4 @@ AndroidDevice.ADB_DEVICE_STATUS_INFO = {
139
146
  __decorate([
140
147
  (0, decorators_1.cache)()
141
148
  ], AndroidDevice.prototype, "init", null);
149
+ //# sourceMappingURL=android-device.js.map
@@ -37,14 +37,16 @@ class AndroidEmulatorServices {
37
37
  async getRunningEmulatorName(emulatorId) {
38
38
  let result = await this.$androidVirtualDeviceService.getRunningEmulatorName(emulatorId);
39
39
  if (!result) {
40
- result = await this.$androidGenymotionService.getRunningEmulatorName(emulatorId);
40
+ result =
41
+ await this.$androidGenymotionService.getRunningEmulatorName(emulatorId);
41
42
  }
42
43
  return result;
43
44
  }
44
45
  async getRunningEmulatorImageIdentifier(emulatorId) {
45
46
  let result = await this.$androidVirtualDeviceService.getRunningEmulatorImageIdentifier(emulatorId);
46
47
  if (!result) {
47
- result = await this.$androidGenymotionService.getRunningEmulatorImageIdentifier(emulatorId);
48
+ result =
49
+ await this.$androidGenymotionService.getRunningEmulatorImageIdentifier(emulatorId);
48
50
  }
49
51
  return result;
50
52
  }
@@ -101,7 +103,7 @@ class AndroidEmulatorServices {
101
103
  endTimeEpoch,
102
104
  };
103
105
  }
104
- await (0, helpers_1.sleep)(10000);
106
+ await (0, helpers_1.sleep)(10000); // the emulator definitely takes its time to wake up
105
107
  hasTimeLeft = (0, helpers_1.getCurrentEpochTime)() < endTimeEpoch;
106
108
  }
107
109
  if (!hasTimeLeft && !isInfiniteWait) {
@@ -116,13 +118,13 @@ class AndroidEmulatorServices {
116
118
  let pathToEmulatorExecutable = null;
117
119
  let startEmulatorArgs = null;
118
120
  if (emulator.vendor === constants_1.AndroidVirtualDevice.AVD_VENDOR_NAME) {
119
- pathToEmulatorExecutable = this.$androidVirtualDeviceService
120
- .pathToEmulatorExecutable;
121
+ pathToEmulatorExecutable =
122
+ this.$androidVirtualDeviceService.pathToEmulatorExecutable;
121
123
  startEmulatorArgs = this.$androidVirtualDeviceService.startEmulatorArgs(emulator.imageIdentifier);
122
124
  }
123
125
  else if (emulator.vendor === constants_1.AndroidVirtualDevice.GENYMOTION_VENDOR_NAME) {
124
- pathToEmulatorExecutable = this.$androidGenymotionService
125
- .pathToEmulatorExecutable;
126
+ pathToEmulatorExecutable =
127
+ this.$androidGenymotionService.pathToEmulatorExecutable;
126
128
  startEmulatorArgs = this.$androidGenymotionService.startEmulatorArgs(emulator.imageIdentifier);
127
129
  }
128
130
  this.$logger.info(`Starting Android emulator with image ${emulator.imageIdentifier}`);
@@ -146,7 +148,7 @@ class AndroidEmulatorServices {
146
148
  }
147
149
  const minVersion = semver.coerce(constants_1.AndroidVirtualDevice.MIN_ANDROID_VERSION);
148
150
  const bestVersion = best && best.version && semver.coerce(best.version);
149
- return bestVersion && semver.gte(bestVersion, minVersion) ? best : null;
151
+ return !bestVersion || semver.gte(bestVersion, minVersion) ? best : null;
150
152
  }
151
153
  async waitForEmulatorBootToComplete(emulator, endTimeEpoch, timeout) {
152
154
  this.$logger.info("Waiting for emulator device initialization...", {
@@ -178,3 +180,4 @@ class AndroidEmulatorServices {
178
180
  }
179
181
  exports.AndroidEmulatorServices = AndroidEmulatorServices;
180
182
  yok_1.injector.register("androidEmulatorServices", AndroidEmulatorServices);
183
+ //# sourceMappingURL=android-emulator-services.js.map
@@ -12,6 +12,8 @@ class AndroidIniFileParser {
12
12
  if (!this.$fs.exists(iniFilePath)) {
13
13
  return null;
14
14
  }
15
+ // avd files can have different encoding, defined on the first line.
16
+ // find which one it is (if any) and use it to correctly read the file contents
15
17
  const encoding = this.getAvdEncoding(iniFilePath);
16
18
  const contents = this.$fs.readText(iniFilePath, encoding).split("\n");
17
19
  return _.reduce(contents, (result, line) => {
@@ -44,6 +46,8 @@ class AndroidIniFileParser {
44
46
  }, Object.create(null));
45
47
  }
46
48
  getAvdEncoding(avdName) {
49
+ // avd files can have different encoding, defined on the first line.
50
+ // find which one it is (if any) and use it to correctly read the file contents
47
51
  let encoding = "utf8";
48
52
  let contents = this.$fs.readText(avdName, "ascii");
49
53
  if (contents.length > 0) {
@@ -57,18 +61,22 @@ class AndroidIniFileParser {
57
61
  }
58
62
  return encoding;
59
63
  }
64
+ // Android L is not written as a number in the .ini files, and we need to convert it
60
65
  readTargetNum(target) {
61
66
  const platform = target.replace("android-", "");
62
67
  let platformNumber = +platform;
63
68
  if (isNaN(platformNumber)) {
69
+ // this may be a google image
64
70
  const googlePlatform = target.split(":")[2];
65
71
  if (googlePlatform) {
66
72
  platformNumber = +googlePlatform;
67
73
  }
68
74
  else if (platform === "L") {
75
+ // Android SDK 20 preview
69
76
  platformNumber = 20;
70
77
  }
71
78
  else if (platform === "MNC") {
79
+ // Android M preview
72
80
  platformNumber = 22;
73
81
  }
74
82
  }
@@ -77,3 +85,4 @@ class AndroidIniFileParser {
77
85
  }
78
86
  exports.AndroidIniFileParser = AndroidIniFileParser;
79
87
  yok_1.injector.register("androidIniFileParser", AndroidIniFileParser);
88
+ //# sourceMappingURL=android-ini-file-parser.js.map
@@ -37,6 +37,10 @@ class AndroidLogFilter {
37
37
  }
38
38
  }
39
39
  exports.AndroidLogFilter = AndroidLogFilter;
40
+ //sample line is "I/Web Console( 4438): Received Event: deviceready at file:///storage/emulated/0/Icenium/com.telerik.TestApp/js/index.js:48"
40
41
  AndroidLogFilter.LINE_REGEX = /.\/(.+?)\s*\(\s*\d+?\): (.*)/;
42
+ // sample line is "11-23 12:39:07.310 1584 1597 I art : Background sticky concurrent mark sweep GC freed 21966(1780KB) AllocSpace objects, 4(80KB) LOS objects, 77% free, 840KB/3MB, paused 4.018ms total 158.629ms"
43
+ // or '12-28 10:45:08.020 3329 3329 W chromium: [WARNING:data_reduction_proxy_settings.cc(328)] SPDY proxy OFF at startup'
41
44
  AndroidLogFilter.API_LEVEL_23_LINE_REGEX = /.+?\s+?(?:[A-Z]\s+?)([A-Za-z \.]+?)\s*?\: (.*)/;
42
45
  yok_1.injector.register("androidLogFilter", AndroidLogFilter);
46
+ //# sourceMappingURL=android-log-filter.js.map
@@ -69,6 +69,9 @@ class AndroidVirtualDeviceService {
69
69
  get pathToEmulatorExecutable() {
70
70
  const emulatorExecutableName = "emulator";
71
71
  if (this.androidHome) {
72
+ // Check https://developer.android.com/studio/releases/sdk-tools.html (25.3.0)
73
+ // Since this version of SDK tools, the emulator is a separate package.
74
+ // However the emulator executable still exists in the "tools" dir.
72
75
  const pathToEmulatorFromAndroidStudio = path.join(this.androidHome, emulatorExecutableName, emulatorExecutableName);
73
76
  const realFilePath = this.$hostInfo.isWindows
74
77
  ? `${pathToEmulatorFromAndroidStudio}.exe`
@@ -108,6 +111,17 @@ class AndroidVirtualDeviceService {
108
111
  client.on("data", (data) => {
109
112
  output += data.toString();
110
113
  const imageIdentifier = this.getImageIdentifierFromClientOutput(output);
114
+ // old output should look like:
115
+ // Android Console: type 'help' for a list of commands
116
+ // OK
117
+ // <Name of image>
118
+ // OK
119
+ // new output should look like:
120
+ // Android Console: type 'help' for a list of commands
121
+ // OK
122
+ // a\u001b[K\u001b[Dav\u001b[K\u001b[D\u001b[Davd\u001b...
123
+ // <Name of image>
124
+ // OK
111
125
  if (imageIdentifier && !isResolved) {
112
126
  this.mapEmulatorIdToImageIdentifier[emulatorId] = imageIdentifier;
113
127
  this.clearNetConnection(client, timer);
@@ -159,6 +173,8 @@ class AndroidVirtualDeviceService {
159
173
  if (this.pathToAvdManagerExecutable &&
160
174
  this.$fs.exists(this.pathToAvdManagerExecutable)) {
161
175
  if (process.env.JAVA_HOME) {
176
+ // In case JAVA_HOME is set, but it points to incorrect directory (i.e. there's no java in $JAVA_HOME/bin/java), avdmanager will fail
177
+ // no matter if you have correct java in PATH.
162
178
  canExecute = !!(await this.$sysInfo.getJavaVersionFromJavaHome());
163
179
  }
164
180
  else {
@@ -230,6 +246,13 @@ class AndroidVirtualDeviceService {
230
246
  const avdOutput = output.split(constants_1.AndroidVirtualDevice.AVAILABLE_AVDS_MESSAGE);
231
247
  const availableDevices = avdOutput && avdOutput[1] && avdOutput[1].trim();
232
248
  if (availableDevices) {
249
+ // In some cases `avdmanager list avds` command prints:
250
+ // `The following Android Virtual Devices could not be loaded:
251
+ // Name: Pixel_2_XL_API_28
252
+ // Path: /Users/<username>/.android/avd/Pixel_2_XL_API_28.avd
253
+ // Error: Google pixel_2_xl no longer exists as a device`
254
+ // These devices sometimes are valid so try to parse them.
255
+ // Also these devices are printed at the end of the output and are separated with 2 new lines from the valid devices output.
233
256
  const parts = availableDevices.split(/(?:\r?\n){2}/);
234
257
  const items = [parts[0], parts[1]].filter((item) => !!item);
235
258
  for (const item of items) {
@@ -246,6 +269,7 @@ class AndroidVirtualDeviceService {
246
269
  }
247
270
  getAvdManagerDeviceInfo(output) {
248
271
  const avdManagerDeviceInfo = Object.create(null);
272
+ // Split by `\n`, not EOL as the avdmanager and android executables print results with `\n` only even on Windows
249
273
  _.reduce(output.split("\n"), (result, row) => {
250
274
  const [key, value] = row.split(": ").map((part) => part.trim());
251
275
  switch (key) {
@@ -292,6 +316,7 @@ class AndroidVirtualDeviceService {
292
316
  };
293
317
  }
294
318
  getImageIdentifierFromClientOutput(output) {
319
+ // The lines should be trimmed after the split because the output has \r\n and when using split(EOL) on mac each line ends with \r.
295
320
  const lines = _.map(output.split(os_1.EOL), (line) => line.trim());
296
321
  const firstIndexOfOk = _.indexOf(lines, "OK");
297
322
  if (firstIndexOfOk < 0) {
@@ -340,3 +365,4 @@ __decorate([
340
365
  (0, decorators_1.cache)()
341
366
  ], AndroidVirtualDeviceService.prototype, "getConfigurationError", null);
342
367
  yok_1.injector.register("androidVirtualDeviceService", AndroidVirtualDeviceService);
368
+ //# sourceMappingURL=android-virtual-device-service.js.map
@@ -30,3 +30,4 @@ class DeviceAndroidDebugBridge extends android_debug_bridge_1.AndroidDebugBridge
30
30
  }
31
31
  }
32
32
  exports.DeviceAndroidDebugBridge = DeviceAndroidDebugBridge;
33
+ //# sourceMappingURL=device-android-debug-bridge.js.map
@@ -42,6 +42,7 @@ class AndroidGenymotionService {
42
42
  .map(async (row) => {
43
43
  const match = row.match(/^(.+?)\s+device$/);
44
44
  if (match && match[1]) {
45
+ // possible genymotion emulator
45
46
  const emulatorId = match[1];
46
47
  const result = (await this.isGenymotionEmulator(emulatorId))
47
48
  ? emulatorId
@@ -92,6 +93,7 @@ class AndroidGenymotionService {
92
93
  this.$emulatorHelper.setRunningAndroidEmulatorProperties(runningEmulatorId, runningEmulator);
93
94
  return runningEmulator;
94
95
  }
96
+ // https://wiki.appcelerator.org/display/guides2/Installing+Genymotion
95
97
  get playerSearchPaths() {
96
98
  return {
97
99
  darwin: [
@@ -133,13 +135,14 @@ class AndroidGenymotionService {
133
135
  vendor: constants_1.AndroidVirtualDevice.GENYMOTION_VENDOR_NAME,
134
136
  status: constants_1.NOT_RUNNING_EMULATOR_STATUS,
135
137
  errorHelp: [configurationError, error].filter((item) => !!item).join(os_1.EOL) || null,
136
- isTablet: false,
138
+ isTablet: false, //TODO: Consider how to populate this correctly when the device is not running
137
139
  type: constants_1.DeviceTypes.Emulator,
138
140
  connectionTypes: [constants_2.DeviceConnectionType.Local],
139
141
  platform: this.$devicePlatformsConstants.Android,
140
142
  };
141
143
  }
142
144
  getSdkVersion(output) {
145
+ // Example -> Name: android_version, value: 6.0.0, timestamp: 1530090506102029000, flags:
143
146
  const androidApiLevelRow = output
144
147
  .split("\n")
145
148
  .filter((row) => !!row)
@@ -165,6 +168,7 @@ In case you have installed Genymotion in a different location, please add the pa
165
168
  }
166
169
  async getConfigurationError() {
167
170
  const result = await this.$childProcess.trySpawnFromCloseEvent(this.pathToEmulatorExecutable, [], {}, { throwError: false });
171
+ // When player is spawned, it always prints message on stderr.
168
172
  if (result &&
169
173
  result.stderr &&
170
174
  result.stderr.indexOf(constants_1.AndroidVirtualDevice.GENYMOTION_DEFAULT_STDERR_STRING) === -1) {
@@ -182,3 +186,4 @@ __decorate([
182
186
  (0, decorators_1.cache)()
183
187
  ], AndroidGenymotionService.prototype, "getConfigurationError", null);
184
188
  yok_1.injector.register("androidGenymotionService", AndroidGenymotionService);
189
+ //# sourceMappingURL=genymotion-service.js.map
@@ -34,6 +34,7 @@ class VirtualBoxService {
34
34
  .split(os_1.EOL)
35
35
  .filter((row) => !!row)
36
36
  .map((row) => {
37
+ // Example row: "Google Nexus 4 - 5.0.0 - API 21 - 768x1280" {9d9beef2-cc60-4a54-bcc0-cc1dbf89811f}
37
38
  const [rawName, rawId] = row.split('" ');
38
39
  const id = rawId.substr(1, rawId.length - 2);
39
40
  const name = rawName.substr(1, rawName.length - 1);
@@ -70,6 +71,15 @@ class VirtualBoxService {
70
71
  if (this.$hostInfo.isWindows) {
71
72
  let searchPath = null;
72
73
  try {
74
+ /* This can be used as interface!!!!
75
+ arch:null
76
+ hive:"HKLM"
77
+ host:""
78
+ key:"\Software\Oracle\VirtualBox"
79
+ name:"InstallDir"
80
+ type:"REG_SZ"
81
+ value:"C:\Program Files\Oracle\VirtualBox\"
82
+ */
73
83
  const result = await (0, helpers_1.getWinRegPropertyValue)("\\Software\\Oracle\\VirtualBox", "InstallDir");
74
84
  searchPath = result && result.value ? result.value : null;
75
85
  }
@@ -102,3 +112,4 @@ __decorate([
102
112
  (0, decorators_1.cache)()
103
113
  ], VirtualBoxService.prototype, "getvBoxManagePath", null);
104
114
  yok_1.injector.register("virtualBoxService", VirtualBoxService);
115
+ //# sourceMappingURL=virtualbox-service.js.map