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
@@ -15,7 +15,9 @@ const yok_1 = require("./yok");
15
15
  const constants_1 = require("../constants");
16
16
  const semver = require("semver");
17
17
  class CommandDispatcher {
18
- constructor($logger, $injector, $cancellation, $commandsService, $staticConfig, $sysInfo, $options, $versionsService, $packageManager, $terminalSpinnerService) {
18
+ constructor($logger,
19
+ // required by the hooksService
20
+ $injector, $cancellation, $commandsService, $staticConfig, $sysInfo, $options, $versionsService, $packageManager, $terminalSpinnerService) {
19
21
  this.$logger = $logger;
20
22
  this.$injector = $injector;
21
23
  this.$cancellation = $cancellation;
@@ -32,6 +34,7 @@ class CommandDispatcher {
32
34
  return this.printVersion();
33
35
  }
34
36
  if (this.$logger.getLevel() === "TRACE" && !this.$options.json) {
37
+ // CommandDispatcher is called from external CLI's only, so pass the path to their package.json
35
38
  this.$logger.trace("Collecting system information...");
36
39
  const sysInfo = await this.$sysInfo.getSysInfo({
37
40
  pathToNativeScriptCliPackageJson: path.join(__dirname, "..", "..", "package.json"),
@@ -61,6 +64,7 @@ class CommandDispatcher {
61
64
  await this.$commandsService.tryExecuteCommand(commandName, commandArguments);
62
65
  }
63
66
  async resolveCommand(commandName, commandArguments, argv) {
67
+ // just a hook point
64
68
  return { commandName, commandArguments, argv };
65
69
  }
66
70
  getCommandName() {
@@ -68,12 +72,15 @@ class CommandDispatcher {
68
72
  if (remaining.length > 0) {
69
73
  return remaining[0].toString().toLowerCase();
70
74
  }
75
+ // if only <CLI_NAME> is specified on console, show console help
71
76
  this.$options.help = true;
72
77
  return "";
73
78
  }
74
79
  async printVersion() {
75
80
  this.$logger.info(this.$staticConfig.version);
76
81
  if (this.$options.json) {
82
+ // we don't check for updates when --json is passed
83
+ // useful for tools that rely on the output of the command
77
84
  return;
78
85
  }
79
86
  const spinner = this.$terminalSpinnerService.createSpinner();
@@ -101,6 +108,7 @@ class CommandDispatcher {
101
108
  if (semver.gte(nativescriptCliVersion.currentVersion, nativescriptCliVersion.latestVersion, {
102
109
  loose: true,
103
110
  })) {
111
+ // up-to-date
104
112
  spinner.succeed("Up to date.");
105
113
  }
106
114
  else {
@@ -132,3 +140,4 @@ class FutureDispatcher {
132
140
  }
133
141
  }
134
142
  yok_1.injector.register("dispatcher", FutureDispatcher, false);
143
+ //# sourceMappingURL=dispatchers.js.map
@@ -15,7 +15,9 @@ const source_map_1 = require("source-map");
15
15
  const helpers_1 = require("./helpers");
16
16
  const decorators_1 = require("./decorators");
17
17
  const yok_1 = require("./yok");
18
+ // we need this to overwrite .stack property (read-only in Error)
18
19
  function Exception() {
20
+ /* intentionally left blank */
19
21
  }
20
22
  Exception.prototype = new Error();
21
23
  async function resolveCallStack(error) {
@@ -60,6 +62,7 @@ async function resolveCallStack(error) {
60
62
  }));
61
63
  let outputMessage = remapped.join("\n");
62
64
  if (outputMessage.indexOf(error.message) === -1) {
65
+ // when fibers throw error in node 0.12.x, the stack does NOT contain the message
63
66
  outputMessage = outputMessage.replace(/Error/, "Error: " + error.message);
64
67
  }
65
68
  return outputMessage;
@@ -83,7 +86,9 @@ function installUncaughtExceptionListener(actionOnException) {
83
86
  }
84
87
  }
85
88
  catch (err) {
86
- process.exit(131);
89
+ // In case the handler throws error and we do not catch it, we'll go in infinite loop of unhandled rejections.
90
+ // We cannot do anything here as even `console.error` may fail. So just exit the process.
91
+ process.exit(131 /* ErrorCodes.UNHANDLED_REJECTION_FAILURE */);
87
92
  }
88
93
  };
89
94
  process.on("uncaughtException", handler);
@@ -95,6 +100,7 @@ async function tryTrackException(error, localInjector) {
95
100
  disableAnalytics = localInjector.resolve("staticConfig").disableAnalytics;
96
101
  }
97
102
  catch (err) {
103
+ // We should get here only in our unit tests.
98
104
  disableAnalytics = true;
99
105
  }
100
106
  if (!disableAnalytics) {
@@ -103,6 +109,7 @@ async function tryTrackException(error, localInjector) {
103
109
  await analyticsService.trackException(error, error.message);
104
110
  }
105
111
  catch (e) {
112
+ // Do not replace with logger due to cyclic dependency
106
113
  console.error("Error while reporting exception: " + e);
107
114
  }
108
115
  }
@@ -140,9 +147,10 @@ class Errors {
140
147
  exception.message = $messagesService.getMessage.apply($messagesService, [opts.formatStr].concat(argsArray));
141
148
  }
142
149
  catch (err) {
150
+ // Ignore
143
151
  }
144
152
  exception.stack = new Error(exception.message).stack;
145
- exception.errorCode = opts.errorCode || 127;
153
+ exception.errorCode = opts.errorCode || 127 /* ErrorCodes.UNKNOWN */;
146
154
  exception.suggestCommandHelp = suggestCommandHelp;
147
155
  exception.proxyAuthenticationRequired = !!opts.proxyAuthenticationRequired;
148
156
  exception.printOnStdout = opts.printOnStdout;
@@ -174,9 +182,10 @@ class Errors {
174
182
  await printCommandHelpSuggestion();
175
183
  }
176
184
  await tryTrackException(ex, this.$injector);
177
- process.exit(_.isNumber(ex.errorCode) ? ex.errorCode : 127);
185
+ process.exit(_.isNumber(ex.errorCode) ? ex.errorCode : 127 /* ErrorCodes.UNKNOWN */);
178
186
  }
179
187
  }
188
+ // If you want to activate this function, start Node with flags --nouse_idle_notification and --expose_gc
180
189
  verifyHeap(message) {
181
190
  if (global.gc) {
182
191
  console.log("verifyHeap: '%s'", message);
@@ -189,3 +198,4 @@ __decorate([
189
198
  (0, decorators_1.deprecated)("Use `fail` instead.")
190
199
  ], Errors.prototype, "failWithoutHelp", null);
191
200
  yok_1.injector.register("errors", Errors);
201
+ //# sourceMappingURL=errors.js.map
@@ -20,12 +20,14 @@ const constants_1 = require("../constants");
20
20
  const os_1 = require("os");
21
21
  const detectNewline = require("detect-newline");
22
22
  const archiver_1 = require("archiver");
23
+ // TODO: Add .d.ts for mkdirp module (or use it from @types repo).
23
24
  const mkdirp = require("mkdirp");
24
25
  let FileSystem = FileSystem_1 = class FileSystem {
25
26
  constructor($injector) {
26
27
  this.$injector = $injector;
27
28
  }
28
29
  async zipFiles(zipFile, files, zipPathCallback) {
30
+ //we are resolving it here instead of in the constructor, because config has dependency on file system and config shouldn't require logger
29
31
  const $logger = this.$injector.resolve("logger");
30
32
  const zip = (0, archiver_1.create)("zip", {
31
33
  zlib: {
@@ -62,10 +64,10 @@ let FileSystem = FileSystem_1 = class FileSystem {
62
64
  proc = (0, path_1.join)(__dirname, "resources/platform-tools/unzip/win32/unzip");
63
65
  }
64
66
  else if ($hostInfo.isDarwin) {
65
- proc = "unzip";
67
+ proc = "unzip"; // darwin unzip is info-zip
66
68
  }
67
69
  else if ($hostInfo.isLinux) {
68
- proc = "unzip";
70
+ proc = "unzip"; // linux unzip is info-zip
69
71
  }
70
72
  if (!isCaseSensitive) {
71
73
  zipFile = this.findFileCaseInsensitive(zipFile);
@@ -106,6 +108,7 @@ let FileSystem = FileSystem_1 = class FileSystem {
106
108
  }
107
109
  catch (err) {
108
110
  if (err && err.code !== "ENOENT") {
111
+ // ignore "file doesn't exist" error
109
112
  throw err;
110
113
  }
111
114
  }
@@ -144,6 +147,7 @@ let FileSystem = FileSystem_1 = class FileSystem {
144
147
  }
145
148
  });
146
149
  if (root) {
150
+ // console.log("root", paths);
147
151
  return Array.from(paths.values()).reduce((sum, current) => sum + current, 0);
148
152
  }
149
153
  };
@@ -216,6 +220,8 @@ let FileSystem = FileSystem_1 = class FileSystem {
216
220
  writeFile(filename, data, encoding) {
217
221
  this.createDirectory((0, path_1.dirname)(filename));
218
222
  if (!data) {
223
+ // node 14 will no longer coerce unsupported input to strings anymore.
224
+ // clean any null or undefined data
219
225
  data = "";
220
226
  }
221
227
  fs.writeFileSync(filename, data, { encoding: encoding });
@@ -246,6 +252,8 @@ let FileSystem = FileSystem_1 = class FileSystem {
246
252
  return;
247
253
  }
248
254
  this.createDirectory((0, path_1.dirname)(destinationFileName));
255
+ // MobileApplication.app is resolved as a directory on Mac,
256
+ // therefore we need to copy it recursively as it's not a single file.
249
257
  shelljs.cp("-rf", sourceFileName, destinationFileName);
250
258
  const err = shelljs.error();
251
259
  if (err) {
@@ -321,7 +329,9 @@ let FileSystem = FileSystem_1 = class FileSystem {
321
329
  });
322
330
  await this.futureFromEvent(chown, "close");
323
331
  }
332
+ // nothing to do on Windows, as chown does not work on this platform
324
333
  }
334
+ // filterCallback: function(path: String, stat: fs.Stats): Boolean
325
335
  enumerateFilesInDirectorySync(directoryPath, filterCallback, opts, foundFiles) {
326
336
  foundFiles = foundFiles || [];
327
337
  if (!this.exists(directoryPath)) {
@@ -417,3 +427,4 @@ FileSystem.JSON_OBJECT_REGEXP = new RegExp(`{\\r*\\n*(\\W*)"`, "m");
417
427
  exports.FileSystem = FileSystem = FileSystem_1 = __decorate([
418
428
  injector.register("fs")
419
429
  ], FileSystem);
430
+ //# sourceMappingURL=file-system.js.map
@@ -13,11 +13,13 @@ function printHeader() {
13
13
  color_1.color.styleText(["cyanBright", "bold"], "{N} NativeScript "),
14
14
  color_1.color.styleText(["whiteBright", "bold"], "CLI"),
15
15
  color_1.color.dim(` [v${version}] `),
16
+ // color.dim(" │"),
16
17
  ].join("");
17
18
  const tagLine = [
18
19
  color_1.color.dim("│ "),
19
20
  color_1.color.dim(" → "),
20
21
  color_1.color.styleText(["whiteBright", "bold"], "Empower JavaScript with native APIs "),
22
+ // color.dim(" │"),
21
23
  ].join("");
22
24
  const headerLength = (0, color_1.stripColors)(header).length;
23
25
  const tagLineLength = (0, color_1.stripColors)(tagLine).length;
@@ -27,3 +29,4 @@ function printHeader() {
27
29
  console.info(" " + tagLine + " ".repeat(width - tagLineLength) + color_1.color.dim("│"));
28
30
  console.info(" " + color_1.color.dim("└" + "─".repeat(width - 1) + "┘"));
29
31
  }
32
+ //# sourceMappingURL=header.js.map
@@ -71,6 +71,13 @@ function doesCurrentNpmCommandMatch(patterns) {
71
71
  }
72
72
  return result;
73
73
  }
74
+ /**
75
+ * Equivalent of lodash's some, but instead of lambda, just pass array of Regular Expressions.
76
+ * If any of them matches any of the given elements, true is returned.
77
+ * @param {string[]} array Elements to be checked.
78
+ * @param {RegExp[]} patterns Regular expressions to be tested
79
+ * @returns {boolean} True in case any element of the array matches any of the patterns. False otherwise.
80
+ */
74
81
  function someWithRegExps(array, patterns) {
75
82
  return _.some(array, (item) => _.some(patterns, (pattern) => !!item.match(pattern)));
76
83
  }
@@ -82,6 +89,7 @@ function getCurrentNpmCommandArgv() {
82
89
  result = npmConfigArgv.original || [];
83
90
  }
84
91
  catch (error) {
92
+ // ignore
85
93
  }
86
94
  }
87
95
  return result;
@@ -100,6 +108,7 @@ function isInstallingNativeScriptGloballyWithNpm() {
100
108
  return isInstallCommand && isGlobalCommand && hasNativeScriptPackage;
101
109
  }
102
110
  function isInstallingNativeScriptGloballyWithYarn() {
111
+ // yarn populates the same env used by npm - npm_config_argv, so check it for yarn specific command
103
112
  const isInstallCommand = doesCurrentNpmCommandMatch([/^add$/]);
104
113
  const isGlobalCommand = doesCurrentNpmCommandMatch([/^global$/]);
105
114
  const hasNativeScriptPackage = doesCurrentNpmCommandMatch([
@@ -108,6 +117,13 @@ function isInstallingNativeScriptGloballyWithYarn() {
108
117
  ]);
109
118
  return isInstallCommand && isGlobalCommand && hasNativeScriptPackage;
110
119
  }
120
+ /**
121
+ * Creates regular expression from input string.
122
+ * The method replaces all occurences of RegExp special symbols in the input string with \<symbol>.
123
+ * @param {string} input The string from which a regular expression should be created.
124
+ * @param {string} opts RegExp options, for example "gm" - global and multiline.
125
+ * @returns {RegExp} The regular expression created from the input string.
126
+ */
111
127
  function createRegExp(input, opts) {
112
128
  if (!input || !_.isString(input)) {
113
129
  throw new Error("Input must be a string.");
@@ -115,13 +131,20 @@ function createRegExp(input, opts) {
115
131
  const escapedSource = regExpEscape(input);
116
132
  return new RegExp(escapedSource, opts);
117
133
  }
134
+ /**
135
+ * Escapes all special symbols used in regex.
136
+ * @param {string} input The string in which to replace the special regexp symbols.
137
+ * @returns {string} A string in which all regex symbols are escaped.
138
+ */
118
139
  function regExpEscape(input) {
140
+ // https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
119
141
  return input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
120
142
  }
121
143
  function getShortPluginName(pluginName) {
122
144
  return sanitizePluginName(pluginName).replace(/[\-]/g, "_");
123
145
  }
124
146
  function sanitizePluginName(pluginName) {
147
+ // avoid long plugin names, exclude the npm module scope (@scope/nativescript-plugin) from the android plugin name
125
148
  return pluginName.split("/").pop();
126
149
  }
127
150
  async function executeActionByChunks(initialData, chunkSize, elementAction) {
@@ -168,6 +191,13 @@ function deferPromise() {
168
191
  getResult: () => result,
169
192
  };
170
193
  }
194
+ /**
195
+ * Executes all promises and does not stop in case any of them throws.
196
+ * Returns the results of all promises in array when all are successfully resolved.
197
+ * In case any of the promises is rejected, rejects the resulted promise with all accumulated errors.
198
+ * @param {Promise<T>[]} promises Promises to be resolved.
199
+ * @returns {Promise<T[]>} New promise which will be resolved with the results of all promises.
200
+ */
171
201
  function settlePromises(promises) {
172
202
  return new Promise((resolve, reject) => {
173
203
  let settledPromisesCount = 0;
@@ -183,6 +213,7 @@ function settlePromises(promises) {
183
213
  results[index] = result;
184
214
  })
185
215
  .catch((err) => {
216
+ // Accumulate all errors.
186
217
  errors.push(err);
187
218
  })
188
219
  .then(() => {
@@ -214,12 +245,14 @@ function bashQuote(s) {
214
245
  if (s[0] === "'" && s[s.length - 1] === "'") {
215
246
  return s;
216
247
  }
248
+ // replace ' with '"'"' and wrap in ''
217
249
  return "'" + s.replace(/'/g, "'\"'\"'") + "'";
218
250
  }
219
251
  function cmdQuote(s) {
220
252
  if (s[0] === '"' && s[s.length - 1] === '"') {
221
253
  return s;
222
254
  }
255
+ // replace " with \" and wrap in ""
223
256
  return '"' + s.replace(/"/g, '\\"') + '"';
224
257
  }
225
258
  function quoteString(s) {
@@ -276,6 +309,9 @@ function isInteractive() {
276
309
  const result = isRunningInTTY() && !isCIEnvironment();
277
310
  return result;
278
311
  }
312
+ /**
313
+ * Checks if current process is running in Text Terminal (TTY)
314
+ */
279
315
  function isRunningInTTY() {
280
316
  return (process.stdout &&
281
317
  process.stdout.isTTY &&
@@ -283,6 +319,10 @@ function isRunningInTTY() {
283
319
  process.stdin.isTTY);
284
320
  }
285
321
  function isCIEnvironment() {
322
+ // The following CI environments set their own environment variables that we respect:
323
+ // travis: "CI",
324
+ // circleCI: "CI",
325
+ // jenkins: "JENKINS_HOME"
286
326
  return !!(process.env && (process.env.CI || process.env.JENKINS_HOME));
287
327
  }
288
328
  function toBoolean(str) {
@@ -337,11 +377,11 @@ function getMessageWithBorders(message, spanLength = 3) {
337
377
  const longestRowLength = message.split("\n").sort((a, b) => {
338
378
  return b.length - a.length;
339
379
  })[0].length;
340
- let border = "*".repeat(longestRowLength + 2 * spanLength);
380
+ let border = "*".repeat(longestRowLength + 2 * spanLength); // * 2 for both sides
341
381
  if (border.length % 2 === 0) {
342
- border += "*";
382
+ border += "*"; // the * should always be an odd number in order to get * in each edge (we will remove the even *s below)
343
383
  }
344
- border = border.replace(/\*\*/g, "* ");
384
+ border = border.replace(/\*\*/g, "* "); // ***** => * * * in order to have similar padding to the side borders
345
385
  const formatRow = function (row) {
346
386
  return (_.padEnd("*", spanLength) +
347
387
  _.padEnd(row, border.length - 2 * spanLength) +
@@ -371,12 +411,20 @@ function trimSymbol(str, symbol) {
371
411
  return str;
372
412
  }
373
413
  function parseJson(data) {
414
+ // Replace BOM from the header of the file if it exists
374
415
  return JSON.parse(data.replace(/^\uFEFF/, ""));
375
416
  }
417
+ // TODO: Use generic for predicatе predicate: (element: T|T[]) when TypeScript support this.
376
418
  async function getFuturesResults(promises, predicate) {
377
419
  const results = await Promise.all(promises);
378
420
  return _(results).filter(predicate).flatten().value();
379
421
  }
422
+ /**
423
+ * Appends zeroes to a version string until it reaches a specified length.
424
+ * @param {string} version The version on which to append zeroes.
425
+ * @param requiredVersionLength The required length of the version string.
426
+ * @returns {string} Appended version string. In case input is null, undefined or empty string, it is returned immediately without appending anything.
427
+ */
380
428
  function appendZeroesToVersion(version, requiredVersionLength) {
381
429
  if (version) {
382
430
  const zeroesToAppend = requiredVersionLength - version.split(".").length;
@@ -521,6 +569,14 @@ function getProjectFilesConfig(opts) {
521
569
  };
522
570
  return projectFilesConfig;
523
571
  }
572
+ /**
573
+ * Tries to find the process id (PID) of the specified application identifier.
574
+ * This is specific implementation for iOS Simulator, where the running applications are real processes.
575
+ * Their PIDs are printed in a specific format in the the logs, once the application is started.
576
+ * @param {string} applicationIdentifier Application Identifier of the app for which we try to get the PID.
577
+ * @param {string} logLine Line that may contain the PID of the process.
578
+ * @returns {string} The PID of the searched application identifier in case it's found in the current line, null otherwise.
579
+ */
524
580
  function getPidFromiOSSimulatorLogs(applicationIdentifier, logLine) {
525
581
  if (logLine) {
526
582
  const pidRegExp = new RegExp(`${applicationIdentifier}:\\s?(\\d+)`);
@@ -568,6 +624,7 @@ function getWinRegPropertyValue(key, propertyName) {
568
624
  function stringify(value, replacer, space) {
569
625
  return JSON.stringify(value, replacer, space || 2);
570
626
  }
627
+ //2019-01-07 18:29:50.745
571
628
  function getFixedLengthDateString() {
572
629
  const currentDate = new Date();
573
630
  const year = currentDate.getFullYear();
@@ -590,6 +647,28 @@ function getFormattedMilliseconds(date) {
590
647
  }
591
648
  return milliseconds;
592
649
  }
650
+ //--- begin part copied from AngularJS
651
+ //The MIT License
652
+ //
653
+ //Copyright (c) 2010-2012 Google, Inc. http://angularjs.org
654
+ //
655
+ //Permission is hereby granted, free of charge, to any person obtaining a copy
656
+ //of this software and associated documentation files (the "Software"), to deal
657
+ //in the Software without restriction, including without limitation the rights
658
+ //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
659
+ //copies of the Software, and to permit persons to whom the Software is
660
+ //furnished to do so, subject to the following conditions:
661
+ //
662
+ // The above copyright notice and this permission notice shall be included in
663
+ //all copies or substantial portions of the Software.
664
+ //
665
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
666
+ //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
667
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
668
+ //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
669
+ //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
670
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
671
+ //THE SOFTWARE.
593
672
  const CLASS_NAME = /class\s+([A-Z].+?)(?:\s+.*?)?\{/;
594
673
  const CONSTRUCTOR_ARGS = /constructor\s*([^\(]*)\(\s*([^\)]*)\)/m;
595
674
  const FN_NAME_AND_ARGS = /^(?:function)?\s*([^\(]*)\(\s*([^\)]*)\)\s*(=>)?\s*[{_]/m;
@@ -619,6 +698,11 @@ function annotate(fn) {
619
698
  }
620
699
  return $inject;
621
700
  }
701
+ /**
702
+ * Returns true if all Android signing options are provided, false otherwise.
703
+ * @param {IAndroidSigningData} signingData The signing data to be validated.
704
+ * @return {void}
705
+ */
622
706
  function hasValidAndroidSigning(signingData) {
623
707
  const isValid = signingData &&
624
708
  signingData.keyStorePath &&
@@ -627,3 +711,5 @@ function hasValidAndroidSigning(signingData) {
627
711
  signingData.keyStoreAliasPassword;
628
712
  return !!isValid;
629
713
  }
714
+ //--- end part copied from AngularJS
715
+ //# sourceMappingURL=helpers.js.map
@@ -65,6 +65,9 @@ class HostInfo {
65
65
  catch (err) {
66
66
  this.$logger.trace(`Unable to get macOS version from ${systemProfileCommand}. Error is: ${err}`);
67
67
  }
68
+ // https://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
69
+ // Each macOS version is labeled 10.<version>, where it looks like <versions> is taken from the major version returned by os.release() (16.x.x for example) and subtracting 4 from it.
70
+ // So the version becomes "10.12" in this case.
68
71
  const osRelease = this.$osInfo.release();
69
72
  const majorVersion = osRelease && _.first(osRelease.split("."));
70
73
  macOSVersion = majorVersion && `10.${+majorVersion - 4}`;
@@ -118,3 +121,4 @@ __decorate([
118
121
  (0, decorators_1.cache)()
119
122
  ], HostInfo.prototype, "getMacOSVersion", null);
120
123
  yok_1.injector.register("hostInfo", HostInfo);
124
+ //# sourceMappingURL=host-info.js.map
@@ -26,6 +26,9 @@ class HttpClient {
26
26
  catch (err) {
27
27
  if (err.message === HttpClient.STUCK_REQUEST_ERROR_MESSAGE ||
28
28
  err.message === HttpClient.STUCK_RESPONSE_ERROR_MESSAGE) {
29
+ // Retry the request immediately because there are at least 10 seconds between the two requests.
30
+ // We have to retry only once the sporadically stuck requests/responses.
31
+ // We can add exponential backoff retry here if we decide that we need to workaround bigger network issues on the client side.
29
32
  this.$logger.warn("%s Retrying request to %s...", err.message, options.url || options);
30
33
  const retryResult = await this.httpRequestCore(options, proxySettings);
31
34
  return {
@@ -51,6 +54,7 @@ class HttpClient {
51
54
  await this.useProxySettings(proxySettings, cliProxySettings, options, headers, requestProto);
52
55
  if (!headers["User-Agent"]) {
53
56
  if (!this.defaultUserAgent) {
57
+ //TODO: the user agent client name is also passed explicitly during login and should be kept in sync
54
58
  this.defaultUserAgent = `${this.$staticConfig.USER_AGENT_NAME}/${this.$staticConfig.version} (Node.js ${process.versions.node}; ${process.platform}; ${process.arch})`;
55
59
  this.$logger.trace("User-Agent: %s", this.defaultUserAgent);
56
60
  }
@@ -79,14 +83,19 @@ class HttpClient {
79
83
  }).catch((err) => {
80
84
  this.$logger.trace("An error occurred while sending the request:", err);
81
85
  if (err.response) {
86
+ // The request was made and the server responded with a status code
87
+ // that falls out of the range of 2xx
82
88
  const errorMessage = this.getErrorMessage(err.response.status, null);
83
89
  err.proxyAuthenticationRequired =
84
90
  err.response.status === constants_1.HttpStatusCodes.PROXY_AUTHENTICATION_REQUIRED;
85
91
  err.message = errorMessage || err.message;
86
92
  }
87
93
  else if (err.request) {
94
+ // The request was made but no response was received
95
+ // `err.request` is an instance of XMLHttpRequest in the browser and an instance of
88
96
  }
89
97
  else {
98
+ // Something happened in setting up the request that triggered an Error
90
99
  }
91
100
  throw err;
92
101
  });
@@ -132,8 +141,17 @@ class HttpClient {
132
141
  return body;
133
142
  }
134
143
  }
144
+ /**
145
+ * This method respects the proxySettings (or proxyCache) by modifying headers and options passed to http(s) module.
146
+ * @param {IProxySettings} proxySettings The settings passed for this specific call.
147
+ * @param {IProxySettings} cliProxySettings The globally set proxy for this CLI.
148
+ * @param {any}options The object that will be passed to http(s) module.
149
+ * @param {any} headers Headers of the current request.
150
+ * @param {string} requestProto The protocol used for the current request - http or https.
151
+ */
135
152
  async useProxySettings(proxySettings, cliProxySettings, options, headers, requestProto) {
136
153
  const isLocalRequest = options.host === "localhost" || options.host === "127.0.0.1";
154
+ // don't use the proxy for requests to localhost
137
155
  if (!isLocalRequest && (proxySettings || cliProxySettings)) {
138
156
  const proto = (proxySettings && proxySettings.protocol) ||
139
157
  cliProxySettings.protocol ||
@@ -144,6 +162,7 @@ class HttpClient {
144
162
  if (cliProxySettings.username && cliProxySettings.password) {
145
163
  credentialsPart = `${cliProxySettings.username}:${cliProxySettings.password}@`;
146
164
  }
165
+ // Note that proto ends with :
147
166
  options.proxy = `${proto}//${credentialsPart}${host}:${port}`;
148
167
  options.rejectUnauthorized = proxySettings
149
168
  ? proxySettings.rejectUnauthorized
@@ -156,3 +175,4 @@ exports.HttpClient = HttpClient;
156
175
  HttpClient.STUCK_REQUEST_ERROR_MESSAGE = "The request can't receive any response.";
157
176
  HttpClient.STUCK_RESPONSE_ERROR_MESSAGE = "Can't receive all parts of the response.";
158
177
  yok_1.injector.register("httpClient", HttpClient);
178
+ //# sourceMappingURL=http-client.js.map
@@ -15,9 +15,13 @@ function cliAppender(layout) {
15
15
  return appender;
16
16
  }
17
17
  function configure(config, layouts) {
18
+ // the default layout for the appender
18
19
  let layout = layouts.messagePassThroughLayout;
20
+ // check if there is another layout specified
19
21
  if (config.layout) {
20
22
  layout = layouts.layout(config.layout.type, config.layout);
21
23
  }
24
+ // create a new appender instance
22
25
  return cliAppender(layout);
23
26
  }
27
+ //# sourceMappingURL=cli-appender.js.map
@@ -21,9 +21,13 @@ function configure(config, layouts) {
21
21
  if (!config.emitter.emit || typeof config.emitter.emit !== "function") {
22
22
  throw new Error("The passed emitter must be instance of EventEmitter");
23
23
  }
24
+ // the default layout for the appender
24
25
  let layout = layouts.messagePassThroughLayout;
26
+ // check if there is another layout specified
25
27
  if (config.layout) {
26
28
  layout = layouts.layout(config.layout.type, config.layout);
27
29
  }
30
+ // create a new appender instance
28
31
  return emitAppender(layout, config.emitter);
29
32
  }
33
+ //# sourceMappingURL=emit-appender.js.map
@@ -30,3 +30,4 @@ function layout(config) {
30
30
  return msg;
31
31
  };
32
32
  }
33
+ //# sourceMappingURL=cli-layout.js.map
@@ -98,9 +98,11 @@ class Logger {
98
98
  if (typeof item === "string") {
99
99
  return item;
100
100
  }
101
+ // do not try to read streams, because they may not be rewindable
101
102
  if (item instanceof stream.Readable) {
102
103
  return "[ReadableStream]";
103
104
  }
105
+ // There's no point in printing buffers
104
106
  if (item instanceof Buffer) {
105
107
  return "[Buffer]";
106
108
  }
@@ -153,12 +155,14 @@ class Logger {
153
155
  getLogOptionsForMessage(data) {
154
156
  const loggerOptionKeys = _.keys(constants_1.LoggerConfigData);
155
157
  const dataToCheck = data.filter((el) => {
158
+ // objects created with Object.create(null) do not have `hasOwnProperty` function
156
159
  if (!!el &&
157
160
  typeof el === "object" &&
158
161
  el.hasOwnProperty &&
159
162
  typeof el.hasOwnProperty === "function") {
160
163
  for (const key of loggerOptionKeys) {
161
164
  if (el.hasOwnProperty(key)) {
165
+ // include only the elements which have one of the keys we've specified as logger options
162
166
  return true;
163
167
  }
164
168
  }
@@ -197,3 +201,4 @@ __decorate([
197
201
  (0, decorators_1.cache)()
198
202
  ], Logger.prototype, "initialize", null);
199
203
  yok_1.injector.register("logger", Logger);
204
+ //# sourceMappingURL=logger.js.map
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
+ //
3
+ // automatically generated code; do not edit manually!
4
+ //
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.Messages = void 0;
4
7
  const yok_1 = require("../yok");
8
+ /* tslint:disable:all */
5
9
  class Messages {
6
10
  constructor() {
7
11
  this.Devices = {
@@ -13,3 +17,5 @@ class Messages {
13
17
  }
14
18
  exports.Messages = Messages;
15
19
  yok_1.injector.register("messages", Messages);
20
+ /* tslint:enable */
21
+ //# sourceMappingURL=messages.js.map