nativescript 9.0.0-alpha.13 → 9.0.0-alpha.14

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 (343) hide show
  1. package/config/test-deps-versions-generated.json +2 -2
  2. package/docs/build-jekyll-md.sh +1 -1
  3. package/docs/man_pages/config/config-get.md +36 -0
  4. package/docs/man_pages/config/config-set.md +40 -0
  5. package/docs/man_pages/config/config.md +39 -0
  6. package/docs/man_pages/project/hooks/hooks.md +35 -0
  7. package/docs/man_pages/start.md +1 -0
  8. package/lib/.d.ts +4 -0
  9. package/lib/android-tools-info.js +12 -0
  10. package/lib/base-package-manager.js +7 -0
  11. package/lib/bootstrap.js +7 -1
  12. package/lib/bun-package-manager.js +14 -1
  13. package/lib/color.js +4 -0
  14. package/lib/commands/add-platform.js +1 -0
  15. package/lib/commands/apple-login.js +1 -0
  16. package/lib/commands/appstore-list.js +1 -0
  17. package/lib/commands/appstore-upload.js +3 -0
  18. package/lib/commands/build.js +3 -2
  19. package/lib/commands/clean.js +22 -1
  20. package/lib/commands/command-base.js +1 -0
  21. package/lib/commands/config.js +5 -0
  22. package/lib/commands/create-project.js +6 -0
  23. package/lib/commands/debug.js +6 -1
  24. package/lib/commands/deploy.js +3 -2
  25. package/lib/commands/embedding/embed.js +7 -0
  26. package/lib/commands/extensibility/install-extension.js +1 -0
  27. package/lib/commands/extensibility/list-extensions.js +1 -0
  28. package/lib/commands/extensibility/uninstall-extension.js +1 -0
  29. package/lib/commands/fonts.js +1 -0
  30. package/lib/commands/generate-assets.js +1 -0
  31. package/lib/commands/generate-help.js +1 -0
  32. package/lib/commands/generate.js +48 -1
  33. package/lib/commands/hooks/common.js +80 -0
  34. package/lib/commands/hooks/hooks-lock.js +101 -0
  35. package/lib/commands/hooks/hooks.js +72 -0
  36. package/lib/commands/info.js +1 -0
  37. package/lib/commands/install.js +1 -0
  38. package/lib/commands/list-platforms.js +1 -0
  39. package/lib/commands/migrate.js +1 -0
  40. package/lib/commands/native-add.js +5 -0
  41. package/lib/commands/platform-clean.js +1 -0
  42. package/lib/commands/plugin/add-plugin.js +1 -0
  43. package/lib/commands/plugin/build-plugin.js +1 -0
  44. package/lib/commands/plugin/create-plugin.js +5 -0
  45. package/lib/commands/plugin/list-plugins.js +1 -0
  46. package/lib/commands/plugin/remove-plugin.js +2 -0
  47. package/lib/commands/plugin/update-plugin.js +1 -0
  48. package/lib/commands/post-install.js +6 -0
  49. package/lib/commands/prepare.js +4 -3
  50. package/lib/commands/preview.js +2 -0
  51. package/lib/commands/remove-platform.js +1 -0
  52. package/lib/commands/resources/resources-update.js +2 -0
  53. package/lib/commands/run.js +1 -0
  54. package/lib/commands/setup.js +1 -0
  55. package/lib/commands/start.js +1 -0
  56. package/lib/commands/test-init.js +4 -0
  57. package/lib/commands/test.js +9 -2
  58. package/lib/commands/typings.js +2 -1
  59. package/lib/commands/update-platform.js +5 -0
  60. package/lib/commands/update.js +2 -0
  61. package/lib/commands/widget.js +20 -1
  62. package/lib/common/bootstrap.js +1 -0
  63. package/lib/common/child-process.js +3 -0
  64. package/lib/common/codeGeneration/code-entity.js +1 -0
  65. package/lib/common/codeGeneration/code-printer.js +1 -0
  66. package/lib/common/command-params.js +1 -0
  67. package/lib/common/commands/analytics.js +3 -0
  68. package/lib/common/commands/autocompletion.js +3 -0
  69. package/lib/common/commands/device/device-log-stream.js +1 -0
  70. package/lib/common/commands/device/get-file.js +2 -0
  71. package/lib/common/commands/device/list-applications.js +1 -0
  72. package/lib/common/commands/device/list-devices.js +3 -0
  73. package/lib/common/commands/device/list-files.js +2 -0
  74. package/lib/common/commands/device/put-file.js +2 -0
  75. package/lib/common/commands/device/run-application.js +1 -0
  76. package/lib/common/commands/device/stop-application.js +1 -0
  77. package/lib/common/commands/device/uninstall-application.js +1 -0
  78. package/lib/common/commands/doctor.js +3 -2
  79. package/lib/common/commands/generate-messages.js +1 -0
  80. package/lib/common/commands/help.js +1 -0
  81. package/lib/common/commands/package-manager-get.js +1 -0
  82. package/lib/common/commands/package-manager-set.js +1 -0
  83. package/lib/common/commands/post-install.js +1 -0
  84. package/lib/common/commands/preuninstall.js +11 -2
  85. package/lib/common/commands/proxy/proxy-base.js +4 -0
  86. package/lib/common/commands/proxy/proxy-clear.js +1 -0
  87. package/lib/common/commands/proxy/proxy-get.js +1 -0
  88. package/lib/common/commands/proxy/proxy-set.js +1 -0
  89. package/lib/common/common-lib.js +1 -0
  90. package/lib/common/constants.js +11 -0
  91. package/lib/common/decorators.js +48 -0
  92. package/lib/common/definitions/extensibility.d.ts +2 -2
  93. package/lib/common/definitions/mobile.d.ts +72 -72
  94. package/lib/common/dispatchers.js +10 -1
  95. package/lib/common/errors.js +13 -3
  96. package/lib/common/file-system.js +13 -2
  97. package/lib/common/header.js +3 -0
  98. package/lib/common/helpers.js +89 -3
  99. package/lib/common/host-info.js +4 -0
  100. package/lib/common/http-client.js +20 -0
  101. package/lib/common/logger/appenders/cli-appender.js +4 -0
  102. package/lib/common/logger/appenders/emit-appender.js +4 -0
  103. package/lib/common/logger/layouts/cli-layout.js +1 -0
  104. package/lib/common/logger/logger.js +5 -0
  105. package/lib/common/messages/messages.js +6 -0
  106. package/lib/common/mobile/android/android-application-manager.js +20 -1
  107. package/lib/common/mobile/android/android-debug-bridge-result-handler.js +1 -0
  108. package/lib/common/mobile/android/android-debug-bridge.js +6 -0
  109. package/lib/common/mobile/android/android-device-file-system.js +4 -0
  110. package/lib/common/mobile/android/android-device-hash-service.js +3 -0
  111. package/lib/common/mobile/android/android-device.js +8 -0
  112. package/lib/common/mobile/android/android-emulator-services.js +2 -1
  113. package/lib/common/mobile/android/android-ini-file-parser.js +9 -0
  114. package/lib/common/mobile/android/android-log-filter.js +4 -0
  115. package/lib/common/mobile/android/android-virtual-device-service.js +26 -0
  116. package/lib/common/mobile/android/device-android-debug-bridge.js +1 -0
  117. package/lib/common/mobile/android/genymotion/genymotion-service.js +6 -1
  118. package/lib/common/mobile/android/genymotion/virtualbox-service.js +11 -0
  119. package/lib/common/mobile/android/logcat-helper.js +13 -0
  120. package/lib/common/mobile/application-manager-base.js +6 -0
  121. package/lib/common/mobile/device-emitter.js +4 -0
  122. package/lib/common/mobile/device-log-emitter.js +1 -0
  123. package/lib/common/mobile/device-log-provider-base.js +1 -0
  124. package/lib/common/mobile/device-log-provider.js +23 -0
  125. package/lib/common/mobile/device-platforms-constants.js +1 -0
  126. package/lib/common/mobile/emulator-helper.js +3 -0
  127. package/lib/common/mobile/ios/device/ios-application-manager.js +3 -0
  128. package/lib/common/mobile/ios/device/ios-device-file-system.js +1 -0
  129. package/lib/common/mobile/ios/device/ios-device-operations.js +4 -0
  130. package/lib/common/mobile/ios/device/ios-device.js +4 -0
  131. package/lib/common/mobile/ios/ios-device-base.js +1 -0
  132. package/lib/common/mobile/ios/ios-device-product-name-mapper.js +2 -0
  133. package/lib/common/mobile/ios/ios-log-filter.js +1 -0
  134. package/lib/common/mobile/ios/simulator/ios-emulator-services.js +4 -0
  135. package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +1 -0
  136. package/lib/common/mobile/ios/simulator/ios-simulator-application-manager.js +6 -0
  137. package/lib/common/mobile/ios/simulator/ios-simulator-device.js +5 -0
  138. package/lib/common/mobile/ios/simulator/ios-simulator-file-system.js +1 -0
  139. package/lib/common/mobile/ios/simulator/ios-simulator-log-provider.js +1 -0
  140. package/lib/common/mobile/local-to-device-path-data-factory.js +1 -0
  141. package/lib/common/mobile/log-filter.js +2 -0
  142. package/lib/common/mobile/logging-levels.js +1 -0
  143. package/lib/common/mobile/mobile-core/android-device-discovery.js +2 -0
  144. package/lib/common/mobile/mobile-core/android-emulator-discovery.js +3 -0
  145. package/lib/common/mobile/mobile-core/android-process-service.js +32 -0
  146. package/lib/common/mobile/mobile-core/device-discovery.js +1 -0
  147. package/lib/common/mobile/mobile-core/devices-service.js +69 -0
  148. package/lib/common/mobile/mobile-core/ios-device-discovery.js +2 -0
  149. package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +3 -0
  150. package/lib/common/mobile/mobile-helper.js +1 -0
  151. package/lib/common/mobile/wp8/wp8-emulator-services.js +1 -0
  152. package/lib/common/opener.js +1 -0
  153. package/lib/common/os-info.js +1 -0
  154. package/lib/common/plist-parser.js +1 -0
  155. package/lib/common/project-helper.js +1 -0
  156. package/lib/common/prompter.js +9 -1
  157. package/lib/common/queue.js +1 -0
  158. package/lib/common/resource-loader.js +1 -0
  159. package/lib/common/services/auto-completion-service.js +13 -1
  160. package/lib/common/services/cancellation.js +2 -1
  161. package/lib/common/services/commands-service.js +17 -6
  162. package/lib/common/services/help-service.js +11 -3
  163. package/lib/common/services/hooks-service.js +13 -0
  164. package/lib/common/services/ios-notification-service.js +1 -0
  165. package/lib/common/services/json-file-settings-service.js +6 -0
  166. package/lib/common/services/lock-service.js +6 -0
  167. package/lib/common/services/message-contract-generator.js +1 -0
  168. package/lib/common/services/messages-service.js +1 -0
  169. package/lib/common/services/micro-templating-service.js +6 -0
  170. package/lib/common/services/net-service.js +3 -0
  171. package/lib/common/services/project-files-manager.js +5 -0
  172. package/lib/common/services/project-files-provider-base.js +1 -0
  173. package/lib/common/services/proxy-service.js +1 -0
  174. package/lib/common/services/qr.js +1 -0
  175. package/lib/common/services/settings-service.js +1 -0
  176. package/lib/common/services/xcode-select-service.js +1 -0
  177. package/lib/common/utils.js +1 -0
  178. package/lib/common/validators/project-name-validator.js +1 -0
  179. package/lib/common/validators/validation-result.js +1 -0
  180. package/lib/common/verify-node-version.js +8 -1
  181. package/lib/common/yok.js +32 -11
  182. package/lib/config.js +22 -1
  183. package/lib/constants-provider.js +1 -0
  184. package/lib/constants.js +53 -0
  185. package/lib/controllers/build-controller.js +4 -3
  186. package/lib/controllers/debug-controller.js +8 -3
  187. package/lib/controllers/deploy-controller.js +1 -0
  188. package/lib/controllers/migrate-controller.js +90 -4
  189. package/lib/controllers/platform-controller.js +9 -1
  190. package/lib/controllers/prepare-controller.js +17 -4
  191. package/lib/controllers/run-controller.js +17 -1
  192. package/lib/controllers/update-controller-base.js +1 -0
  193. package/lib/controllers/update-controller.js +11 -0
  194. package/lib/data/build-data.js +1 -0
  195. package/lib/data/controller-data-base.js +1 -0
  196. package/lib/data/debug-data.js +1 -0
  197. package/lib/data/platform-data.js +1 -0
  198. package/lib/data/prepare-data.js +1 -0
  199. package/lib/data/run-data.js +1 -0
  200. package/lib/definitions/hooks.d.ts +1 -0
  201. package/lib/detached-processes/cleanup-js-subprocess.js +8 -2
  202. package/lib/detached-processes/cleanup-process.js +18 -14
  203. package/lib/detached-processes/file-log-service.js +2 -1
  204. package/lib/device-path-provider.js +1 -0
  205. package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +7 -0
  206. package/lib/device-sockets/ios/notification.js +3 -0
  207. package/lib/device-sockets/ios/socket-request-executor.js +3 -0
  208. package/lib/helpers/android-bundle-validator-helper.js +2 -1
  209. package/lib/helpers/deploy-command-helper.js +1 -0
  210. package/lib/helpers/key-command-helper.js +4 -2
  211. package/lib/helpers/livesync-command-helper.js +4 -1
  212. package/lib/helpers/network-connectivity-validator.js +1 -0
  213. package/lib/helpers/options-track-helper.js +3 -2
  214. package/lib/helpers/package-path-helper.js +1 -0
  215. package/lib/helpers/platform-command-helper.js +7 -2
  216. package/lib/helpers/version-validator-helper.js +1 -0
  217. package/lib/key-commands/bootstrap.js +3 -2
  218. package/lib/key-commands/index.js +5 -4
  219. package/lib/nativescript-cli-lib-bootstrap.js +4 -0
  220. package/lib/nativescript-cli-lib.js +1 -0
  221. package/lib/nativescript-cli.js +11 -1
  222. package/lib/node/pbxproj-dom-xcode.js +1 -0
  223. package/lib/node/xcode.js +1 -0
  224. package/lib/node-package-manager.js +11 -1
  225. package/lib/options.js +144 -119
  226. package/lib/package-installation-manager.js +8 -1
  227. package/lib/package-manager.js +2 -0
  228. package/lib/platform-command-param.js +1 -0
  229. package/lib/pnpm-package-manager.js +4 -1
  230. package/lib/project-data.js +12 -0
  231. package/lib/providers/project-files-provider.js +1 -0
  232. package/lib/resolvers/livesync-service-resolver.js +1 -0
  233. package/lib/services/analytics/analytics-broker-process.js +10 -6
  234. package/lib/services/analytics/analytics-broker.js +2 -1
  235. package/lib/services/analytics/analytics-service.js +29 -25
  236. package/lib/services/analytics/google-analytics-provider.js +13 -12
  237. package/lib/services/analytics-settings-service.js +5 -0
  238. package/lib/services/android/android-bundle-tool-service.js +1 -0
  239. package/lib/services/android/gradle-build-args-service.js +3 -0
  240. package/lib/services/android/gradle-build-service.js +1 -0
  241. package/lib/services/android/gradle-command-service.js +1 -0
  242. package/lib/services/android-device-debug-service.js +6 -0
  243. package/lib/services/android-plugin-build-service.js +31 -2
  244. package/lib/services/android-project-service.js +71 -4
  245. package/lib/services/android-resources-migration-service.js +7 -0
  246. package/lib/services/apple-portal/apple-portal-application-service.js +1 -0
  247. package/lib/services/apple-portal/apple-portal-cookie-service.js +1 -0
  248. package/lib/services/apple-portal/apple-portal-session-service.js +6 -4
  249. package/lib/services/apple-portal/srp/srp-wrapper.js +4 -1
  250. package/lib/services/assets-generation/assets-generation-service.js +10 -5
  251. package/lib/services/build-artifacts-service.js +2 -1
  252. package/lib/services/build-data-service.js +1 -0
  253. package/lib/services/build-info-file-service.js +1 -0
  254. package/lib/services/bundler/bundler-compiler-service.js +88 -17
  255. package/lib/services/bundler/bundler.js +1 -0
  256. package/lib/services/cleanup-service.js +13 -9
  257. package/lib/services/cocoapods-platform-manager.js +9 -0
  258. package/lib/services/cocoapods-service.js +21 -1
  259. package/lib/services/debug-data-service.js +1 -0
  260. package/lib/services/debug-service-base.js +7 -0
  261. package/lib/services/device/device-install-app-service.js +2 -1
  262. package/lib/services/doctor-service.js +21 -6
  263. package/lib/services/extensibility-service.js +9 -1
  264. package/lib/services/files-hash-service.js +1 -0
  265. package/lib/services/hmr-status-service.js +2 -0
  266. package/lib/services/info-service.js +1 -0
  267. package/lib/services/initialize-service.js +5 -1
  268. package/lib/services/ios/export-options-plist-service.js +4 -0
  269. package/lib/services/ios/ios-signing-service.js +4 -0
  270. package/lib/services/ios/spm-service.js +11 -0
  271. package/lib/services/ios/xcodebuild-args-service.js +9 -0
  272. package/lib/services/ios/xcodebuild-command-service.js +1 -0
  273. package/lib/services/ios/xcodebuild-service.js +2 -1
  274. package/lib/services/ios-debugger-port-service.js +1 -0
  275. package/lib/services/ios-device-debug-service.js +1 -0
  276. package/lib/services/ios-entitlements-service.js +1 -0
  277. package/lib/services/ios-extensions-service.js +1 -0
  278. package/lib/services/ios-log-filter.js +20 -0
  279. package/lib/services/ios-native-target-service.js +6 -4
  280. package/lib/services/ios-project-service.js +91 -1
  281. package/lib/services/ios-provision-service.js +3 -0
  282. package/lib/services/ios-watch-app-service.js +1 -0
  283. package/lib/services/ip-service.js +2 -0
  284. package/lib/services/itmstransporter-service.js +1 -0
  285. package/lib/services/karma-execution.js +2 -0
  286. package/lib/services/livesync/android-device-livesync-service-base.js +1 -0
  287. package/lib/services/livesync/android-device-livesync-service.js +2 -0
  288. package/lib/services/livesync/android-device-livesync-sockets-service.js +3 -0
  289. package/lib/services/livesync/android-livesync-service.js +1 -0
  290. package/lib/services/livesync/android-livesync-tool.js +4 -0
  291. package/lib/services/livesync/device-livesync-service-base.js +2 -0
  292. package/lib/services/livesync/ios-device-livesync-service.js +7 -0
  293. package/lib/services/livesync/ios-livesync-service.js +2 -0
  294. package/lib/services/livesync/livesync-socket.js +1 -0
  295. package/lib/services/livesync/platform-livesync-service-base.js +5 -0
  296. package/lib/services/livesync-process-data-service.js +1 -0
  297. package/lib/services/log-parser-service.js +1 -0
  298. package/lib/services/log-source-map-service.js +15 -0
  299. package/lib/services/marking-mode-service.js +8 -5
  300. package/lib/services/metadata-filtering-service.js +1 -0
  301. package/lib/services/npm-config-service.js +4 -0
  302. package/lib/services/pacote-service.js +7 -0
  303. package/lib/services/performance-service.js +3 -1
  304. package/lib/services/platform/add-platform-service.js +49 -2
  305. package/lib/services/platform/platform-validation-service.js +1 -0
  306. package/lib/services/platform/prepare-native-platform-service.js +5 -2
  307. package/lib/services/platform-environment-requirements.js +8 -3
  308. package/lib/services/platform-project-service-base.js +1 -0
  309. package/lib/services/platforms-data-service.js +1 -0
  310. package/lib/services/plugins-service.js +21 -2
  311. package/lib/services/prepare-data-service.js +1 -0
  312. package/lib/services/project-backup-service.js +4 -0
  313. package/lib/services/project-changes-service.js +14 -3
  314. package/lib/services/project-cleanup-service.js +2 -0
  315. package/lib/services/project-config-service.js +21 -2
  316. package/lib/services/project-data-service.js +36 -7
  317. package/lib/services/project-name-service.js +1 -0
  318. package/lib/services/project-service.js +10 -0
  319. package/lib/services/project-templates-service.js +3 -2
  320. package/lib/services/qr-code-terminal-service.js +1 -0
  321. package/lib/services/require-service.js +1 -0
  322. package/lib/services/start-service.js +1 -0
  323. package/lib/services/temp-service.js +3 -0
  324. package/lib/services/terminal-spinner-service.js +2 -0
  325. package/lib/services/test-execution-service.js +9 -2
  326. package/lib/services/test-initialization-service.js +4 -0
  327. package/lib/services/timeline-profiler-service.js +1 -0
  328. package/lib/services/user-settings-service.js +1 -0
  329. package/lib/services/versions-service.js +6 -4
  330. package/lib/services/watch-ignore-list-service.js +1 -0
  331. package/lib/services/xcconfig-service.js +2 -0
  332. package/lib/services/xcproj-service.js +1 -0
  333. package/lib/shared-event-bus.js +6 -0
  334. package/lib/sys-info.js +2 -1
  335. package/lib/tools/config-manipulation/config-transformer.js +12 -0
  336. package/lib/tools/node-modules/node-modules-builder.js +1 -0
  337. package/lib/tools/node-modules/node-modules-dependencies-builder.js +6 -0
  338. package/lib/yarn-package-manager.js +1 -0
  339. package/lib/yarn2-package-manager.js +3 -0
  340. package/package.json +11 -10
  341. package/vendor/aab-tool/README.txt +1 -1
  342. package/vendor/aab-tool/bundletool.jar +0 -0
  343. package/vendor/gradle-plugin/build.gradle +1 -1
@@ -106,6 +106,7 @@ class IOSDevice extends ios_device_base_1.IOSDeviceBase {
106
106
  const majorVersionAsString = productType.match(/.*?(\d+)\,(\d+)/)[1];
107
107
  const majorVersion = parseInt(majorVersionAsString);
108
108
  let isArm64Architecture = false;
109
+ //https://en.wikipedia.org/wiki/List_of_iOS_devices
109
110
  if (_.startsWith(productType, "iphone")) {
110
111
  isArm64Architecture = majorVersion >= 6;
111
112
  }
@@ -116,6 +117,7 @@ class IOSDevice extends ios_device_base_1.IOSDeviceBase {
116
117
  isArm64Architecture = majorVersion >= 7;
117
118
  }
118
119
  else if (_.startsWith(productType, "realitydevice")) {
120
+ // visionos
119
121
  isArm64Architecture = true;
120
122
  }
121
123
  activeArchitecture = isArm64Architecture ? "arm64" : "armv7";
@@ -125,6 +127,7 @@ class IOSDevice extends ios_device_base_1.IOSDeviceBase {
125
127
  getPlatform(productType) {
126
128
  productType = productType.toLowerCase().trim();
127
129
  if (_.startsWith(productType, "realitydevice")) {
130
+ // visionos
128
131
  return this.$devicePlatformsConstants.visionOS;
129
132
  }
130
133
  return this.$devicePlatformsConstants.iOS;
@@ -135,3 +138,4 @@ __decorate([
135
138
  (0, decorators_1.cache)()
136
139
  ], IOSDevice.prototype, "openDeviceLogStream", null);
137
140
  yok_1.injector.register("iOSDevice", IOSDevice);
141
+ //# sourceMappingURL=ios-device.js.map
@@ -83,3 +83,4 @@ exports.IOSDeviceBase = IOSDeviceBase;
83
83
  __decorate([
84
84
  (0, decorators_1.performanceLog)()
85
85
  ], IOSDeviceBase.prototype, "getDebugSocket", null);
86
+ //# sourceMappingURL=ios-device-base.js.map
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const yok_1 = require("../../yok");
4
4
  class IosDeviceProductNameMapper {
5
5
  constructor() {
6
+ // http://support.hockeyapp.net/kb/client-integration-ios-mac-os-x/ios-device-types
6
7
  this.map = {
7
8
  "iPhone1,1": "iPhone",
8
9
  "iPhone1,2": "iPhone 3G",
@@ -63,3 +64,4 @@ class IosDeviceProductNameMapper {
63
64
  }
64
65
  }
65
66
  yok_1.injector.register("iOSDeviceProductNameMapper", IosDeviceProductNameMapper);
67
+ //# sourceMappingURL=ios-device-product-name-mapper.js.map
@@ -22,3 +22,4 @@ class IOSLogFilter {
22
22
  }
23
23
  exports.IOSLogFilter = IOSLogFilter;
24
24
  yok_1.injector.register("iOSLogFilter", IOSLogFilter);
25
+ //# sourceMappingURL=ios-log-filter.js.map
@@ -18,6 +18,7 @@ class IosEmulatorServices {
18
18
  try {
19
19
  if (options.platform === this.$devicePlatformsConstants.visionOS &&
20
20
  !options.emulatorIdOrName) {
21
+ // find first available visionOS simulator (for now).
21
22
  const { devices } = await this.tryGetiOSSimDevices();
22
23
  options.emulatorIdOrName = (_a = devices.find((device) => device.platform === this.$devicePlatformsConstants.visionOS)) === null || _a === void 0 ? void 0 : _a.id;
23
24
  }
@@ -51,6 +52,8 @@ class IosEmulatorServices {
51
52
  }
52
53
  async connectToPort(data) {
53
54
  try {
55
+ // node v17+ resolves localhost to ::1 (ipv6) instead of 127.0.0.1 (ipv4)
56
+ // so we explicitly pass ipv4
54
57
  const socket = net.connect(data.port, "127.0.0.1");
55
58
  return socket;
56
59
  }
@@ -108,3 +111,4 @@ class IosEmulatorServices {
108
111
  }
109
112
  }
110
113
  yok_1.injector.register("iOSEmulatorServices", IosEmulatorServices);
114
+ //# sourceMappingURL=ios-emulator-services.js.map
@@ -21,3 +21,4 @@ exports.IOSSimResolver = IOSSimResolver;
21
21
  IOSSimResolver.iOSSimName = "ios-sim-portable";
22
22
  IOSSimResolver.iOSStandaloneExecutableName = "ios-sim-standalone.js";
23
23
  yok_1.injector.register("iOSSimResolver", IOSSimResolver);
24
+ //# sourceMappingURL=ios-sim-resolver.js.map
@@ -73,8 +73,13 @@ class IOSSimulatorApplicationManager extends application_manager_base_1.Applicat
73
73
  return [];
74
74
  }
75
75
  async getDebuggableAppViews(appIdentifiers) {
76
+ // Implement when we can find debuggable applications for iOS.
76
77
  return Promise.resolve(null);
77
78
  }
79
+ // iOS will kill the app if we freeze it in the NativeScript Runtime and wait for debug-brk.
80
+ // In order to avoid that, we are attaching lldb and passing it "process continue".
81
+ // In this way, iOS will not kill the app because it has a native debugger attached
82
+ // and the users will be able to attach a debug session using the debug-brk flag.
78
83
  attachNativeDebugger(appId, pid) {
79
84
  this._lldbProcesses[appId] = this.$childProcess.spawn("lldb", ["-p", pid]);
80
85
  if (log4js.levels.TRACE.isGreaterThanOrEqualTo(this.$logger.getLevel())) {
@@ -116,3 +121,4 @@ __decorate([
116
121
  __decorate([
117
122
  (0, decorators_1.cache)()
118
123
  ], IOSSimulatorApplicationManager.prototype, "startDeviceLog", null);
124
+ //# sourceMappingURL=ios-simulator-application-manager.js.map
@@ -65,11 +65,15 @@ class IOSSimulator extends ios_device_base_1.IOSDeviceBase {
65
65
  let socket;
66
66
  const attachRequestMessage = this.$iOSNotification.getAttachRequest(appId, this.deviceInfo.identifier);
67
67
  await this.$iOSEmulatorServices.postDarwinNotification(attachRequestMessage, this.deviceInfo.identifier);
68
+ // Retry posting the notification every five seconds, in case the AttachRequest
69
+ // event handler wasn't registered when the first one was sent
68
70
  const postNotificationRetryInterval = setInterval(() => {
69
71
  this.$iOSEmulatorServices
70
72
  .postDarwinNotification(attachRequestMessage, this.deviceInfo.identifier)
71
73
  .catch((e) => this.$logger.error(e));
72
74
  }, 5e3);
75
+ // the internal retry-mechanism of getDebuggerPort will ensure the above
76
+ // interval has a chance to execute multiple times
73
77
  const port = await super.getDebuggerPort(appId).finally(() => {
74
78
  clearInterval(postNotificationRetryInterval);
75
79
  });
@@ -88,3 +92,4 @@ exports.IOSSimulator = IOSSimulator;
88
92
  __decorate([
89
93
  (0, decorators_1.cache)()
90
94
  ], IOSSimulator.prototype, "openDeviceLogStream", null);
95
+ //# sourceMappingURL=ios-simulator-device.js.map
@@ -54,3 +54,4 @@ class IOSSimulatorFileSystem {
54
54
  }
55
55
  }
56
56
  exports.IOSSimulatorFileSystem = IOSSimulatorFileSystem;
57
+ //# sourceMappingURL=ios-simulator-file-system.js.map
@@ -56,3 +56,4 @@ class IOSSimulatorLogProvider extends events_1.EventEmitter {
56
56
  }
57
57
  exports.IOSSimulatorLogProvider = IOSSimulatorLogProvider;
58
58
  yok_1.injector.register("iOSSimulatorLogProvider", IOSSimulatorLogProvider);
59
+ //# sourceMappingURL=ios-simulator-log-provider.js.map
@@ -35,3 +35,4 @@ class LocalToDevicePathDataFactory {
35
35
  }
36
36
  exports.LocalToDevicePathDataFactory = LocalToDevicePathDataFactory;
37
37
  yok_1.injector.register("localToDevicePathDataFactory", LocalToDevicePathDataFactory);
38
+ //# sourceMappingURL=local-to-device-path-data-factory.js.map
@@ -24,6 +24,7 @@ class LogFilter {
24
24
  if (deviceLogFilter) {
25
25
  return deviceLogFilter.filterData(data, loggingOptions);
26
26
  }
27
+ // In case the platform is not valid, just return the data without filtering.
27
28
  return data;
28
29
  }
29
30
  getDeviceLogFilterInstance(platform) {
@@ -49,3 +50,4 @@ class LogFilter {
49
50
  }
50
51
  exports.LogFilter = LogFilter;
51
52
  yok_1.injector.register("logFilter", LogFilter);
53
+ //# sourceMappingURL=log-filter.js.map
@@ -10,3 +10,4 @@ class LoggingLevels {
10
10
  }
11
11
  exports.LoggingLevels = LoggingLevels;
12
12
  yok_1.injector.register("loggingLevels", LoggingLevels);
13
+ //# sourceMappingURL=logging-levels.js.map
@@ -38,6 +38,7 @@ class AndroidDeviceDiscovery extends device_discovery_1.DeviceDiscovery {
38
38
  }
39
39
  async checkCurrentData(result) {
40
40
  const currentDevices = result.map((element) => {
41
+ // http://developer.android.com/tools/help/adb.html#devicestatus
41
42
  const data = element.split("\t");
42
43
  const identifier = data[0];
43
44
  const status = data[1];
@@ -70,3 +71,4 @@ class AndroidDeviceDiscovery extends device_discovery_1.DeviceDiscovery {
70
71
  }
71
72
  exports.AndroidDeviceDiscovery = AndroidDeviceDiscovery;
72
73
  yok_1.injector.register("androidDeviceDiscovery", AndroidDeviceDiscovery);
74
+ //# sourceMappingURL=android-device-discovery.js.map
@@ -21,9 +21,11 @@ class AndroidEmulatorDiscovery extends events_1.EventEmitter {
21
21
  const availableEmulatorsOutput = await this.$androidEmulatorServices.getEmulatorImages();
22
22
  const currentEmulators = availableEmulatorsOutput.devices;
23
23
  const cachedEmulators = _.values(this._emulators);
24
+ // Remove old emulators
24
25
  const lostEmulators = _(cachedEmulators)
25
26
  .reject((e) => _.some(currentEmulators, (emulator) => emulator && e && emulator.imageIdentifier === e.imageIdentifier))
26
27
  .value();
28
+ // Add new emulators
27
29
  const foundEmulators = _(currentEmulators)
28
30
  .reject((e) => _.some(cachedEmulators, (emulator) => emulator && e && emulator.imageIdentifier === e.imageIdentifier))
29
31
  .value();
@@ -52,3 +54,4 @@ class AndroidEmulatorDiscovery extends events_1.EventEmitter {
52
54
  }
53
55
  exports.AndroidEmulatorDiscovery = AndroidEmulatorDiscovery;
54
56
  yok_1.injector.register("androidEmulatorDiscovery", AndroidEmulatorDiscovery);
57
+ //# sourceMappingURL=android-emulator-discovery.js.map
@@ -71,6 +71,19 @@ class AndroidProcessService {
71
71
  async getDebuggableApps(deviceIdentifier) {
72
72
  const adb = this.getAdb(deviceIdentifier);
73
73
  const androidWebViewPortInformation = (await this.getAbstractPortsInformation(adb)).split(os_1.EOL);
74
+ // TODO: Add tests and make sure only unique names are returned. Input before groupBy is:
75
+ // [ { deviceIdentifier: 'SH26BW100473',
76
+ // appIdentifier: 'com.telerik.EmptyNS',
77
+ // framework: 'NativeScript' },
78
+ // { deviceIdentifier: 'SH26BW100473',
79
+ // appIdentifier: 'com.telerik.EmptyNS',
80
+ // framework: 'Cordova' },
81
+ // { deviceIdentifier: 'SH26BW100473',
82
+ // appIdentifier: 'chrome',
83
+ // framework: 'Cordova' },
84
+ // { deviceIdentifier: 'SH26BW100473',
85
+ // appIdentifier: 'chrome',
86
+ // framework: 'Cordova' } ]
74
87
  const portInformation = await Promise.all(_.map(androidWebViewPortInformation, async (line) => (await this.getApplicationInfoFromWebViewPortInformation(adb, deviceIdentifier, line)) ||
75
88
  (await this.getNativeScriptApplicationInformation(adb, deviceIdentifier, line))));
76
89
  return _(portInformation)
@@ -109,6 +122,7 @@ class AndroidProcessService {
109
122
  return adb;
110
123
  }
111
124
  async getApplicationInfoFromWebViewPortInformation(adb, deviceIdentifier, information) {
125
+ // Need to search by processId to check for old Android webviews (@webview_devtools_remote_<processId>).
112
126
  const processIdRegExp = /@webview_devtools_remote_(.+)/g;
113
127
  const processIdMatches = processIdRegExp.exec(information);
114
128
  let cordovaAppIdentifier;
@@ -117,6 +131,7 @@ class AndroidProcessService {
117
131
  cordovaAppIdentifier = await this.getApplicationIdentifierFromPid(adb, processId);
118
132
  }
119
133
  else {
134
+ // Search for appIdentifier (@<appIdentifier>_devtools_remote).
120
135
  const chromeAppIdentifierRegExp = /@(.+)_devtools_remote\s?/g;
121
136
  const chromeAppIdentifierMatches = chromeAppIdentifierRegExp.exec(information);
122
137
  if (chromeAppIdentifierMatches && chromeAppIdentifierMatches.length > 0) {
@@ -133,6 +148,7 @@ class AndroidProcessService {
133
148
  return null;
134
149
  }
135
150
  async getNativeScriptApplicationInformation(adb, deviceIdentifier, information) {
151
+ // Search for appIdentifier (@<appIdentifier-debug>).
136
152
  const nativeScriptAppIdentifierRegExp = /@(.+)-(debug|inspectorServer)/g;
137
153
  const nativeScriptAppIdentifierMatches = nativeScriptAppIdentifierRegExp.exec(information);
138
154
  if (nativeScriptAppIdentifierMatches &&
@@ -147,6 +163,10 @@ class AndroidProcessService {
147
163
  return null;
148
164
  }
149
165
  async getAbstractPortForApplication(adb, processId, appIdentifier, abstractPortsInformation, framework) {
166
+ // The result will look like this (without the columns names):
167
+ // Num RefCount Protocol Flags Type St Inode Path
168
+ // 0000000000000000: 00000002 00000000 00010000 0001 01 189004 @webview_devtools_remote_25512
169
+ // The Path column is the abstract port.
150
170
  framework = framework || "";
151
171
  switch (framework.toLowerCase()) {
152
172
  case constants_1.TARGET_FRAMEWORK_IDENTIFIERS.Cordova.toLowerCase():
@@ -173,6 +193,9 @@ class AndroidProcessService {
173
193
  return match && match[1];
174
194
  }
175
195
  async getProcessIds(adb, appIdentifiers) {
196
+ // Process information will look like this (without the columns names):
197
+ // USER PID PPID VSIZE RSS WCHAN PC NAME
198
+ // u0_a63 25512 1334 1519560 96040 ffffffff f76a8f75 S com.telerik.appbuildertabstest
176
199
  const result = {};
177
200
  const processIdInformation = await adb.executeShellCommand(["ps"]);
178
201
  _.each(appIdentifiers, (appIdentifier) => {
@@ -183,6 +206,11 @@ class AndroidProcessService {
183
206
  }
184
207
  async getAlreadyMappedPort(adb, deviceIdentifier, abstractPort, adbForwardList) {
185
208
  const allForwardedPorts = adbForwardList || (await adb.executeCommand(["forward", "--list"])) || "";
209
+ // Sample output:
210
+ // 5e2e580b tcp:62503 localabstract:webview_devtools_remote_7985
211
+ // 5e2e580b tcp:62524 localabstract:webview_devtools_remote_7986
212
+ // 5e2e580b tcp:63160 localabstract:webview_devtools_remote_7987
213
+ // 5e2e580b tcp:57577 localabstract:com.telerik.nrel-debug
186
214
  const regex = new RegExp(`${deviceIdentifier}\\s+?tcp:(\\d+?)\\s+?.*?${abstractPort}$`);
187
215
  return this.getFirstMatchingGroupFromMultilineResult(allForwardedPorts, regex);
188
216
  }
@@ -196,6 +224,9 @@ class AndroidProcessService {
196
224
  }
197
225
  async getApplicationIdentifierFromPid(adb, pid, psData) {
198
226
  psData = psData || (await adb.executeShellCommand(["ps"]));
227
+ // Process information will look like this (without the columns names):
228
+ // USER PID PPID VSIZE RSS WCHAN PC NAME
229
+ // u0_a63 25512 1334 1519560 96040 ffffffff f76a8f75 S com.telerik.appbuildertabstest
199
230
  return this.getFirstMatchingGroupFromMultilineResult(psData, new RegExp(`\\s+${pid}(?:\\s+\\d+){3}\\s+.*\\s+(.*?)$`));
200
231
  }
201
232
  getFirstMatchingGroupFromMultilineResult(input, regex) {
@@ -218,3 +249,4 @@ __decorate([
218
249
  (0, decorators_1.exported)("androidProcessService")
219
250
  ], AndroidProcessService.prototype, "getAppProcessId", null);
220
251
  yok_1.injector.register("androidProcessService", AndroidProcessService);
252
+ //# sourceMappingURL=android-process-service.js.map
@@ -51,3 +51,4 @@ class DeviceDiscovery extends events_1.EventEmitter {
51
51
  }
52
52
  exports.DeviceDiscovery = DeviceDiscovery;
53
53
  yok_1.injector.register("deviceDiscovery", DeviceDiscovery);
54
+ //# sourceMappingURL=device-discovery.js.map
@@ -62,6 +62,7 @@ class DevicesService extends events_1.EventEmitter {
62
62
  const device = await this.getDevice(options.deviceId);
63
63
  return device;
64
64
  }
65
+ // Now let's take data for each device:
65
66
  const availableDevicesAndEmulators = this.getDeviceInstances().filter((d) => d.deviceInfo.status === constants_2.CONNECTED_STATUS &&
66
67
  (!this.platform ||
67
68
  d.deviceInfo.platform.toLowerCase() === this.platform.toLowerCase()));
@@ -84,6 +85,8 @@ class DevicesService extends events_1.EventEmitter {
84
85
  const devices = sortedInstances.filter((d) => !d.isEmulator);
85
86
  let selectedInstance;
86
87
  if (options.onlyEmulators || options.onlyDevices) {
88
+ // When --emulator or --forDevice is passed, the instances are already filtered
89
+ // So we are sure we have exactly the type we need and we can safely return the last one (highest OS version).
87
90
  selectedInstance = _.last(sortedInstances);
88
91
  }
89
92
  else {
@@ -142,6 +145,7 @@ class DevicesService extends events_1.EventEmitter {
142
145
  ...additionalErrors,
143
146
  ];
144
147
  }
148
+ // emulator is already running
145
149
  if (emulator.status === constants.RUNNING_EMULATOR_STATUS) {
146
150
  return null;
147
151
  }
@@ -173,9 +177,11 @@ class DevicesService extends events_1.EventEmitter {
173
177
  return !!(this.$mobileHelper.isiOSPlatform(device.deviceInfo.platform) &&
174
178
  device.isEmulator);
175
179
  }
180
+ /* tslint:disable:no-unused-variable */
176
181
  setLogLevel(logLevel, deviceIdentifier) {
177
182
  this.$deviceLogProvider.setLogLevel(logLevel, deviceIdentifier);
178
183
  }
184
+ /* tslint:enable:no-unused-variable */
179
185
  isAppInstalledOnDevices(deviceIdentifiers, appId, projectName, projectDir) {
180
186
  this.$logger.trace(`Called isInstalledOnDevices for identifiers ${deviceIdentifiers}. AppIdentifier is ${appId}.`);
181
187
  return _.map(deviceIdentifiers, (deviceIdentifier) => this.isApplicationInstalledOnDevice(deviceIdentifier, {
@@ -247,6 +253,9 @@ class DevicesService extends events_1.EventEmitter {
247
253
  delete this._availableEmulators[emulator.imageIdentifier];
248
254
  this.emit(constants.EmulatorDiscoveryNames.EMULATOR_IMAGE_LOST, emulator);
249
255
  }
256
+ /**
257
+ * Starts looking for devices. Any found devices are pushed to "_devices" variable.
258
+ */
250
259
  async detectCurrentlyAttachedDevices(deviceInitOpts) {
251
260
  const options = this.getDeviceLookingOptions(deviceInitOpts);
252
261
  for (const deviceDiscovery of this._allDeviceDiscoveries) {
@@ -315,6 +324,11 @@ class DevicesService extends events_1.EventEmitter {
315
324
  clearInterval(this.emulatorDetectionInterval);
316
325
  }
317
326
  }
327
+ /**
328
+ * Returns device that matches an identifier.
329
+ * The identifier is expected to be the same as the running device declares it (emulator-5554 for android or GUID for ios).
330
+ * @param identifier running emulator or device identifier
331
+ */
318
332
  getDeviceByIdentifier(identifier) {
319
333
  const searchedDevice = _.find(this.getDeviceInstances(), (device) => {
320
334
  if (this.$mobileHelper.isApplePlatform(device.deviceInfo.platform) &&
@@ -330,6 +344,9 @@ class DevicesService extends events_1.EventEmitter {
330
344
  }
331
345
  return searchedDevice;
332
346
  }
347
+ /**
348
+ * Starts looking for running devices. All found devices are pushed to _devices variable.
349
+ */
333
350
  async startLookingForDevices(deviceInitOpts) {
334
351
  this.$logger.trace("startLookingForDevices; platform is %s", this._platform);
335
352
  if (this._platform) {
@@ -339,10 +356,20 @@ class DevicesService extends events_1.EventEmitter {
339
356
  await this.detectCurrentlyAvailableEmulators();
340
357
  await this.startDeviceDetectionInterval(deviceInitOpts);
341
358
  }
359
+ /**
360
+ * Returns device depending on the passed index.
361
+ * The index refers to assigned number to listed devices by ns device command.
362
+ * @param index assigned device number
363
+ */
342
364
  getDeviceByIndex(index) {
343
365
  this.validateIndex(index - 1);
344
366
  return this.getDeviceInstances()[index - 1];
345
367
  }
368
+ /**
369
+ * Returns running device for specified --device <DeviceId>.
370
+ * Method expects running devices.
371
+ * @param deviceOption parameter passed by the user to --device flag. Can be name, identifier or imageIdentifier.
372
+ */
346
373
  async getDevice(deviceOption) {
347
374
  let device = null;
348
375
  if (!device) {
@@ -362,6 +389,11 @@ class DevicesService extends events_1.EventEmitter {
362
389
  }
363
390
  return device;
364
391
  }
392
+ /**
393
+ * Method runs action for a --device (value), specified by the user.
394
+ * @param action action to be executed if canExecute returns true
395
+ * @param canExecute predicate to decide whether the command can be ran
396
+ */
365
397
  async executeOnDevice(action, canExecute) {
366
398
  if (!canExecute || canExecute(this._device)) {
367
399
  return {
@@ -370,6 +402,11 @@ class DevicesService extends events_1.EventEmitter {
370
402
  };
371
403
  }
372
404
  }
405
+ /**
406
+ * Executes passed action for each found device.
407
+ * @param action action to be executed if canExecute returns true
408
+ * @param canExecute predicate to decide whether the command can be ran
409
+ */
373
410
  async executeOnAllConnectedDevices(action, canExecute) {
374
411
  const devices = this.filterDevicesByPlatform();
375
412
  const sortedDevices = _.sortBy(devices, (device) => device.deviceInfo.platform);
@@ -421,6 +458,12 @@ class DevicesService extends events_1.EventEmitter {
421
458
  });
422
459
  });
423
460
  }
461
+ /**
462
+ * Runs the passed action if the predicate "canExecute" returns true
463
+ * @param action action to be executed if canExecute returns true.
464
+ * @param canExecute predicate to decide whether the command can be ran
465
+ * @param options all possible options that can be passed to the command.
466
+ */
424
467
  async execute(action, canExecute, options) {
425
468
  assert.ok(this._isInitialized, "Devices services not initialized!");
426
469
  if (this.hasDevices) {
@@ -429,6 +472,7 @@ class DevicesService extends events_1.EventEmitter {
429
472
  this.$mobileHelper.isiOSPlatform(this._platform) &&
430
473
  this.$options.emulator &&
431
474
  !this.isOnlyiOSSimultorRunning()) {
475
+ // Executes the command only on iOS simulator
432
476
  const originalCanExecute = canExecute;
433
477
  canExecute = (dev) => this.isiOSSimulator(dev) &&
434
478
  (!originalCanExecute || !!originalCanExecute(dev));
@@ -452,6 +496,11 @@ class DevicesService extends events_1.EventEmitter {
452
496
  }
453
497
  }
454
498
  }
499
+ /**
500
+ * Starts emulator or simulator if necessary depending on --device or --emulator flags.
501
+ * If no options are passed runs default emulator/simulator if no devices are connected.
502
+ * @param deviceInitOpts mainly contains information about --emulator and --deviceId flags.
503
+ */
455
504
  async startEmulatorIfNecessary(deviceInitOpts) {
456
505
  if (deviceInitOpts && deviceInitOpts.deviceId && deviceInitOpts.emulator) {
457
506
  this.$errors.fail(`--device and --emulator are incompatible options.
@@ -460,6 +509,7 @@ class DevicesService extends events_1.EventEmitter {
460
509
  if (deviceInitOpts &&
461
510
  deviceInitOpts.platform &&
462
511
  !deviceInitOpts.skipEmulatorStart) {
512
+ // are there any running devices
463
513
  this._platform = deviceInitOpts.platform;
464
514
  try {
465
515
  await this.startLookingForDevices(deviceInitOpts);
@@ -485,9 +535,11 @@ class DevicesService extends events_1.EventEmitter {
485
535
  }
486
536
  async _startEmulatorIfNecessary(data) {
487
537
  const deviceInstances = this.getDeviceInstances();
538
+ //if no --device is passed and no devices are found, the default emulator is started
488
539
  if (!data.deviceId && _.isEmpty(deviceInstances)) {
489
540
  return this.startEmulatorCore(data);
490
541
  }
542
+ //check if --device(value) is running, if it's not or it's not the same as is specified, start with name from --device(value)
491
543
  if (data.deviceId) {
492
544
  if (!helpers.isNumberWithoutExponent(data.deviceId)) {
493
545
  const activeDeviceInstance = _.find(deviceInstances, (device) => device.deviceInfo.identifier === data.deviceId);
@@ -496,6 +548,7 @@ class DevicesService extends events_1.EventEmitter {
496
548
  }
497
549
  }
498
550
  }
551
+ // make sure if the target platform is visionOS we don't try to run it on an already running iOS simulator...
499
552
  if (data.platform === this.$devicePlatformsConstants.visionOS &&
500
553
  deviceInstances.length) {
501
554
  const runningDeviceInstance = deviceInstances.find((device) => device.deviceInfo.platform ===
@@ -504,6 +557,7 @@ class DevicesService extends events_1.EventEmitter {
504
557
  return this.startEmulatorCore(data);
505
558
  }
506
559
  }
560
+ // if only emulator flag is passed and no other emulators are running, start default emulator
507
561
  if (data.emulator && deviceInstances.length) {
508
562
  const runningDeviceInstance = _.some(deviceInstances, (value) => value.isEmulator);
509
563
  if (!runningDeviceInstance) {
@@ -511,6 +565,12 @@ class DevicesService extends events_1.EventEmitter {
511
565
  }
512
566
  }
513
567
  }
568
+ /**
569
+ * Takes care of gathering information about all running devices.
570
+ * Sets "_isInitialized" to true after infomation is present.
571
+ * Method expects running devices.
572
+ * @param data mainly contains information about --emulator and --deviceId flags.
573
+ */
514
574
  async initialize(data) {
515
575
  if (!this._deviceInitializePromise) {
516
576
  this._deviceInitializePromise = this.initializeCore(data);
@@ -519,6 +579,7 @@ class DevicesService extends events_1.EventEmitter {
519
579
  await this._deviceInitializePromise;
520
580
  }
521
581
  catch (err) {
582
+ // In case the initalization fails, we want to allow calling `initlialize` again with other arguments for example, so remove the cached promise value.
522
583
  this.$logger.trace(`Error while initializing devicesService: ${err}`);
523
584
  this._deviceInitializePromise = null;
524
585
  throw err;
@@ -542,6 +603,7 @@ class DevicesService extends events_1.EventEmitter {
542
603
  deviceInitOpts = deviceInitOpts || {};
543
604
  this._data = deviceInitOpts;
544
605
  if (!deviceInitOpts.skipEmulatorStart) {
606
+ // TODO: Remove from here as it calls startLookingForDevices, so we double the calls to specific device detection services
545
607
  await this.startEmulatorIfNecessary(deviceInitOpts);
546
608
  }
547
609
  const platform = deviceInitOpts.platform;
@@ -572,6 +634,7 @@ class DevicesService extends events_1.EventEmitter {
572
634
  await this.startLookingForDevices(deviceLookingOptions);
573
635
  }
574
636
  else {
637
+ // platform and deviceId are not specified
575
638
  if (deviceInitOpts.skipInferPlatform) {
576
639
  if (deviceInitOpts.skipDeviceDetectionInterval) {
577
640
  await this.detectCurrentlyAttachedDevices(deviceLookingOptions);
@@ -679,6 +742,11 @@ class DevicesService extends events_1.EventEmitter {
679
742
  }
680
743
  return null;
681
744
  }
745
+ /**
746
+ * Starts emulator for platform and makes sure started devices/emulators/simulators are in _devices array before finishing.
747
+ * @param platform (optional) platform to start emulator/simulator for
748
+ * @param emulatorIdOrName (optional) emulator/simulator image identifier or name
749
+ */
682
750
  async startEmulatorCore(deviceInitOpts = {}) {
683
751
  const { deviceId } = deviceInitOpts;
684
752
  const platform = deviceInitOpts.platform || this._platform;
@@ -802,3 +870,4 @@ __decorate([
802
870
  (0, decorators_1.exported)("devicesService")
803
871
  ], DevicesService.prototype, "getDebuggableViews", null);
804
872
  yok_1.injector.register("devicesService", DevicesService);
873
+ //# sourceMappingURL=devices-service.js.map
@@ -22,6 +22,7 @@ class IOSDeviceDiscovery extends device_discovery_1.DeviceDiscovery {
22
22
  return;
23
23
  }
24
24
  if (this.$mobileHelper.isvisionOSPlatform(options.platform)) {
25
+ // look for ios devices - same logic.
25
26
  options.platform = this.$devicePlatformsConstants.iOS;
26
27
  }
27
28
  await this.$iosDeviceOperations.startLookingForDevices((deviceInfo) => {
@@ -50,3 +51,4 @@ class IOSDeviceDiscovery extends device_discovery_1.DeviceDiscovery {
50
51
  }
51
52
  exports.IOSDeviceDiscovery = IOSDeviceDiscovery;
52
53
  yok_1.injector.register("iOSDeviceDiscovery", IOSDeviceDiscovery);
54
+ //# sourceMappingURL=ios-device-discovery.js.map
@@ -28,12 +28,14 @@ class IOSSimulatorDiscovery extends device_discovery_1.DeviceDiscovery {
28
28
  async checkForDevices() {
29
29
  if (this.$hostInfo.isDarwin) {
30
30
  const currentSimulators = await this.$iOSSimResolver.iOSSim.getRunningSimulators();
31
+ // Remove old simulators
31
32
  _(this.cachedSimulators)
32
33
  .reject((s) => _.some(currentSimulators, (simulator) => simulator &&
33
34
  s &&
34
35
  simulator.id === s.id &&
35
36
  simulator.state === s.state))
36
37
  .each((s) => this.deleteAndRemoveDevice(s));
38
+ // Add new simulators
37
39
  _(currentSimulators)
38
40
  .reject((s) => _.some(this.cachedSimulators, (simulator) => simulator &&
39
41
  s &&
@@ -92,3 +94,4 @@ class IOSSimulatorDiscovery extends device_discovery_1.DeviceDiscovery {
92
94
  }
93
95
  exports.IOSSimulatorDiscovery = IOSSimulatorDiscovery;
94
96
  yok_1.injector.register("iOSSimulatorDiscovery", IOSSimulatorDiscovery);
97
+ //# sourceMappingURL=ios-simulator-discovery.js.map
@@ -89,3 +89,4 @@ class MobileHelper {
89
89
  exports.MobileHelper = MobileHelper;
90
90
  MobileHelper.DEVICE_PATH_SEPARATOR = "/";
91
91
  yok_1.injector.register("mobileHelper", MobileHelper);
92
+ //# sourceMappingURL=mobile-helper.js.map
@@ -53,3 +53,4 @@ class Wp8EmulatorServices {
53
53
  Wp8EmulatorServices.WP8_LAUNCHER = "XapDeployCmd.exe";
54
54
  Wp8EmulatorServices.WP8_LAUNCHER_PATH = "Microsoft SDKs\\Windows Phone\\v8.0\\Tools\\XAP Deployment";
55
55
  yok_1.injector.register("wp8EmulatorServices", Wp8EmulatorServices);
56
+ //# sourceMappingURL=wp8-emulator-services.js.map
@@ -14,3 +14,4 @@ class Opener {
14
14
  }
15
15
  exports.Opener = Opener;
16
16
  yok_1.injector.register("opener", Opener);
17
+ //# sourceMappingURL=opener.js.map
@@ -19,3 +19,4 @@ class OsInfo {
19
19
  }
20
20
  exports.OsInfo = OsInfo;
21
21
  yok_1.injector.register("osInfo", OsInfo);
22
+ //# sourceMappingURL=os-info.js.map
@@ -22,3 +22,4 @@ class PlistParser {
22
22
  }
23
23
  exports.PlistParser = PlistParser;
24
24
  yok_1.injector.register("plistParser", PlistParser);
25
+ //# sourceMappingURL=plist-parser.js.map
@@ -68,3 +68,4 @@ class ProjectHelper {
68
68
  }
69
69
  exports.ProjectHelper = ProjectHelper;
70
70
  yok_1.injector.register("projectHelper", ProjectHelper);
71
+ //# sourceMappingURL=project-helper.js.map
@@ -26,6 +26,7 @@ class Prompter {
26
26
  else {
27
27
  const result = {};
28
28
  _.each(questions, (s) => {
29
+ // Curly brackets needed because s.default() may return false and break the loop
29
30
  result[s.name] = s.default();
30
31
  });
31
32
  return result;
@@ -122,7 +123,9 @@ class Prompter {
122
123
  }
123
124
  muteStdout() {
124
125
  if (helpers.isInteractive()) {
125
- process.stdin.setRawMode(true);
126
+ process.stdin.setRawMode(true); // After setting rawMode to true, Ctrl+C doesn't work for non node.js events loop i.e device log command
127
+ // We need to create mute-stream and to pass it as output to ctrlcReader
128
+ // This will prevent the prompter to show the user's text twice on the console
126
129
  this.muteStreamInstance = new MuteStream();
127
130
  this.muteStreamInstance.pipe(process.stdout);
128
131
  this.muteStreamInstance.mute();
@@ -131,6 +134,7 @@ class Prompter {
131
134
  output: this.muteStreamInstance,
132
135
  });
133
136
  this.ctrlcReader.on("SIGINT", () => {
137
+ // enable terminal cursor
134
138
  process.stdout.write("\x1B[?25h");
135
139
  process.exit();
136
140
  });
@@ -140,6 +144,7 @@ class Prompter {
140
144
  if (helpers.isInteractive()) {
141
145
  process.stdin.setRawMode(false);
142
146
  if (this.muteStreamInstance) {
147
+ // We need to clean the event listeners from the process.stdout because the MuteStream.pipe function calls the pipe function of the Node js Stream which adds event listeners and this can cause memory leak if we display more than ~10 prompts.
143
148
  this.cleanEventListeners(process.stdout);
144
149
  this.muteStreamInstance.unmute();
145
150
  this.muteStreamInstance = null;
@@ -148,6 +153,8 @@ class Prompter {
148
153
  }
149
154
  }
150
155
  cleanEventListeners(stream) {
156
+ // The events names and listeners names can be found here https://github.com/nodejs/node/blob/master/lib/stream.js
157
+ // Which event cause memory leak can be tested with stream.listeners("event-name") and if the listeners count keeps increasing with each prompt we need to remove the listener.
151
158
  const memoryLeakEvents = [
152
159
  {
153
160
  eventName: "close",
@@ -174,3 +181,4 @@ class Prompter {
174
181
  }
175
182
  exports.Prompter = Prompter;
176
183
  yok_1.injector.register("prompter", Prompter);
184
+ //# sourceMappingURL=prompter.js.map
@@ -24,3 +24,4 @@ class Queue {
24
24
  }
25
25
  }
26
26
  exports.Queue = Queue;
27
+ //# sourceMappingURL=queue.js.map
@@ -23,3 +23,4 @@ class ResourceLoader {
23
23
  }
24
24
  exports.ResourceLoader = ResourceLoader;
25
25
  yok_1.injector.register("resources", ResourceLoader);
26
+ //# sourceMappingURL=resource-loader.js.map