nativescript 8.7.0-rc.0 → 8.7.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) 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 +7 -1
  4. package/lib/color.js +3 -0
  5. package/lib/commands/add-platform.js +1 -0
  6. package/lib/commands/apple-login.js +1 -0
  7. package/lib/commands/appstore-list.js +1 -0
  8. package/lib/commands/appstore-upload.js +4 -0
  9. package/lib/commands/build.js +20 -3
  10. package/lib/commands/clean.js +22 -1
  11. package/lib/commands/command-base.js +1 -0
  12. package/lib/commands/config.js +3 -0
  13. package/lib/commands/create-project.js +34 -19
  14. package/lib/commands/debug.js +6 -1
  15. package/lib/commands/deploy.js +3 -2
  16. package/lib/commands/extensibility/install-extension.js +1 -0
  17. package/lib/commands/extensibility/list-extensions.js +1 -0
  18. package/lib/commands/extensibility/uninstall-extension.js +1 -0
  19. package/lib/commands/fonts.js +1 -0
  20. package/lib/commands/generate-assets.js +1 -0
  21. package/lib/commands/generate-help.js +1 -0
  22. package/lib/commands/generate.js +12 -2
  23. package/lib/commands/info.js +1 -0
  24. package/lib/commands/install.js +1 -0
  25. package/lib/commands/list-platforms.js +1 -0
  26. package/lib/commands/migrate.js +1 -0
  27. package/lib/commands/platform-clean.js +1 -0
  28. package/lib/commands/plugin/add-plugin.js +1 -0
  29. package/lib/commands/plugin/build-plugin.js +1 -0
  30. package/lib/commands/plugin/create-plugin.js +5 -0
  31. package/lib/commands/plugin/list-plugins.js +1 -0
  32. package/lib/commands/plugin/remove-plugin.js +2 -0
  33. package/lib/commands/plugin/update-plugin.js +1 -0
  34. package/lib/commands/post-install.js +6 -0
  35. package/lib/commands/prepare.js +3 -2
  36. package/lib/commands/preview.js +2 -0
  37. package/lib/commands/remove-platform.js +1 -0
  38. package/lib/commands/resources/resources-update.js +2 -0
  39. package/lib/commands/run.js +1 -0
  40. package/lib/commands/setup.js +1 -0
  41. package/lib/commands/start.js +1 -0
  42. package/lib/commands/test-init.js +4 -0
  43. package/lib/commands/test.js +9 -2
  44. package/lib/commands/typings.js +1 -0
  45. package/lib/commands/update-platform.js +5 -0
  46. package/lib/commands/update.js +2 -0
  47. package/lib/common/bootstrap.js +1 -0
  48. package/lib/common/child-process.js +3 -0
  49. package/lib/common/codeGeneration/code-entity.js +1 -0
  50. package/lib/common/codeGeneration/code-printer.js +1 -0
  51. package/lib/common/command-params.js +1 -0
  52. package/lib/common/commands/analytics.js +3 -0
  53. package/lib/common/commands/autocompletion.js +3 -0
  54. package/lib/common/commands/device/device-log-stream.js +1 -0
  55. package/lib/common/commands/device/get-file.js +2 -0
  56. package/lib/common/commands/device/list-applications.js +1 -0
  57. package/lib/common/commands/device/list-devices.js +3 -0
  58. package/lib/common/commands/device/list-files.js +2 -0
  59. package/lib/common/commands/device/put-file.js +2 -0
  60. package/lib/common/commands/device/run-application.js +1 -0
  61. package/lib/common/commands/device/stop-application.js +1 -0
  62. package/lib/common/commands/device/uninstall-application.js +1 -0
  63. package/lib/common/commands/doctor.js +3 -2
  64. package/lib/common/commands/generate-messages.js +1 -0
  65. package/lib/common/commands/help.js +1 -0
  66. package/lib/common/commands/package-manager-get.js +1 -0
  67. package/lib/common/commands/package-manager-set.js +1 -0
  68. package/lib/common/commands/post-install.js +1 -0
  69. package/lib/common/commands/preuninstall.js +11 -2
  70. package/lib/common/commands/proxy/proxy-base.js +4 -0
  71. package/lib/common/commands/proxy/proxy-clear.js +1 -0
  72. package/lib/common/commands/proxy/proxy-get.js +1 -0
  73. package/lib/common/commands/proxy/proxy-set.js +1 -0
  74. package/lib/common/common-lib.js +1 -0
  75. package/lib/common/constants.js +11 -0
  76. package/lib/common/decorators.js +48 -0
  77. package/lib/common/definitions/mobile.d.ts +1 -1
  78. package/lib/common/dispatchers.js +10 -1
  79. package/lib/common/errors.js +13 -3
  80. package/lib/common/file-system.js +13 -2
  81. package/lib/common/header.js +3 -0
  82. package/lib/common/helpers.js +89 -3
  83. package/lib/common/host-info.js +4 -0
  84. package/lib/common/http-client.js +20 -0
  85. package/lib/common/logger/appenders/cli-appender.js +4 -0
  86. package/lib/common/logger/appenders/emit-appender.js +4 -0
  87. package/lib/common/logger/layouts/cli-layout.js +1 -0
  88. package/lib/common/logger/logger.js +5 -0
  89. package/lib/common/messages/messages.js +6 -0
  90. package/lib/common/mobile/android/android-application-manager.js +20 -1
  91. package/lib/common/mobile/android/android-debug-bridge-result-handler.js +1 -0
  92. package/lib/common/mobile/android/android-debug-bridge.js +6 -0
  93. package/lib/common/mobile/android/android-device-file-system.js +4 -0
  94. package/lib/common/mobile/android/android-device-hash-service.js +3 -0
  95. package/lib/common/mobile/android/android-device.js +8 -0
  96. package/lib/common/mobile/android/android-emulator-services.js +2 -1
  97. package/lib/common/mobile/android/android-ini-file-parser.js +9 -0
  98. package/lib/common/mobile/android/android-log-filter.js +4 -0
  99. package/lib/common/mobile/android/android-virtual-device-service.js +26 -0
  100. package/lib/common/mobile/android/device-android-debug-bridge.js +1 -0
  101. package/lib/common/mobile/android/genymotion/genymotion-service.js +5 -0
  102. package/lib/common/mobile/android/genymotion/virtualbox-service.js +11 -0
  103. package/lib/common/mobile/android/logcat-helper.js +20 -1
  104. package/lib/common/mobile/application-manager-base.js +6 -0
  105. package/lib/common/mobile/device-emitter.js +4 -0
  106. package/lib/common/mobile/device-log-emitter.js +1 -0
  107. package/lib/common/mobile/device-log-provider-base.js +1 -0
  108. package/lib/common/mobile/device-log-provider.js +23 -0
  109. package/lib/common/mobile/device-platforms-constants.js +1 -0
  110. package/lib/common/mobile/emulator-helper.js +3 -0
  111. package/lib/common/mobile/ios/device/ios-application-manager.js +3 -0
  112. package/lib/common/mobile/ios/device/ios-device-file-system.js +1 -0
  113. package/lib/common/mobile/ios/device/ios-device-operations.js +4 -0
  114. package/lib/common/mobile/ios/device/ios-device.js +4 -0
  115. package/lib/common/mobile/ios/ios-device-base.js +1 -0
  116. package/lib/common/mobile/ios/ios-device-product-name-mapper.js +2 -0
  117. package/lib/common/mobile/ios/ios-log-filter.js +1 -0
  118. package/lib/common/mobile/ios/simulator/ios-emulator-services.js +4 -0
  119. package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +1 -0
  120. package/lib/common/mobile/ios/simulator/ios-simulator-application-manager.js +6 -0
  121. package/lib/common/mobile/ios/simulator/ios-simulator-device.js +5 -0
  122. package/lib/common/mobile/ios/simulator/ios-simulator-file-system.js +1 -0
  123. package/lib/common/mobile/ios/simulator/ios-simulator-log-provider.js +1 -0
  124. package/lib/common/mobile/local-to-device-path-data-factory.js +1 -0
  125. package/lib/common/mobile/log-filter.js +2 -0
  126. package/lib/common/mobile/logging-levels.js +1 -0
  127. package/lib/common/mobile/mobile-core/android-device-discovery.js +2 -0
  128. package/lib/common/mobile/mobile-core/android-emulator-discovery.js +3 -0
  129. package/lib/common/mobile/mobile-core/android-process-service.js +32 -0
  130. package/lib/common/mobile/mobile-core/device-discovery.js +1 -0
  131. package/lib/common/mobile/mobile-core/devices-service.js +72 -3
  132. package/lib/common/mobile/mobile-core/ios-device-discovery.js +3 -1
  133. package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +3 -0
  134. package/lib/common/mobile/mobile-helper.js +2 -1
  135. package/lib/common/mobile/wp8/wp8-emulator-services.js +1 -0
  136. package/lib/common/opener.js +1 -0
  137. package/lib/common/os-info.js +1 -0
  138. package/lib/common/plist-parser.js +1 -0
  139. package/lib/common/project-helper.js +1 -0
  140. package/lib/common/prompter.js +9 -1
  141. package/lib/common/queue.js +1 -0
  142. package/lib/common/resource-loader.js +1 -0
  143. package/lib/common/services/auto-completion-service.js +12 -1
  144. package/lib/common/services/cancellation.js +2 -1
  145. package/lib/common/services/commands-service.js +17 -6
  146. package/lib/common/services/help-service.js +11 -3
  147. package/lib/common/services/hooks-service.js +13 -0
  148. package/lib/common/services/ios-notification-service.js +1 -0
  149. package/lib/common/services/json-file-settings-service.js +6 -0
  150. package/lib/common/services/lock-service.js +6 -0
  151. package/lib/common/services/message-contract-generator.js +1 -0
  152. package/lib/common/services/messages-service.js +1 -0
  153. package/lib/common/services/micro-templating-service.js +6 -0
  154. package/lib/common/services/net-service.js +3 -0
  155. package/lib/common/services/project-files-manager.js +5 -0
  156. package/lib/common/services/project-files-provider-base.js +1 -0
  157. package/lib/common/services/proxy-service.js +1 -0
  158. package/lib/common/services/qr.js +1 -0
  159. package/lib/common/services/settings-service.js +1 -0
  160. package/lib/common/services/xcode-select-service.js +1 -0
  161. package/lib/common/utils.js +1 -0
  162. package/lib/common/validators/project-name-validator.js +1 -0
  163. package/lib/common/validators/validation-result.js +1 -0
  164. package/lib/common/verify-node-version.js +8 -1
  165. package/lib/common/yok.js +32 -11
  166. package/lib/config.js +22 -1
  167. package/lib/constants-provider.js +1 -0
  168. package/lib/constants.js +58 -5
  169. package/lib/controllers/build-controller.js +4 -3
  170. package/lib/controllers/debug-controller.js +8 -3
  171. package/lib/controllers/deploy-controller.js +1 -0
  172. package/lib/controllers/migrate-controller.js +91 -3
  173. package/lib/controllers/platform-controller.js +9 -1
  174. package/lib/controllers/prepare-controller.js +15 -5
  175. package/lib/controllers/run-controller.js +17 -1
  176. package/lib/controllers/update-controller-base.js +1 -0
  177. package/lib/controllers/update-controller.js +11 -0
  178. package/lib/data/build-data.js +1 -0
  179. package/lib/data/controller-data-base.js +1 -0
  180. package/lib/data/debug-data.js +1 -0
  181. package/lib/data/platform-data.js +1 -0
  182. package/lib/data/prepare-data.js +1 -0
  183. package/lib/data/run-data.js +1 -0
  184. package/lib/detached-processes/cleanup-js-subprocess.js +8 -2
  185. package/lib/detached-processes/cleanup-process.js +18 -14
  186. package/lib/detached-processes/file-log-service.js +2 -1
  187. package/lib/device-path-provider.js +3 -2
  188. package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +7 -0
  189. package/lib/device-sockets/ios/notification.js +3 -0
  190. package/lib/device-sockets/ios/socket-request-executor.js +3 -0
  191. package/lib/helpers/android-bundle-validator-helper.js +2 -1
  192. package/lib/helpers/deploy-command-helper.js +1 -0
  193. package/lib/helpers/key-command-helper.js +4 -2
  194. package/lib/helpers/livesync-command-helper.js +5 -2
  195. package/lib/helpers/network-connectivity-validator.js +1 -0
  196. package/lib/helpers/options-track-helper.js +3 -2
  197. package/lib/helpers/package-path-helper.js +1 -0
  198. package/lib/helpers/platform-command-helper.js +7 -2
  199. package/lib/helpers/version-validator-helper.js +1 -0
  200. package/lib/key-commands/bootstrap.js +3 -2
  201. package/lib/key-commands/index.js +5 -4
  202. package/lib/nativescript-cli-lib-bootstrap.js +4 -0
  203. package/lib/nativescript-cli-lib.js +1 -0
  204. package/lib/nativescript-cli.js +10 -1
  205. package/lib/node/pbxproj-dom-xcode.js +1 -0
  206. package/lib/node/xcode.js +1 -0
  207. package/lib/node-package-manager.js +11 -1
  208. package/lib/options.js +141 -115
  209. package/lib/package-installation-manager.js +8 -1
  210. package/lib/package-manager.js +2 -0
  211. package/lib/platform-command-param.js +1 -0
  212. package/lib/pnpm-package-manager.js +4 -1
  213. package/lib/project-data.js +12 -0
  214. package/lib/providers/project-files-provider.js +1 -0
  215. package/lib/resolvers/livesync-service-resolver.js +2 -1
  216. package/lib/services/analytics/analytics-broker-process.js +10 -6
  217. package/lib/services/analytics/analytics-broker.js +2 -1
  218. package/lib/services/analytics/analytics-service.js +29 -25
  219. package/lib/services/analytics/google-analytics-provider.js +13 -12
  220. package/lib/services/analytics-settings-service.js +5 -0
  221. package/lib/services/android/android-bundle-tool-service.js +1 -0
  222. package/lib/services/android/gradle-build-args-service.js +3 -0
  223. package/lib/services/android/gradle-build-service.js +1 -0
  224. package/lib/services/android/gradle-command-service.js +1 -0
  225. package/lib/services/android-device-debug-service.js +6 -0
  226. package/lib/services/android-plugin-build-service.js +28 -0
  227. package/lib/services/android-project-service.js +71 -4
  228. package/lib/services/android-resources-migration-service.js +7 -0
  229. package/lib/services/apple-portal/apple-portal-application-service.js +1 -0
  230. package/lib/services/apple-portal/apple-portal-cookie-service.js +1 -0
  231. package/lib/services/apple-portal/apple-portal-session-service.js +6 -4
  232. package/lib/services/assets-generation/assets-generation-service.js +16 -5
  233. package/lib/services/build-artifacts-service.js +2 -1
  234. package/lib/services/build-data-service.js +2 -1
  235. package/lib/services/build-info-file-service.js +1 -0
  236. package/lib/services/cleanup-service.js +13 -9
  237. package/lib/services/cocoapods-platform-manager.js +9 -0
  238. package/lib/services/cocoapods-service.js +21 -1
  239. package/lib/services/debug-data-service.js +1 -0
  240. package/lib/services/debug-service-base.js +7 -0
  241. package/lib/services/device/device-install-app-service.js +2 -1
  242. package/lib/services/doctor-service.js +21 -6
  243. package/lib/services/extensibility-service.js +8 -0
  244. package/lib/services/files-hash-service.js +1 -0
  245. package/lib/services/hmr-status-service.js +2 -0
  246. package/lib/services/info-service.js +1 -0
  247. package/lib/services/initialize-service.js +5 -1
  248. package/lib/services/ios/export-options-plist-service.js +4 -0
  249. package/lib/services/ios/ios-signing-service.js +4 -0
  250. package/lib/services/ios/spm-service.js +10 -1
  251. package/lib/services/ios/xcodebuild-args-service.js +13 -4
  252. package/lib/services/ios/xcodebuild-command-service.js +1 -0
  253. package/lib/services/ios/xcodebuild-service.js +1 -0
  254. package/lib/services/ios-debugger-port-service.js +1 -0
  255. package/lib/services/ios-device-debug-service.js +1 -0
  256. package/lib/services/ios-entitlements-service.js +1 -0
  257. package/lib/services/ios-extensions-service.js +1 -0
  258. package/lib/services/ios-log-filter.js +20 -0
  259. package/lib/services/ios-native-target-service.js +6 -4
  260. package/lib/services/ios-project-service.js +29 -7
  261. package/lib/services/ios-provision-service.js +3 -0
  262. package/lib/services/ios-watch-app-service.js +1 -0
  263. package/lib/services/ip-service.js +2 -0
  264. package/lib/services/itmstransporter-service.js +1 -0
  265. package/lib/services/karma-execution.js +2 -0
  266. package/lib/services/livesync/android-device-livesync-service-base.js +1 -0
  267. package/lib/services/livesync/android-device-livesync-service.js +2 -0
  268. package/lib/services/livesync/android-device-livesync-sockets-service.js +3 -0
  269. package/lib/services/livesync/android-livesync-service.js +1 -0
  270. package/lib/services/livesync/android-livesync-tool.js +4 -0
  271. package/lib/services/livesync/device-livesync-service-base.js +2 -0
  272. package/lib/services/livesync/ios-device-livesync-service.js +7 -0
  273. package/lib/services/livesync/ios-livesync-service.js +2 -0
  274. package/lib/services/livesync/livesync-socket.js +1 -0
  275. package/lib/services/livesync/platform-livesync-service-base.js +5 -0
  276. package/lib/services/livesync-process-data-service.js +1 -0
  277. package/lib/services/log-parser-service.js +1 -0
  278. package/lib/services/log-source-map-service.js +15 -0
  279. package/lib/services/marking-mode-service.js +8 -5
  280. package/lib/services/metadata-filtering-service.js +1 -0
  281. package/lib/services/npm-config-service.js +4 -0
  282. package/lib/services/pacote-service.js +7 -0
  283. package/lib/services/performance-service.js +3 -1
  284. package/lib/services/platform/add-platform-service.js +47 -2
  285. package/lib/services/platform/platform-validation-service.js +1 -0
  286. package/lib/services/platform/prepare-native-platform-service.js +5 -2
  287. package/lib/services/platform-environment-requirements.js +8 -3
  288. package/lib/services/platform-project-service-base.js +1 -0
  289. package/lib/services/platforms-data-service.js +1 -0
  290. package/lib/services/plugins-service.js +18 -2
  291. package/lib/services/prepare-data-service.js +2 -1
  292. package/lib/services/project-backup-service.js +4 -0
  293. package/lib/services/project-changes-service.js +12 -3
  294. package/lib/services/project-cleanup-service.js +2 -0
  295. package/lib/services/project-config-service.js +18 -1
  296. package/lib/services/project-data-service.js +36 -7
  297. package/lib/services/project-name-service.js +1 -0
  298. package/lib/services/project-service.js +10 -0
  299. package/lib/services/project-templates-service.js +3 -2
  300. package/lib/services/qr-code-terminal-service.js +1 -0
  301. package/lib/services/require-service.js +1 -0
  302. package/lib/services/start-service.js +1 -0
  303. package/lib/services/temp-service.js +1 -0
  304. package/lib/services/terminal-spinner-service.js +2 -0
  305. package/lib/services/test-execution-service.js +9 -2
  306. package/lib/services/test-initialization-service.js +4 -0
  307. package/lib/services/timeline-profiler-service.js +1 -0
  308. package/lib/services/user-settings-service.js +1 -0
  309. package/lib/services/versions-service.js +6 -4
  310. package/lib/services/watch-ignore-list-service.js +1 -0
  311. package/lib/services/webpack/webpack-compiler-service.js +42 -1
  312. package/lib/services/xcconfig-service.js +2 -0
  313. package/lib/services/xcproj-service.js +1 -0
  314. package/lib/shared-event-bus.js +6 -0
  315. package/lib/sys-info.js +2 -1
  316. package/lib/tools/config-manipulation/config-transformer.js +12 -0
  317. package/lib/tools/node-modules/node-modules-builder.js +1 -0
  318. package/lib/tools/node-modules/node-modules-dependencies-builder.js +6 -0
  319. package/lib/yarn-package-manager.js +1 -0
  320. package/lib/yarn2-package-manager.js +3 -0
  321. package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +15 -0
  322. package/node_modules/rimraf/CHANGELOG.md +65 -0
  323. package/node_modules/stringify-package/CHANGELOG.md +16 -0
  324. package/package.json +1 -1
@@ -36,6 +36,9 @@ class HttpClient {
36
36
  catch (err) {
37
37
  if (err.message === HttpClient.STUCK_REQUEST_ERROR_MESSAGE ||
38
38
  err.message === HttpClient.STUCK_RESPONSE_ERROR_MESSAGE) {
39
+ // Retry the request immediately because there are at least 10 seconds between the two requests.
40
+ // We have to retry only once the sporadically stuck requests/responses.
41
+ // We can add exponential backoff retry here if we decide that we need to workaround bigger network issues on the client side.
39
42
  this.$logger.warn("%s Retrying request to %s...", err.message, options.url || options);
40
43
  const retryResult = yield this.httpRequestCore(options, proxySettings);
41
44
  return {
@@ -63,6 +66,7 @@ class HttpClient {
63
66
  yield this.useProxySettings(proxySettings, cliProxySettings, options, headers, requestProto);
64
67
  if (!headers["User-Agent"]) {
65
68
  if (!this.defaultUserAgent) {
69
+ //TODO: the user agent client name is also passed explicitly during login and should be kept in sync
66
70
  this.defaultUserAgent = `${this.$staticConfig.USER_AGENT_NAME}/${this.$staticConfig.version} (Node.js ${process.versions.node}; ${process.platform}; ${process.arch})`;
67
71
  this.$logger.trace("User-Agent: %s", this.defaultUserAgent);
68
72
  }
@@ -91,14 +95,19 @@ class HttpClient {
91
95
  }).catch((err) => {
92
96
  this.$logger.trace("An error occurred while sending the request:", err);
93
97
  if (err.response) {
98
+ // The request was made and the server responded with a status code
99
+ // that falls out of the range of 2xx
94
100
  const errorMessage = this.getErrorMessage(err.response.status, null);
95
101
  err.proxyAuthenticationRequired =
96
102
  err.response.status === constants_1.HttpStatusCodes.PROXY_AUTHENTICATION_REQUIRED;
97
103
  err.message = errorMessage || err.message;
98
104
  }
99
105
  else if (err.request) {
106
+ // The request was made but no response was received
107
+ // `err.request` is an instance of XMLHttpRequest in the browser and an instance of
100
108
  }
101
109
  else {
110
+ // Something happened in setting up the request that triggered an Error
102
111
  }
103
112
  throw err;
104
113
  });
@@ -145,9 +154,18 @@ class HttpClient {
145
154
  return body;
146
155
  }
147
156
  }
157
+ /**
158
+ * This method respects the proxySettings (or proxyCache) by modifying headers and options passed to http(s) module.
159
+ * @param {IProxySettings} proxySettings The settings passed for this specific call.
160
+ * @param {IProxySettings} cliProxySettings The globally set proxy for this CLI.
161
+ * @param {any}options The object that will be passed to http(s) module.
162
+ * @param {any} headers Headers of the current request.
163
+ * @param {string} requestProto The protocol used for the current request - http or https.
164
+ */
148
165
  useProxySettings(proxySettings, cliProxySettings, options, headers, requestProto) {
149
166
  return __awaiter(this, void 0, void 0, function* () {
150
167
  const isLocalRequest = options.host === "localhost" || options.host === "127.0.0.1";
168
+ // don't use the proxy for requests to localhost
151
169
  if (!isLocalRequest && (proxySettings || cliProxySettings)) {
152
170
  const proto = (proxySettings && proxySettings.protocol) ||
153
171
  cliProxySettings.protocol ||
@@ -158,6 +176,7 @@ class HttpClient {
158
176
  if (cliProxySettings.username && cliProxySettings.password) {
159
177
  credentialsPart = `${cliProxySettings.username}:${cliProxySettings.password}@`;
160
178
  }
179
+ // Note that proto ends with :
161
180
  options.proxy = `${proto}//${credentialsPart}${host}:${port}`;
162
181
  options.rejectUnauthorized = proxySettings
163
182
  ? proxySettings.rejectUnauthorized
@@ -171,3 +190,4 @@ HttpClient.STUCK_REQUEST_ERROR_MESSAGE = "The request can't receive any response
171
190
  HttpClient.STUCK_RESPONSE_ERROR_MESSAGE = "Can't receive all parts of the response.";
172
191
  exports.HttpClient = HttpClient;
173
192
  yok_1.injector.register("httpClient", HttpClient);
193
+ //# sourceMappingURL=http-client.js.map
@@ -15,10 +15,14 @@ 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
  }
24
27
  exports.configure = configure;
28
+ //# sourceMappingURL=cli-appender.js.map
@@ -21,10 +21,14 @@ 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
  }
30
33
  exports.configure = configure;
34
+ //# sourceMappingURL=emit-appender.js.map
@@ -31,3 +31,4 @@ function layout(config) {
31
31
  };
32
32
  }
33
33
  exports.layout = layout;
34
+ //# 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
  ], Logger.prototype, "initialize", null);
198
202
  exports.Logger = Logger;
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
@@ -38,7 +38,7 @@ class AndroidApplicationManager extends application_manager_base_1.ApplicationMa
38
38
  this.$deviceLogProvider = $deviceLogProvider;
39
39
  this.$errors = $errors;
40
40
  this.PID_CHECK_INTERVAL = 100;
41
- this.PID_CHECK_TIMEOUT = 10000;
41
+ this.PID_CHECK_TIMEOUT = 10000; // 10 secs
42
42
  }
43
43
  getInstalledApplications() {
44
44
  return __awaiter(this, void 0, void 0, function* () {
@@ -80,6 +80,7 @@ class AndroidApplicationManager extends application_manager_base_1.ApplicationMa
80
80
  });
81
81
  }
82
82
  uninstallApplication(appIdentifier) {
83
+ // 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
83
84
  return this.adb.executeShellCommand(["pm", "uninstall", `${appIdentifier}`], { treatErrorsAsWarnings: true });
84
85
  }
85
86
  startApplication(appData) {
@@ -89,9 +90,24 @@ class AndroidApplicationManager extends application_manager_base_1.ApplicationMa
89
90
  `cat /dev/null > ${constants_1.LiveSyncPaths.ANDROID_TMP_DIR_NAME}/${appData.appId}-debugbreak`,
90
91
  ]);
91
92
  }
93
+ // If the app is debuggable, the Runtime will update the file when its ready for debugging
94
+ // and we will be able to take decisions and synchronize the debug experience based on the content
92
95
  yield this.adb.executeShellCommand([
93
96
  `cat /dev/null > ${constants_1.LiveSyncPaths.ANDROID_TMP_DIR_NAME}/${appData.appId}-debugger-started`,
94
97
  ]);
98
+ /*
99
+ Example "pm dump <app_identifier> | grep -A 1 MAIN" output"
100
+ android.intent.action.MAIN:
101
+ 3b2df03 org.nativescript.cliapp/com.tns.NativeScriptActivity filter 50dd82e
102
+ Action: "android.intent.action.MAIN"
103
+ Category: "android.intent.category.LAUNCHER"
104
+ --
105
+ intent={act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.nativescript.cliapp/com.tns.NativeScriptActivity}
106
+ realActivity=org.nativescript.cliapp/com.tns.NativeScriptActivity
107
+ --
108
+ Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.nativescript.cliapp/com.tns.NativeScriptActivity }
109
+ frontOfTask=true task=TaskRecord{fe592ac #449 A=org.nativescript.cliapp U=0 StackId=1 sz=1}
110
+ */
95
111
  const appIdentifier = appData.appId;
96
112
  const pmDumpOutput = yield this.adb.executeShellCommand([
97
113
  "pm",
@@ -143,6 +159,8 @@ class AndroidApplicationManager extends application_manager_base_1.ApplicationMa
143
159
  pid: processIdentifier,
144
160
  appId: appIdentifier,
145
161
  onAppRestarted: () => {
162
+ // If the app restarts, we update the PID and
163
+ // restart log helper.
146
164
  this.onAppLaunch(appData);
147
165
  },
148
166
  });
@@ -226,3 +244,4 @@ __decorate([
226
244
  (0, decorators_1.cache)()
227
245
  ], AndroidApplicationManager.prototype, "getFullyQualifiedActivityRegex", null);
228
246
  exports.AndroidApplicationManager = AndroidApplicationManager;
247
+ //# sourceMappingURL=android-application-manager.js.map
@@ -330,3 +330,4 @@ AndroidDebugBridgeResultHandler.ANDROID_DEBUG_BRIDGE_ERRORS = [
330
330
  ];
331
331
  exports.AndroidDebugBridgeResultHandler = AndroidDebugBridgeResultHandler;
332
332
  yok_1.injector.register("androidDebugBridgeResultHandler", AndroidDebugBridgeResultHandler);
333
+ //# sourceMappingURL=android-debug-bridge-result-handler.js.map
@@ -50,11 +50,15 @@ class AndroidDebugBridge {
50
50
  return this.$childProcess.spawn(command.command, command.args);
51
51
  }
52
52
  }
53
+ // If adb -s <invalid device id> install <smth> is executed the childProcess won't get any response
54
+ // because the adb will be waiting for valid device and will not send close or exit event.
55
+ // For example `adb -s <invalid device id> install <smth>` throws error 'error: device \'030939f508e6c773\' not found\r\n' exitCode 4294967295
53
56
  const result = yield this.$childProcess.spawnFromEvent(command.command, command.args, event, childProcessOptions, { throwError: false });
54
57
  const errors = this.$androidDebugBridgeResultHandler.checkForErrors(result);
55
58
  if (errors && errors.length > 0) {
56
59
  this.$androidDebugBridgeResultHandler.handleErrors(errors, treatErrorsAsWarnings);
57
60
  }
61
+ // Some adb commands returns array of strings instead of object with stdout and stderr. (adb start-server)
58
62
  return result.stdout === undefined || result.stdout === null
59
63
  ? result
60
64
  : result.stdout;
@@ -143,6 +147,7 @@ class AndroidDebugBridge {
143
147
  pushFile(localFilePath, deviceFilePath) {
144
148
  return __awaiter(this, void 0, void 0, function* () {
145
149
  const fileDirectory = (0, helpers_1.fromWindowsRelativePathToUnix)(path.dirname(deviceFilePath));
150
+ // starting from API level 28, the push command is returning an error if the directory does not exist
146
151
  yield this.executeShellCommand(["mkdir", "-p", fileDirectory]);
147
152
  yield this.executeCommand(["push", localFilePath, deviceFilePath]);
148
153
  yield this.executeShellCommand(["chmod", "0777", fileDirectory]);
@@ -165,3 +170,4 @@ __decorate([
165
170
  ], AndroidDebugBridge.prototype, "getDevices", null);
166
171
  exports.AndroidDebugBridge = AndroidDebugBridge;
167
172
  yok_1.injector.register("adb", AndroidDebugBridge);
173
+ //# sourceMappingURL=android-debug-bridge.js.map
@@ -94,6 +94,8 @@ class AndroidDeviceFileSystem {
94
94
  }
95
95
  transferDirectory(deviceAppData, localToDevicePaths, projectFilesPath) {
96
96
  return __awaiter(this, void 0, void 0, function* () {
97
+ // starting from Android 9, adb push is throwing an exception when there are subfolders
98
+ // the check could be removed when we start supporting only runtime versions with sockets
97
99
  const minAndroidWithoutAdbPushDir = "9.0.0";
98
100
  const isAdbPushDirSupported = semver.lt(semver.coerce(deviceAppData.device.deviceInfo.version), minAndroidWithoutAdbPushDir);
99
101
  const deviceProjectDir = yield deviceAppData.getDeviceProjectRootPath();
@@ -148,6 +150,7 @@ class AndroidDeviceFileSystem {
148
150
  const hostTmpDir = yield this.$tempService.mkdirSync("application-");
149
151
  const commandsFileHostPath = path.join(hostTmpDir, "temp.commands.file");
150
152
  this.$fs.writeFile(commandsFileHostPath, fileContent);
153
+ // copy it to the device
151
154
  yield this.transferFile(commandsFileHostPath, deviceFilePath);
152
155
  yield this.adb.executeShellCommand(["chmod", "0777", deviceFilePath]);
153
156
  });
@@ -174,3 +177,4 @@ class AndroidDeviceFileSystem {
174
177
  }
175
178
  }
176
179
  exports.AndroidDeviceFileSystem = AndroidDeviceFileSystem;
180
+ //# sourceMappingURL=android-device-file-system.js.map
@@ -69,6 +69,8 @@ class AndroidDeviceHashService {
69
69
  const action = (localToDevicePathData) => __awaiter(this, void 0, void 0, function* () {
70
70
  const localPath = localToDevicePathData.getLocalPath();
71
71
  if (this.$fs.getFsStats(localPath).isFile()) {
72
+ // TODO: Use relative to project path for key
73
+ // This will speed up livesync on the same device for the same project on different PCs.
72
74
  initialShasums[localPath] = yield this.$fs.getFileShasum(localPath);
73
75
  }
74
76
  });
@@ -131,3 +133,4 @@ __decorate([
131
133
  (0, decorators_1.cache)()
132
134
  ], AndroidDeviceHashService.prototype, "getTempDir", null);
133
135
  exports.AndroidDeviceHashService = AndroidDeviceHashService;
136
+ //# sourceMappingURL=android-device-hash-service.js.map
@@ -42,6 +42,8 @@ class AndroidDevice {
42
42
  this.fileSystem = this.$injector.resolve(fileSystemPath.AndroidDeviceFileSystem, { adb: this.adb });
43
43
  let details = yield this.getDeviceDetails(["getprop"]);
44
44
  if (!details || !details.name) {
45
+ // In older CLI versions we are calling cat /system/build.prop to get details.
46
+ // Keep this logic for compatibility and possibly for devices for which getprop is not working
45
47
  details = yield this.getDeviceDetails(["cat", "/system/build.prop"]);
46
48
  }
47
49
  this.$logger.trace(details);
@@ -102,6 +104,9 @@ class AndroidDevice {
102
104
  try {
103
105
  const details = yield this.adb.executeShellCommand(shellCommandArgs);
104
106
  details.split(/\r?\n|\r/).forEach((value) => {
107
+ // sample line is "ro.build.version.release=4.4" in /system/build.prop
108
+ // sample line from getprop is: [ro.build.version.release]: [6.0]
109
+ // NOTE: some props do not have value: [ro.build.version.base_os]: []
105
110
  const match = /(?:\[?ro\.build\.version|ro\.product|ro\.build)\.(.+?)]?(?:\:|=)(?:\s*?\[)?(.*?)]?$/.exec(value);
106
111
  if (match) {
107
112
  parsedDetails[match[1]] = match[2];
@@ -116,6 +121,7 @@ class AndroidDevice {
116
121
  });
117
122
  }
118
123
  getIsTablet(details) {
124
+ //version 3.x.x (also known as Honeycomb) is a tablet only version
119
125
  return (details &&
120
126
  (_.startsWith(details.release, "3.") ||
121
127
  _.includes((details.characteristics || "").toLowerCase(), "tablet")));
@@ -130,6 +136,7 @@ class AndroidDevice {
130
136
  });
131
137
  }
132
138
  }
139
+ // http://stackoverflow.com/questions/31178195/what-does-adb-device-status-mean
133
140
  AndroidDevice.ADB_DEVICE_STATUS_INFO = {
134
141
  device: {
135
142
  errorHelp: null,
@@ -156,3 +163,4 @@ __decorate([
156
163
  (0, decorators_1.cache)()
157
164
  ], AndroidDevice.prototype, "init", null);
158
165
  exports.AndroidDevice = AndroidDevice;
166
+ //# sourceMappingURL=android-device.js.map
@@ -121,7 +121,7 @@ class AndroidEmulatorServices {
121
121
  endTimeEpoch,
122
122
  };
123
123
  }
124
- yield (0, helpers_1.sleep)(10000);
124
+ yield (0, helpers_1.sleep)(10000); // the emulator definitely takes its time to wake up
125
125
  hasTimeLeft = (0, helpers_1.getCurrentEpochTime)() < endTimeEpoch;
126
126
  }
127
127
  if (!hasTimeLeft && !isInfiniteWait) {
@@ -203,3 +203,4 @@ class AndroidEmulatorServices {
203
203
  }
204
204
  exports.AndroidEmulatorServices = AndroidEmulatorServices;
205
205
  yok_1.injector.register("androidEmulatorServices", AndroidEmulatorServices);
206
+ //# 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) => {
@@ -42,6 +44,8 @@ class AndroidIniFileParser {
42
44
  }, Object.create(null));
43
45
  }
44
46
  getAvdEncoding(avdName) {
47
+ // avd files can have different encoding, defined on the first line.
48
+ // find which one it is (if any) and use it to correctly read the file contents
45
49
  let encoding = "utf8";
46
50
  let contents = this.$fs.readText(avdName, "ascii");
47
51
  if (contents.length > 0) {
@@ -55,18 +59,22 @@ class AndroidIniFileParser {
55
59
  }
56
60
  return encoding;
57
61
  }
62
+ // Android L is not written as a number in the .ini files, and we need to convert it
58
63
  readTargetNum(target) {
59
64
  const platform = target.replace("android-", "");
60
65
  let platformNumber = +platform;
61
66
  if (isNaN(platformNumber)) {
67
+ // this may be a google image
62
68
  const googlePlatform = target.split(":")[2];
63
69
  if (googlePlatform) {
64
70
  platformNumber = +googlePlatform;
65
71
  }
66
72
  else if (platform === "L") {
73
+ // Android SDK 20 preview
67
74
  platformNumber = 20;
68
75
  }
69
76
  else if (platform === "MNC") {
77
+ // Android M preview
70
78
  platformNumber = 22;
71
79
  }
72
80
  }
@@ -75,3 +83,4 @@ class AndroidIniFileParser {
75
83
  }
76
84
  exports.AndroidIniFileParser = AndroidIniFileParser;
77
85
  yok_1.injector.register("androidIniFileParser", AndroidIniFileParser);
86
+ //# sourceMappingURL=android-ini-file-parser.js.map
@@ -36,7 +36,11 @@ class AndroidLogFilter {
36
36
  return consoleLogMessage;
37
37
  }
38
38
  }
39
+ //sample line is "I/Web Console( 4438): Received Event: deviceready at file:///storage/emulated/0/Icenium/com.telerik.TestApp/js/index.js:48"
39
40
  AndroidLogFilter.LINE_REGEX = /.\/(.+?)\s*\(\s*\d+?\): (.*)/;
41
+ // 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"
42
+ // or '12-28 10:45:08.020 3329 3329 W chromium: [WARNING:data_reduction_proxy_settings.cc(328)] SPDY proxy OFF at startup'
40
43
  AndroidLogFilter.API_LEVEL_23_LINE_REGEX = /.+?\s+?(?:[A-Z]\s+?)([A-Za-z \.]+?)\s*?\: (.*)/;
41
44
  exports.AndroidLogFilter = AndroidLogFilter;
42
45
  yok_1.injector.register("androidLogFilter", AndroidLogFilter);
46
+ //# sourceMappingURL=android-log-filter.js.map
@@ -84,6 +84,9 @@ class AndroidVirtualDeviceService {
84
84
  get pathToEmulatorExecutable() {
85
85
  const emulatorExecutableName = "emulator";
86
86
  if (this.androidHome) {
87
+ // Check https://developer.android.com/studio/releases/sdk-tools.html (25.3.0)
88
+ // Since this version of SDK tools, the emulator is a separate package.
89
+ // However the emulator executable still exists in the "tools" dir.
87
90
  const pathToEmulatorFromAndroidStudio = path.join(this.androidHome, emulatorExecutableName, emulatorExecutableName);
88
91
  const realFilePath = this.$hostInfo.isWindows
89
92
  ? `${pathToEmulatorFromAndroidStudio}.exe`
@@ -123,6 +126,17 @@ class AndroidVirtualDeviceService {
123
126
  client.on("data", (data) => {
124
127
  output += data.toString();
125
128
  const imageIdentifier = this.getImageIdentifierFromClientOutput(output);
129
+ // old output should look like:
130
+ // Android Console: type 'help' for a list of commands
131
+ // OK
132
+ // <Name of image>
133
+ // OK
134
+ // new output should look like:
135
+ // Android Console: type 'help' for a list of commands
136
+ // OK
137
+ // a\u001b[K\u001b[Dav\u001b[K\u001b[D\u001b[Davd\u001b...
138
+ // <Name of image>
139
+ // OK
126
140
  if (imageIdentifier && !isResolved) {
127
141
  this.mapEmulatorIdToImageIdentifier[emulatorId] = imageIdentifier;
128
142
  this.clearNetConnection(client, timer);
@@ -174,6 +188,8 @@ class AndroidVirtualDeviceService {
174
188
  if (this.pathToAvdManagerExecutable &&
175
189
  this.$fs.exists(this.pathToAvdManagerExecutable)) {
176
190
  if (process.env.JAVA_HOME) {
191
+ // 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
192
+ // no matter if you have correct java in PATH.
177
193
  canExecute = !!(yield this.$sysInfo.getJavaVersionFromJavaHome());
178
194
  }
179
195
  else {
@@ -248,6 +264,13 @@ class AndroidVirtualDeviceService {
248
264
  const avdOutput = output.split(constants_1.AndroidVirtualDevice.AVAILABLE_AVDS_MESSAGE);
249
265
  const availableDevices = avdOutput && avdOutput[1] && avdOutput[1].trim();
250
266
  if (availableDevices) {
267
+ // In some cases `avdmanager list avds` command prints:
268
+ // `The following Android Virtual Devices could not be loaded:
269
+ // Name: Pixel_2_XL_API_28
270
+ // Path: /Users/<username>/.android/avd/Pixel_2_XL_API_28.avd
271
+ // Error: Google pixel_2_xl no longer exists as a device`
272
+ // These devices sometimes are valid so try to parse them.
273
+ // Also these devices are printed at the end of the output and are separated with 2 new lines from the valid devices output.
251
274
  const parts = availableDevices.split(/(?:\r?\n){2}/);
252
275
  const items = [parts[0], parts[1]].filter((item) => !!item);
253
276
  for (const item of items) {
@@ -264,6 +287,7 @@ class AndroidVirtualDeviceService {
264
287
  }
265
288
  getAvdManagerDeviceInfo(output) {
266
289
  const avdManagerDeviceInfo = Object.create(null);
290
+ // Split by `\n`, not EOL as the avdmanager and android executables print results with `\n` only even on Windows
267
291
  _.reduce(output.split("\n"), (result, row) => {
268
292
  const [key, value] = row.split(": ").map((part) => part.trim());
269
293
  switch (key) {
@@ -310,6 +334,7 @@ class AndroidVirtualDeviceService {
310
334
  };
311
335
  }
312
336
  getImageIdentifierFromClientOutput(output) {
337
+ // 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.
313
338
  const lines = _.map(output.split(os_1.EOL), (line) => line.trim());
314
339
  const firstIndexOfOk = _.indexOf(lines, "OK");
315
340
  if (firstIndexOfOk < 0) {
@@ -358,3 +383,4 @@ __decorate([
358
383
  ], AndroidVirtualDeviceService.prototype, "getConfigurationError", null);
359
384
  exports.AndroidVirtualDeviceService = AndroidVirtualDeviceService;
360
385
  yok_1.injector.register("androidVirtualDeviceService", AndroidVirtualDeviceService);
386
+ //# sourceMappingURL=android-virtual-device-service.js.map
@@ -46,3 +46,4 @@ class DeviceAndroidDebugBridge extends android_debug_bridge_1.AndroidDebugBridge
46
46
  }
47
47
  }
48
48
  exports.DeviceAndroidDebugBridge = DeviceAndroidDebugBridge;
49
+ //# sourceMappingURL=device-android-debug-bridge.js.map
@@ -54,6 +54,7 @@ class AndroidGenymotionService {
54
54
  .map((row) => __awaiter(this, void 0, void 0, function* () {
55
55
  const match = row.match(/^(.+?)\s+device$/);
56
56
  if (match && match[1]) {
57
+ // possible genymotion emulator
57
58
  const emulatorId = match[1];
58
59
  const result = (yield this.isGenymotionEmulator(emulatorId))
59
60
  ? emulatorId
@@ -113,6 +114,7 @@ class AndroidGenymotionService {
113
114
  return runningEmulator;
114
115
  });
115
116
  }
117
+ // https://wiki.appcelerator.org/display/guides2/Installing+Genymotion
116
118
  get playerSearchPaths() {
117
119
  return {
118
120
  darwin: [
@@ -163,6 +165,7 @@ class AndroidGenymotionService {
163
165
  };
164
166
  }
165
167
  getSdkVersion(output) {
168
+ // Example -> Name: android_version, value: 6.0.0, timestamp: 1530090506102029000, flags:
166
169
  const androidApiLevelRow = output
167
170
  .split("\n")
168
171
  .filter((row) => !!row)
@@ -191,6 +194,7 @@ In case you have installed Genymotion in a different location, please add the pa
191
194
  getConfigurationError() {
192
195
  return __awaiter(this, void 0, void 0, function* () {
193
196
  const result = yield this.$childProcess.trySpawnFromCloseEvent(this.pathToEmulatorExecutable, [], {}, { throwError: false });
197
+ // When player is spawned, it always prints message on stderr.
194
198
  if (result &&
195
199
  result.stderr &&
196
200
  result.stderr.indexOf(constants_1.AndroidVirtualDevice.GENYMOTION_DEFAULT_STDERR_STRING) === -1) {
@@ -209,3 +213,4 @@ __decorate([
209
213
  ], AndroidGenymotionService.prototype, "getConfigurationError", null);
210
214
  exports.AndroidGenymotionService = AndroidGenymotionService;
211
215
  yok_1.injector.register("androidGenymotionService", AndroidGenymotionService);
216
+ //# sourceMappingURL=genymotion-service.js.map
@@ -44,6 +44,7 @@ class VirtualBoxService {
44
44
  .split(os_1.EOL)
45
45
  .filter((row) => !!row)
46
46
  .map((row) => {
47
+ // Example row: "Google Nexus 4 - 5.0.0 - API 21 - 768x1280" {9d9beef2-cc60-4a54-bcc0-cc1dbf89811f}
47
48
  const [rawName, rawId] = row.split('" ');
48
49
  const id = rawId.substr(1, rawId.length - 2);
49
50
  const name = rawName.substr(1, rawName.length - 1);
@@ -84,6 +85,15 @@ class VirtualBoxService {
84
85
  if (this.$hostInfo.isWindows) {
85
86
  let searchPath = null;
86
87
  try {
88
+ /* This can be used as interface!!!!
89
+ arch:null
90
+ hive:"HKLM"
91
+ host:""
92
+ key:"\Software\Oracle\VirtualBox"
93
+ name:"InstallDir"
94
+ type:"REG_SZ"
95
+ value:"C:\Program Files\Oracle\VirtualBox\"
96
+ */
87
97
  const result = yield (0, helpers_1.getWinRegPropertyValue)("\\Software\\Oracle\\VirtualBox", "InstallDir");
88
98
  searchPath = result && result.value ? result.value : null;
89
99
  }
@@ -119,3 +129,4 @@ __decorate([
119
129
  ], VirtualBoxService.prototype, "getvBoxManagePath", null);
120
130
  exports.VirtualBoxService = VirtualBoxService;
121
131
  yok_1.injector.register("virtualBoxService", VirtualBoxService);
132
+ //# sourceMappingURL=virtualbox-service.js.map
@@ -50,6 +50,7 @@ class LogcatHelper {
50
50
  }
51
51
  }
52
52
  catch (err) {
53
+ // Ignore the error, the process is dead.
53
54
  }
54
55
  });
55
56
  lineStream.on("data", (lineBuffer) => {
@@ -70,8 +71,15 @@ class LogcatHelper {
70
71
  return;
71
72
  const lines = (lineBuffer.toString() || "").split("\n");
72
73
  for (let line of lines) {
73
- if (line.includes("START") &&
74
+ // 09-11 17:50:26.311 598 1979 I ActivityTaskManager: START u0 {flg=0x10000000 cmp=org.nativescript.myApp/com.tns.NativeScriptActivity} from uid 2000
75
+ // ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^
76
+ // action appId pid
77
+ if (
78
+ // action
79
+ line.includes("START") &&
80
+ // appId
74
81
  line.includes(options.appId) &&
82
+ // pid - only if it's not the current pid...
75
83
  !line.includes(options.pid)) {
76
84
  this.forceStop(deviceIdentifier);
77
85
  (_b = options.onAppRestarted) === null || _b === void 0 ? void 0 : _b.call(options);
@@ -98,6 +106,9 @@ class LogcatHelper {
98
106
  });
99
107
  });
100
108
  }
109
+ /**
110
+ * Stops the logcat process for the specified device if keepSingleProcess is not passed on start
111
+ */
101
112
  stop(deviceIdentifier) {
102
113
  if (this.mapDevicesLoggingData[deviceIdentifier] &&
103
114
  !this.mapDevicesLoggingData[deviceIdentifier].keepSingleProcess) {
@@ -114,6 +125,9 @@ class LogcatHelper {
114
125
  (_e = loggingData.lineStream) === null || _e === void 0 ? void 0 : _e.removeAllListeners();
115
126
  delete this.mapDevicesLoggingData[deviceIdentifier];
116
127
  }
128
+ /**
129
+ * @deprecated - we likely don't need this anymore, and can simplify the code...
130
+ */
117
131
  isLogcatPidSupported(deviceIdentifier) {
118
132
  return __awaiter(this, void 0, void 0, function* () {
119
133
  const device = yield this.$devicesService.getDevice(deviceIdentifier);
@@ -126,6 +140,7 @@ class LogcatHelper {
126
140
  return __awaiter(this, void 0, void 0, function* () {
127
141
  const isLogcatPidSupported = yield this.isLogcatPidSupported(deviceIdentifier);
128
142
  const adb = this.$injector.resolve(device_android_debug_bridge_1.DeviceAndroidDebugBridge, { identifier: deviceIdentifier });
143
+ // -T 1 - shows only new logs after starting adb logcat
129
144
  const logcatCommand = ["logcat", "-T", "1"];
130
145
  const acceptedTags = [
131
146
  "chromium",
@@ -138,6 +153,7 @@ class LogcatHelper {
138
153
  if (pid && isLogcatPidSupported) {
139
154
  logcatCommand.push(`--pid=${pid}`);
140
155
  acceptedTags.forEach((tag) => {
156
+ // -s <tag> - shows only logs with the specified tag
141
157
  logcatCommand.push("-s", tag);
142
158
  });
143
159
  }
@@ -150,6 +166,8 @@ class LogcatHelper {
150
166
  getAppStartTrackingLogcatStream(deviceIdentifier, appId) {
151
167
  return __awaiter(this, void 0, void 0, function* () {
152
168
  const adb = this.$injector.resolve(device_android_debug_bridge_1.DeviceAndroidDebugBridge, { identifier: deviceIdentifier });
169
+ // -b system - shows the system buffer/logs only
170
+ // -T 1 - shows only new logs after starting adb logcat
153
171
  const logcatCommand = [`logcat`, `-b`, `system`, `-T`, `1`];
154
172
  if (appId) {
155
173
  logcatCommand.push(`--regex=START.*${appId}`);
@@ -163,3 +181,4 @@ class LogcatHelper {
163
181
  }
164
182
  exports.LogcatHelper = LogcatHelper;
165
183
  yok_1.injector.register("logcatHelper", LogcatHelper);
184
+ //# sourceMappingURL=logcat-helper.js.map
@@ -54,6 +54,9 @@ class ApplicationManagerBase extends events_1.EventEmitter {
54
54
  if (!this.checkForApplicationUpdatesPromise) {
55
55
  this.checkForApplicationUpdatesPromise = new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
56
56
  let isFulfilled = false;
57
+ // As this method is called on 500ms, but it's execution may last much longer
58
+ // use locking, so the next executions will not get into the body, while the first one is still working.
59
+ // In case we do not break the next executions, we'll report each app as newly installed several times.
57
60
  try {
58
61
  const currentlyInstalledAppIdentifiers = yield this.getInstalledApplications();
59
62
  const previouslyInstalledAppIdentifiers = this.lastInstalledAppIdentifiers || [];
@@ -102,6 +105,7 @@ class ApplicationManagerBase extends events_1.EventEmitter {
102
105
  _.each(notAvailableAppsForDebugging, (appInfo) => {
103
106
  this.emit("debuggableAppLost", appInfo);
104
107
  if (_.has(this.lastAvailableDebuggableAppViews, appInfo.appIdentifier)) {
108
+ // Prevent emitting debuggableViewLost when application cannot be debugged anymore.
105
109
  delete this.lastAvailableDebuggableAppViews[appInfo.appIdentifier];
106
110
  }
107
111
  });
@@ -120,6 +124,7 @@ class ApplicationManagerBase extends events_1.EventEmitter {
120
124
  _.each(newAvailableViews, (debugWebViewInfo) => {
121
125
  this.emit("debuggableViewFound", appIdentifier, debugWebViewInfo);
122
126
  });
127
+ // Determine which of the views had changed since last check and raise debuggableViewChanged event for them:
123
128
  const keptViews = _.differenceBy(currentlyAvailableViews, newAvailableViews, "id");
124
129
  _.each(keptViews, (view) => {
125
130
  const previousTimeViewInfo = _.find(previouslyAvailableViews, (previousView) => previousView.id === view.id);
@@ -133,3 +138,4 @@ class ApplicationManagerBase extends events_1.EventEmitter {
133
138
  }
134
139
  }
135
140
  exports.ApplicationManagerBase = ApplicationManagerBase;
141
+ //# sourceMappingURL=application-manager-base.js.map