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
package/lib/common/yok.js CHANGED
@@ -9,6 +9,13 @@ const helpers_1 = require("./helpers");
9
9
  const constants_1 = require("./constants");
10
10
  let indent = "";
11
11
  function trace(formatStr, ...args) {
12
+ // uncomment following lines when debugging dependency injection
13
+ // const items: any[] = [];
14
+ // for (let _i = 1; _i < arguments.length; _i++) {
15
+ // items[_i - 1] = arguments[_i];
16
+ // }
17
+ // const util = require("util");
18
+ // console.log(util.format.apply(util, [indent + formatStr].concat(args)));
12
19
  }
13
20
  function pushIndent() {
14
21
  indent += " ";
@@ -26,6 +33,7 @@ function forEachName(names, action) {
26
33
  }
27
34
  function register(...rest) {
28
35
  return function (target) {
36
+ // TODO: Check if 'rest' has more arguments that have to be registered
29
37
  exports.injector.register(rest[0], target);
30
38
  };
31
39
  }
@@ -44,7 +52,7 @@ class Yok {
44
52
  }
45
53
  requireCommand(names, file) {
46
54
  forEachName(names, (commandName) => {
47
- const commands = commandName.split("|");
55
+ const commands = commandName.split("|" /* CommandsDelimiters.HierarchicalCommand */);
48
56
  if (commands.length > 1) {
49
57
  if (_.startsWith(commands[1], "*") &&
50
58
  this.modules[this.createCommandName(commands[0])]) {
@@ -54,7 +62,7 @@ class Yok {
54
62
  if (!this.hierarchicalCommands[parentCommandName]) {
55
63
  this.hierarchicalCommands[parentCommandName] = [];
56
64
  }
57
- this.hierarchicalCommands[parentCommandName].push(_.tail(commands).join("|"));
65
+ this.hierarchicalCommands[parentCommandName].push(_.tail(commands).join("|" /* CommandsDelimiters.HierarchicalCommand */));
58
66
  }
59
67
  if (commands.length > 1 &&
60
68
  !this.modules[this.createCommandName(commands[0])]) {
@@ -125,7 +133,7 @@ class Yok {
125
133
  }
126
134
  registerCommand(names, resolver) {
127
135
  forEachName(names, (name) => {
128
- const commands = name.split("|");
136
+ const commands = name.split("|" /* CommandsDelimiters.HierarchicalCommand */);
129
137
  this.register(this.createCommandName(name), resolver);
130
138
  if (commands.length > 1) {
131
139
  this.createHierarchicalCommand(commands[0]);
@@ -137,7 +145,7 @@ class Yok {
137
145
  }
138
146
  getDefaultCommand(name, commandArguments) {
139
147
  const subCommands = this.hierarchicalCommands[name];
140
- const defaultCommand = _.find(subCommands, (command) => _.some(command.split("|"), (c) => _.startsWith(c, "*")));
148
+ const defaultCommand = _.find(subCommands, (command) => _.some(command.split("|" /* CommandsDelimiters.HierarchicalCommand */), (c) => _.startsWith(c, "*" /* CommandsDelimiters.DefaultCommandSymbol */)));
141
149
  return defaultCommand;
142
150
  }
143
151
  buildHierarchicalCommand(parentCommandName, commandLineArguments) {
@@ -153,7 +161,7 @@ class Yok {
153
161
  remainingArguments = _.tail(remainingArguments);
154
162
  if ((matchingSubCommandName = _.find(subCommands, (sc) => sc === currentSubCommandName ||
155
163
  sc ===
156
- `${"*"}${currentSubCommandName}`))) {
164
+ `${"*" /* CommandsDelimiters.DefaultCommandSymbol */}${currentSubCommandName}`))) {
157
165
  finalSubCommandName = matchingSubCommandName;
158
166
  finalRemainingArguments = remainingArguments;
159
167
  }
@@ -162,8 +170,8 @@ class Yok {
162
170
  finalSubCommandName =
163
171
  this.getDefaultCommand(parentCommandName, commandLineArguments) || "";
164
172
  finalRemainingArguments = _.difference(commandLineArguments, finalSubCommandName
165
- .split("|")
166
- .map((command) => _.startsWith(command, "*")
173
+ .split("|" /* CommandsDelimiters.HierarchicalCommand */)
174
+ .map((command) => _.startsWith(command, "*" /* CommandsDelimiters.DefaultCommandSymbol */)
167
175
  ? command.substr(1)
168
176
  : command));
169
177
  }
@@ -194,7 +202,9 @@ class Yok {
194
202
  commandName = defaultCommand
195
203
  ? this.getHierarchicalCommandName(name, defaultCommand)
196
204
  : "help";
197
- if (_.includes(this.hierarchicalCommands[name], "*" + args[0])) {
205
+ // If we'll execute the default command, but it's full name had been written by the user
206
+ // for example "ns run ios", we have to remove the "ios" option from the arguments that we'll pass to the command.
207
+ if (_.includes(this.hierarchicalCommands[name], "*" /* CommandsDelimiters.DefaultCommandSymbol */ + args[0])) {
198
208
  commandArguments = _.tail(args);
199
209
  }
200
210
  else {
@@ -203,11 +213,13 @@ class Yok {
203
213
  }
204
214
  }
205
215
  else {
216
+ //Execute only default command without arguments
206
217
  if (defaultCommand) {
207
218
  commandName = this.getHierarchicalCommandName(name, defaultCommand);
208
219
  }
209
220
  else {
210
221
  commandName = "help";
222
+ // Show command-line help
211
223
  const options = this.resolve("options");
212
224
  options.help = true;
213
225
  }
@@ -219,7 +231,7 @@ class Yok {
219
231
  exports.injector.registerCommand(name, factory);
220
232
  }
221
233
  getHierarchicalCommandName(parentCommandName, subCommandName) {
222
- return [parentCommandName, subCommandName].join("|");
234
+ return [parentCommandName, subCommandName].join("|" /* CommandsDelimiters.HierarchicalCommand */);
223
235
  }
224
236
  async isValidHierarchicalCommand(commandName, commandArguments) {
225
237
  if (_.includes(Object.keys(this.hierarchicalCommands), commandName)) {
@@ -227,6 +239,8 @@ class Yok {
227
239
  if (subCommands) {
228
240
  const fullCommandName = this.buildHierarchicalCommand(commandName, commandArguments);
229
241
  if (!fullCommandName) {
242
+ // In case buildHierarchicalCommand doesn't find a valid command
243
+ // there isn't a valid command or default with those arguments
230
244
  const errors = exports.injector.resolve("errors");
231
245
  errors.failWithHelp(constants_1.ERROR_NO_VALID_SUBCOMMAND_FORMAT, commandName);
232
246
  }
@@ -236,8 +250,8 @@ class Yok {
236
250
  return false;
237
251
  }
238
252
  isDefaultCommand(commandName) {
239
- return (commandName.indexOf("*") > 0 &&
240
- commandName.indexOf("|") > 0);
253
+ return (commandName.indexOf("*" /* CommandsDelimiters.DefaultCommandSymbol */) > 0 &&
254
+ commandName.indexOf("|" /* CommandsDelimiters.HierarchicalCommand */) > 0);
241
255
  }
242
256
  register(name, resolver, shared) {
243
257
  shared = shared === undefined ? true : shared;
@@ -284,6 +298,12 @@ class Yok {
284
298
  return this.resolveByName(param, ctorArguments);
285
299
  }
286
300
  }
301
+ /* Regex to match dynamic calls in the following format:
302
+ #{moduleName.functionName} or
303
+ #{moduleName.functionName(param1)} or
304
+ #{moduleName.functionName(param1, param2)} - multiple parameters separated with comma are supported
305
+ Check dynamicCall method for sample usage of this regular expression and see how to determine the passed parameters
306
+ */
287
307
  get dynamicCallRegex() {
288
308
  return /#{([^.]+)\.([^}]+?)(\((.+)\))*}/;
289
309
  }
@@ -411,3 +431,4 @@ function setGlobalInjector(inj) {
411
431
  global.$injector = exports.injector = inj;
412
432
  return inj;
413
433
  }
434
+ //# sourceMappingURL=yok.js.map
package/lib/config.js CHANGED
@@ -7,8 +7,10 @@ const os = require("os");
7
7
  const _ = require("lodash");
8
8
  const yok_1 = require("./common/yok");
9
9
  class Configuration {
10
+ /*don't require logger and everything that has logger as dependency in config.js due to cyclic dependency*/
10
11
  constructor($fs) {
11
12
  this.$fs = $fs;
13
+ // User specific config
12
14
  this.DEBUG = false;
13
15
  this.ANDROID_DEBUG_UI = null;
14
16
  this.USE_POD_SANDBOX = false;
@@ -47,6 +49,7 @@ class StaticConfig {
47
49
  this._userAgent = null;
48
50
  }
49
51
  get disableCommandHooks() {
52
+ // Never set this to false because it will duplicate execution of hooks realized through method decoration
50
53
  return true;
51
54
  }
52
55
  get HTML_CLI_HELPERS_DIR() {
@@ -88,6 +91,7 @@ class StaticConfig {
88
91
  async getAdbFilePathCore() {
89
92
  const $childProcess = this.$injector.resolve("$childProcess");
90
93
  try {
94
+ // Do NOT use the adb wrapper because it will end blow up with Segmentation fault because the wrapper uses this method!!!
91
95
  const proc = await $childProcess.spawnFromEvent("adb", ["version"], "exit", undefined, { throwError: false });
92
96
  if (proc.stderr) {
93
97
  return await this.spawnPrivateAdb();
@@ -100,23 +104,40 @@ class StaticConfig {
100
104
  }
101
105
  return "adb";
102
106
  }
107
+ /*
108
+ Problem:
109
+ 1. Adb forks itself as a server which keeps running until adb kill-server is invoked or crashes
110
+ 2. On Windows running processes lock their image files due to memory mapping. Locked files prevent their parent directories from deletion and cannot be overwritten.
111
+ 3. Update and uninstall scenarios are broken
112
+ Solution:
113
+ - Copy adb and associated files into a temporary directory. Let this copy of adb run persistently
114
+ - On Posix OSes, immediately delete the file to not take file space
115
+ - Tie common lib version to updates of adb, so that when we integrate a newer adb we can use it
116
+ - Adb is named differently on OSes and may have additional files. The code is hairy to accommodate these differences
117
+ */
103
118
  async spawnPrivateAdb() {
104
119
  const $fs = this.$injector.resolve("$fs"), $childProcess = this.$injector.resolve("$childProcess"), $hostInfo = this.$injector.resolve("$hostInfo");
120
+ // prepare the directory to host our copy of adb
105
121
  const defaultAdbDirPath = path.join(__dirname, "common", "resources", "platform-tools", "android", process.platform);
106
122
  const pathToPackageJson = path.join(__dirname, "..", "package.json");
107
123
  const nsCliVersion = require(pathToPackageJson).version;
108
124
  const tmpDir = path.join(os.tmpdir(), `nativescript-cli-${nsCliVersion}`);
109
125
  $fs.createDirectory(tmpDir);
126
+ // copy the adb and associated files
110
127
  const targetAdb = path.join(tmpDir, "adb");
128
+ // In case directory is missing or it's empty, copy the new adb
111
129
  if (!$fs.exists(tmpDir) || !$fs.readDirectory(tmpDir).length) {
112
- shelljs.cp(path.join(defaultAdbDirPath, "*"), tmpDir);
130
+ shelljs.cp(path.join(defaultAdbDirPath, "*"), tmpDir); // deliberately ignore copy errors
131
+ // adb loses its executable bit when packed inside electron asar file. Manually fix the issue
113
132
  if (!$hostInfo.isWindows) {
114
133
  shelljs.chmod("+x", targetAdb);
115
134
  }
116
135
  }
136
+ // let adb start its global server
117
137
  await $childProcess.spawnFromEvent(targetAdb, ["start-server"], "exit");
118
138
  return targetAdb;
119
139
  }
120
140
  }
121
141
  exports.StaticConfig = StaticConfig;
122
142
  yok_1.injector.register("staticConfig", StaticConfig);
143
+ //# sourceMappingURL=config.js.map
@@ -10,3 +10,4 @@ class Constants {
10
10
  }
11
11
  exports.Constants = Constants;
12
12
  yok_1.injector.register("constants", Constants);
13
+ //# sourceMappingURL=constants-provider.js.map
package/lib/constants.js CHANGED
@@ -149,6 +149,7 @@ exports.RESERVED_TEMPLATE_NAMES = {
149
149
  solidjs: "@nativescript/template-blank-solid",
150
150
  solidts: "@nativescript/template-blank-solid-ts",
151
151
  svelte: "@nativescript/template-blank-svelte",
152
+ // vision templates
152
153
  vision: "@nativescript/template-hello-world-ts-vision",
153
154
  "vision-vue": "@nativescript/template-blank-vue-vision",
154
155
  "vision-ng": "@nativescript/template-hello-world-ng-vision",
@@ -224,6 +225,9 @@ DebugCommandErrors.UNABLE_TO_USE_FOR_DEVICE_AND_EMULATOR = "The options --for-de
224
225
  DebugCommandErrors.NO_DEVICES_EMULATORS_FOUND_FOR_OPTIONS = "Unable to find device or emulator for specified options.";
225
226
  DebugCommandErrors.UNSUPPORTED_DEVICE_OS_FOR_DEBUGGING = "Unsupported device OS for debugging";
226
227
  exports.AnalyticsEventLabelDelimiter = "__";
228
+ /**
229
+ * Used in ProjectDataService to concatenate the names of the properties inside nativescript key of package.json.
230
+ */
227
231
  exports.NATIVESCRIPT_PROPS_INTERNAL_DELIMITER = "**|__**";
228
232
  exports.CLI_RESOURCES_DIR_NAME = "resources";
229
233
  class AssetConstants {
@@ -240,6 +244,7 @@ AssetConstants.assets = "assets";
240
244
  AssetConstants.sizeDelimiter = "x";
241
245
  AssetConstants.defaultScale = 1;
242
246
  AssetConstants.defaultOverlayImageScale = 0.8;
247
+ // https://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
243
248
  class MacOSVersions {
244
249
  }
245
250
  exports.MacOSVersions = MacOSVersions;
@@ -249,6 +254,14 @@ MacOSVersions.Mojave = "10.14";
249
254
  MacOSVersions.Catalina = "10.15";
250
255
  exports.MacOSDeprecationStringFormat = "NativeScript does not support macOS %s and some functionality may not work. Please, upgrade to the latest macOS version.";
251
256
  exports.XcodeDeprecationStringFormat = "The current Xcode version %s will not be supported in the next release of NativeScript. Consider updating your Xcode to latest official version.";
257
+ // export class TemplateVersions {
258
+ // public static v1 = "v1";
259
+ // public static v2 = "v2";
260
+ // }
261
+ // export class ProjectTemplateErrors {
262
+ // public static InvalidTemplateVersionStringFormat =
263
+ // "The template '%s' has a NativeScript version '%s' that is not supported. Unable to create project from it.";
264
+ // }
252
265
  class Hooks {
253
266
  }
254
267
  exports.Hooks = Hooks;
@@ -289,6 +302,7 @@ AndroidAppBundleMessages.ANDROID_APP_BUNDLE_DOCS_MESSAGE = "What is Android App
289
302
  AndroidAppBundleMessages.ANDROID_APP_BUNDLE_PUBLISH_DOCS_MESSAGE = "How to use Android App Bundle for publishing: https://docs.nativescript.org/tooling/publishing/publishing-android-apps#android-app-bundle";
290
303
  exports.RunOnDeviceEvents = {
291
304
  runOnDeviceStopped: "runOnDeviceStopped",
305
+ // In case we name it error, EventEmitter expects instance of Error to be raised and will also raise uncaught exception in case there's no handler
292
306
  runOnDeviceError: "runOnDeviceError",
293
307
  runOnDeviceExecuted: "runOnDeviceExecuted",
294
308
  runOnDeviceStarted: "runOnDeviceStarted",
@@ -325,14 +339,52 @@ var DeviceConnectionType;
325
339
  })(DeviceConnectionType || (exports.DeviceConnectionType = DeviceConnectionType = {}));
326
340
  var LoggerLevel;
327
341
  (function (LoggerLevel) {
342
+ /**
343
+ * Show all log messages.
344
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
345
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
346
+ */
328
347
  LoggerLevel["ALL"] = "ALL";
348
+ /**
349
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
350
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
351
+ */
329
352
  LoggerLevel["TRACE"] = "TRACE";
353
+ /**
354
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
355
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
356
+ */
330
357
  LoggerLevel["DEBUG"] = "DEBUG";
358
+ /**
359
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
360
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
361
+ */
331
362
  LoggerLevel["INFO"] = "INFO";
363
+ /**
364
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
365
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
366
+ */
332
367
  LoggerLevel["WARN"] = "WARN";
368
+ /**
369
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
370
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
371
+ */
333
372
  LoggerLevel["ERROR"] = "ERROR";
373
+ /**
374
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
375
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
376
+ */
334
377
  LoggerLevel["FATAL"] = "FATAL";
378
+ /**
379
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
380
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
381
+ */
335
382
  LoggerLevel["MARK"] = "MARK";
383
+ /**
384
+ * Disable all logging.
385
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
386
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
387
+ */
336
388
  LoggerLevel["OFF"] = "OFF";
337
389
  })(LoggerLevel || (exports.LoggerLevel = LoggerLevel = {}));
338
390
  var LoggerConfigData;
@@ -350,3 +402,4 @@ var PackageManagers;
350
402
  PackageManagers["yarn2"] = "yarn2";
351
403
  PackageManagers["bun"] = "bun";
352
404
  })(PackageManagers || (exports.PackageManagers = PackageManagers = {}));
405
+ //# sourceMappingURL=constants.js.map
@@ -35,7 +35,7 @@ class BuildController extends events_1.EventEmitter {
35
35
  const platform = buildData.platform.toLowerCase();
36
36
  const projectData = this.$projectDataService.getProjectData(buildData.projectDir);
37
37
  const platformData = this.$platformsDataService.getPlatformData(platform, projectData);
38
- const action = "Build";
38
+ const action = "Build" /* constants.TrackActionNames.Build */;
39
39
  const isForDevice = this.$mobileHelper.isAndroidPlatform(platform)
40
40
  ? null
41
41
  : buildData && buildData.buildForDevice;
@@ -45,8 +45,8 @@ class BuildController extends events_1.EventEmitter {
45
45
  platform,
46
46
  projectDir: projectData.projectDir,
47
47
  additionalData: `${buildData.release ? constants_1.Configurations.Release : constants_1.Configurations.Debug}_${buildData.clean
48
- ? "Clean"
49
- : "Incremental"}`,
48
+ ? "Clean" /* constants.BuildStates.Clean */
49
+ : "Incremental" /* constants.BuildStates.Incremental */}`,
50
50
  });
51
51
  if (buildData.clean) {
52
52
  await platformData.platformProjectService.cleanProject(platformData.projectRoot);
@@ -114,3 +114,4 @@ class BuildController extends events_1.EventEmitter {
114
114
  }
115
115
  exports.BuildController = BuildController;
116
116
  yok_1.injector.register("buildController", BuildController);
117
+ //# sourceMappingURL=build-controller.js.map
@@ -40,13 +40,13 @@ class DebugController extends events_1.EventEmitter {
40
40
  this.$errors.fail(`The device with identifier ${debugData.deviceIdentifier} is unreachable. Make sure it is Trusted and try again.`);
41
41
  }
42
42
  await this.$analyticsService.trackEventActionInGoogleAnalytics({
43
- action: "Debug",
43
+ action: "Debug" /* TrackActionNames.Debug */,
44
44
  device,
45
45
  additionalData: this.$mobileHelper.isiOSPlatform(device.deviceInfo.platform) &&
46
46
  options &&
47
47
  options.inspector
48
- ? "Inspector"
49
- : "Chrome",
48
+ ? "Inspector" /* DebugTools.Inspector */
49
+ : "Chrome" /* DebugTools.Chrome */,
50
50
  projectDir: debugData.projectDir,
51
51
  });
52
52
  if (!(await device.applicationManager.isApplicationInstalled(debugData.applicationIdentifier))) {
@@ -87,6 +87,7 @@ class DebugController extends events_1.EventEmitter {
87
87
  }
88
88
  }
89
89
  async attachDebugger(attachDebuggerData) {
90
+ // Default values
90
91
  if (attachDebuggerData.debugOptions) {
91
92
  attachDebuggerData.debugOptions.chrome =
92
93
  attachDebuggerData.debugOptions.chrome === undefined
@@ -105,6 +106,9 @@ class DebugController extends events_1.EventEmitter {
105
106
  }
106
107
  const projectData = this.$projectDataService.getProjectData(attachDebuggerData.projectDir);
107
108
  const debugData = this.$debugDataService.getDebugData(attachDebuggerData.deviceIdentifier, projectData, attachDebuggerData.debugOptions);
109
+ // const platformData = this.$platformsDataService.getPlatformData(settings.platform, projectData);
110
+ // Of the properties below only `buildForDevice` and `release` are currently used.
111
+ // Leaving the others with placeholder values so that they may not be forgotten in future implementations.
108
112
  const debugInfo = await this.startDebug(debugData);
109
113
  const result = this.printDebugInformation(debugInfo, attachDebuggerData.debugOptions.forceDebuggerAttachedEvent);
110
114
  return result;
@@ -212,3 +216,4 @@ __decorate([
212
216
  (0, decorators_1.performanceLog)()
213
217
  ], DebugController.prototype, "enableDebuggingCoreWithoutWaitingCurrentAction", null);
214
218
  yok_1.injector.register("debugController", DebugController);
219
+ //# sourceMappingURL=debug-controller.js.map
@@ -28,3 +28,4 @@ class DeployController {
28
28
  }
29
29
  exports.DeployController = DeployController;
30
30
  yok_1.injector.register("deployController", DeployController);
31
+ //# sourceMappingURL=deploy-controller.js.map