nativescript 8.9.3 → 8.9.4-sap.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/lib/android-tools-info.js +12 -0
  2. package/lib/base-package-manager.js +7 -0
  3. package/lib/bootstrap.js +5 -1
  4. package/lib/bun-package-manager.js +14 -1
  5. package/lib/color.js +3 -0
  6. package/lib/commands/add-platform.js +1 -0
  7. package/lib/commands/apple-login.js +1 -0
  8. package/lib/commands/appstore-list.js +1 -0
  9. package/lib/commands/appstore-upload.js +3 -0
  10. package/lib/commands/build.js +3 -2
  11. package/lib/commands/clean.js +22 -1
  12. package/lib/commands/command-base.js +1 -0
  13. package/lib/commands/config.js +4 -0
  14. package/lib/commands/create-project.js +6 -0
  15. package/lib/commands/debug.js +6 -1
  16. package/lib/commands/deploy.js +3 -2
  17. package/lib/commands/embedding/embed.js +7 -0
  18. package/lib/commands/extensibility/install-extension.js +1 -0
  19. package/lib/commands/extensibility/list-extensions.js +1 -0
  20. package/lib/commands/extensibility/uninstall-extension.js +1 -0
  21. package/lib/commands/fonts.js +1 -0
  22. package/lib/commands/generate-assets.js +1 -0
  23. package/lib/commands/generate-help.js +1 -0
  24. package/lib/commands/generate.js +48 -1
  25. package/lib/commands/info.js +1 -0
  26. package/lib/commands/install.js +1 -0
  27. package/lib/commands/list-platforms.js +1 -0
  28. package/lib/commands/migrate.js +1 -0
  29. package/lib/commands/native-add.js +5 -0
  30. package/lib/commands/platform-clean.js +1 -0
  31. package/lib/commands/plugin/add-plugin.js +1 -0
  32. package/lib/commands/plugin/build-plugin.js +1 -0
  33. package/lib/commands/plugin/create-plugin.js +5 -0
  34. package/lib/commands/plugin/list-plugins.js +1 -0
  35. package/lib/commands/plugin/remove-plugin.js +2 -0
  36. package/lib/commands/plugin/update-plugin.js +1 -0
  37. package/lib/commands/post-install.js +6 -0
  38. package/lib/commands/prepare.js +4 -3
  39. package/lib/commands/preview.js +2 -0
  40. package/lib/commands/remove-platform.js +1 -0
  41. package/lib/commands/resources/resources-update.js +2 -0
  42. package/lib/commands/run.js +1 -0
  43. package/lib/commands/setup.js +1 -0
  44. package/lib/commands/start.js +1 -0
  45. package/lib/commands/test-init.js +4 -0
  46. package/lib/commands/test.js +9 -2
  47. package/lib/commands/typings.js +2 -1
  48. package/lib/commands/update-platform.js +5 -0
  49. package/lib/commands/update.js +2 -0
  50. package/lib/commands/widget.js +20 -1
  51. package/lib/common/bootstrap.js +1 -0
  52. package/lib/common/child-process.js +3 -0
  53. package/lib/common/codeGeneration/code-entity.js +1 -0
  54. package/lib/common/codeGeneration/code-printer.js +1 -0
  55. package/lib/common/command-params.js +1 -0
  56. package/lib/common/commands/analytics.js +3 -0
  57. package/lib/common/commands/autocompletion.js +3 -0
  58. package/lib/common/commands/device/device-log-stream.js +1 -0
  59. package/lib/common/commands/device/get-file.js +2 -0
  60. package/lib/common/commands/device/list-applications.js +1 -0
  61. package/lib/common/commands/device/list-devices.js +3 -0
  62. package/lib/common/commands/device/list-files.js +2 -0
  63. package/lib/common/commands/device/put-file.js +2 -0
  64. package/lib/common/commands/device/run-application.js +1 -0
  65. package/lib/common/commands/device/stop-application.js +1 -0
  66. package/lib/common/commands/device/uninstall-application.js +1 -0
  67. package/lib/common/commands/doctor.js +3 -2
  68. package/lib/common/commands/generate-messages.js +1 -0
  69. package/lib/common/commands/help.js +1 -0
  70. package/lib/common/commands/package-manager-get.js +1 -0
  71. package/lib/common/commands/package-manager-set.js +1 -0
  72. package/lib/common/commands/post-install.js +1 -0
  73. package/lib/common/commands/preuninstall.js +11 -2
  74. package/lib/common/commands/proxy/proxy-base.js +4 -0
  75. package/lib/common/commands/proxy/proxy-clear.js +1 -0
  76. package/lib/common/commands/proxy/proxy-get.js +1 -0
  77. package/lib/common/commands/proxy/proxy-set.js +1 -0
  78. package/lib/common/common-lib.js +1 -0
  79. package/lib/common/constants.js +11 -0
  80. package/lib/common/decorators.js +48 -0
  81. package/lib/common/dispatchers.js +10 -1
  82. package/lib/common/errors.js +13 -3
  83. package/lib/common/file-system.js +13 -2
  84. package/lib/common/header.js +3 -0
  85. package/lib/common/helpers.js +89 -3
  86. package/lib/common/host-info.js +4 -0
  87. package/lib/common/http-client.js +20 -0
  88. package/lib/common/logger/appenders/cli-appender.js +4 -0
  89. package/lib/common/logger/appenders/emit-appender.js +4 -0
  90. package/lib/common/logger/layouts/cli-layout.js +1 -0
  91. package/lib/common/logger/logger.js +5 -0
  92. package/lib/common/messages/messages.js +6 -0
  93. package/lib/common/mobile/android/android-application-manager.js +20 -1
  94. package/lib/common/mobile/android/android-debug-bridge-result-handler.js +1 -0
  95. package/lib/common/mobile/android/android-debug-bridge.js +6 -0
  96. package/lib/common/mobile/android/android-device-file-system.js +4 -0
  97. package/lib/common/mobile/android/android-device-hash-service.js +3 -0
  98. package/lib/common/mobile/android/android-device.js +8 -0
  99. package/lib/common/mobile/android/android-emulator-services.js +3 -2
  100. package/lib/common/mobile/android/android-ini-file-parser.js +9 -0
  101. package/lib/common/mobile/android/android-log-filter.js +4 -0
  102. package/lib/common/mobile/android/android-virtual-device-service.js +26 -0
  103. package/lib/common/mobile/android/device-android-debug-bridge.js +1 -0
  104. package/lib/common/mobile/android/genymotion/genymotion-service.js +6 -1
  105. package/lib/common/mobile/android/genymotion/virtualbox-service.js +11 -0
  106. package/lib/common/mobile/android/logcat-helper.js +13 -0
  107. package/lib/common/mobile/application-manager-base.js +6 -0
  108. package/lib/common/mobile/device-emitter.js +4 -0
  109. package/lib/common/mobile/device-log-emitter.js +1 -0
  110. package/lib/common/mobile/device-log-provider-base.js +1 -0
  111. package/lib/common/mobile/device-log-provider.js +23 -0
  112. package/lib/common/mobile/device-platforms-constants.js +1 -0
  113. package/lib/common/mobile/emulator-helper.js +4 -0
  114. package/lib/common/mobile/ios/device/ios-application-manager.js +3 -0
  115. package/lib/common/mobile/ios/device/ios-device-file-system.js +1 -0
  116. package/lib/common/mobile/ios/device/ios-device-operations.js +4 -0
  117. package/lib/common/mobile/ios/device/ios-device.js +4 -0
  118. package/lib/common/mobile/ios/ios-device-base.js +1 -0
  119. package/lib/common/mobile/ios/ios-device-product-name-mapper.js +2 -0
  120. package/lib/common/mobile/ios/ios-log-filter.js +1 -0
  121. package/lib/common/mobile/ios/simulator/ios-emulator-services.js +4 -0
  122. package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +1 -0
  123. package/lib/common/mobile/ios/simulator/ios-simulator-application-manager.js +6 -0
  124. package/lib/common/mobile/ios/simulator/ios-simulator-device.js +5 -0
  125. package/lib/common/mobile/ios/simulator/ios-simulator-file-system.js +1 -0
  126. package/lib/common/mobile/ios/simulator/ios-simulator-log-provider.js +1 -0
  127. package/lib/common/mobile/local-to-device-path-data-factory.js +1 -0
  128. package/lib/common/mobile/log-filter.js +2 -0
  129. package/lib/common/mobile/logging-levels.js +1 -0
  130. package/lib/common/mobile/mobile-core/android-device-discovery.js +2 -0
  131. package/lib/common/mobile/mobile-core/android-emulator-discovery.js +3 -0
  132. package/lib/common/mobile/mobile-core/android-process-service.js +32 -0
  133. package/lib/common/mobile/mobile-core/device-discovery.js +1 -0
  134. package/lib/common/mobile/mobile-core/devices-service.js +69 -0
  135. package/lib/common/mobile/mobile-core/ios-device-discovery.js +2 -0
  136. package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +3 -0
  137. package/lib/common/mobile/mobile-helper.js +1 -0
  138. package/lib/common/mobile/wp8/wp8-emulator-services.js +1 -0
  139. package/lib/common/opener.js +1 -0
  140. package/lib/common/os-info.js +1 -0
  141. package/lib/common/plist-parser.js +1 -0
  142. package/lib/common/project-helper.js +1 -0
  143. package/lib/common/prompter.js +9 -1
  144. package/lib/common/queue.js +1 -0
  145. package/lib/common/resource-loader.js +1 -0
  146. package/lib/common/services/auto-completion-service.js +13 -1
  147. package/lib/common/services/cancellation.js +2 -1
  148. package/lib/common/services/commands-service.js +17 -6
  149. package/lib/common/services/help-service.js +11 -3
  150. package/lib/common/services/hooks-service.js +13 -0
  151. package/lib/common/services/ios-notification-service.js +1 -0
  152. package/lib/common/services/json-file-settings-service.js +6 -0
  153. package/lib/common/services/lock-service.js +6 -0
  154. package/lib/common/services/message-contract-generator.js +1 -0
  155. package/lib/common/services/messages-service.js +1 -0
  156. package/lib/common/services/micro-templating-service.js +6 -0
  157. package/lib/common/services/net-service.js +3 -0
  158. package/lib/common/services/project-files-manager.js +5 -0
  159. package/lib/common/services/project-files-provider-base.js +1 -0
  160. package/lib/common/services/proxy-service.js +1 -0
  161. package/lib/common/services/qr.js +1 -0
  162. package/lib/common/services/settings-service.js +1 -0
  163. package/lib/common/services/xcode-select-service.js +1 -0
  164. package/lib/common/utils.js +1 -0
  165. package/lib/common/validators/project-name-validator.js +1 -0
  166. package/lib/common/validators/validation-result.js +1 -0
  167. package/lib/common/verify-node-version.js +8 -1
  168. package/lib/common/yok.js +32 -11
  169. package/lib/config.js +22 -1
  170. package/lib/constants-provider.js +1 -0
  171. package/lib/constants.js +53 -0
  172. package/lib/controllers/build-controller.js +4 -3
  173. package/lib/controllers/debug-controller.js +8 -3
  174. package/lib/controllers/deploy-controller.js +1 -0
  175. package/lib/controllers/migrate-controller.js +90 -4
  176. package/lib/controllers/platform-controller.js +9 -1
  177. package/lib/controllers/prepare-controller.js +17 -4
  178. package/lib/controllers/run-controller.js +17 -1
  179. package/lib/controllers/update-controller-base.js +1 -0
  180. package/lib/controllers/update-controller.js +11 -0
  181. package/lib/data/build-data.js +1 -0
  182. package/lib/data/controller-data-base.js +1 -0
  183. package/lib/data/debug-data.js +1 -0
  184. package/lib/data/platform-data.js +1 -0
  185. package/lib/data/prepare-data.js +1 -0
  186. package/lib/data/run-data.js +1 -0
  187. package/lib/detached-processes/cleanup-js-subprocess.js +8 -2
  188. package/lib/detached-processes/cleanup-process.js +18 -14
  189. package/lib/detached-processes/file-log-service.js +2 -1
  190. package/lib/device-path-provider.js +1 -0
  191. package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +7 -0
  192. package/lib/device-sockets/ios/notification.js +3 -0
  193. package/lib/device-sockets/ios/socket-request-executor.js +3 -0
  194. package/lib/helpers/android-bundle-validator-helper.js +2 -1
  195. package/lib/helpers/deploy-command-helper.js +1 -0
  196. package/lib/helpers/key-command-helper.js +4 -2
  197. package/lib/helpers/livesync-command-helper.js +4 -1
  198. package/lib/helpers/network-connectivity-validator.js +1 -0
  199. package/lib/helpers/options-track-helper.js +3 -2
  200. package/lib/helpers/package-path-helper.js +1 -0
  201. package/lib/helpers/platform-command-helper.js +7 -2
  202. package/lib/helpers/version-validator-helper.js +1 -0
  203. package/lib/key-commands/bootstrap.js +3 -2
  204. package/lib/key-commands/index.js +5 -4
  205. package/lib/nativescript-cli-lib-bootstrap.js +4 -0
  206. package/lib/nativescript-cli-lib.js +1 -0
  207. package/lib/nativescript-cli.js +10 -1
  208. package/lib/node/pbxproj-dom-xcode.js +1 -0
  209. package/lib/node/xcode.js +1 -0
  210. package/lib/node-package-manager.js +11 -1
  211. package/lib/options.js +144 -119
  212. package/lib/package-installation-manager.js +8 -1
  213. package/lib/package-manager.js +2 -0
  214. package/lib/platform-command-param.js +1 -0
  215. package/lib/pnpm-package-manager.js +4 -1
  216. package/lib/project-data.js +12 -0
  217. package/lib/providers/project-files-provider.js +1 -0
  218. package/lib/resolvers/livesync-service-resolver.js +1 -0
  219. package/lib/services/analytics/analytics-broker-process.js +10 -6
  220. package/lib/services/analytics/analytics-broker.js +2 -1
  221. package/lib/services/analytics/analytics-service.js +29 -25
  222. package/lib/services/analytics/google-analytics-provider.js +13 -12
  223. package/lib/services/analytics-settings-service.js +5 -0
  224. package/lib/services/android/android-bundle-tool-service.js +1 -0
  225. package/lib/services/android/gradle-build-args-service.js +3 -0
  226. package/lib/services/android/gradle-build-service.js +1 -0
  227. package/lib/services/android/gradle-command-service.js +1 -0
  228. package/lib/services/android-device-debug-service.js +6 -0
  229. package/lib/services/android-plugin-build-service.js +31 -2
  230. package/lib/services/android-project-service.js +71 -4
  231. package/lib/services/android-resources-migration-service.js +7 -0
  232. package/lib/services/apple-portal/apple-portal-application-service.js +1 -0
  233. package/lib/services/apple-portal/apple-portal-cookie-service.js +1 -0
  234. package/lib/services/apple-portal/apple-portal-session-service.js +6 -4
  235. package/lib/services/apple-portal/srp/srp-wrapper.js +4 -1
  236. package/lib/services/assets-generation/assets-generation-service.js +10 -5
  237. package/lib/services/build-artifacts-service.js +2 -1
  238. package/lib/services/build-data-service.js +1 -0
  239. package/lib/services/build-info-file-service.js +1 -0
  240. package/lib/services/cleanup-service.js +13 -9
  241. package/lib/services/cocoapods-platform-manager.js +9 -0
  242. package/lib/services/cocoapods-service.js +21 -1
  243. package/lib/services/debug-data-service.js +1 -0
  244. package/lib/services/debug-service-base.js +7 -0
  245. package/lib/services/device/device-install-app-service.js +2 -1
  246. package/lib/services/doctor-service.js +21 -6
  247. package/lib/services/extensibility-service.js +8 -0
  248. package/lib/services/files-hash-service.js +1 -0
  249. package/lib/services/hmr-status-service.js +2 -0
  250. package/lib/services/info-service.js +1 -0
  251. package/lib/services/initialize-service.js +5 -1
  252. package/lib/services/ios/export-options-plist-service.js +4 -0
  253. package/lib/services/ios/ios-signing-service.js +4 -0
  254. package/lib/services/ios/spm-service.js +11 -0
  255. package/lib/services/ios/xcodebuild-args-service.js +9 -0
  256. package/lib/services/ios/xcodebuild-command-service.js +1 -0
  257. package/lib/services/ios/xcodebuild-service.js +2 -1
  258. package/lib/services/ios-debugger-port-service.js +1 -0
  259. package/lib/services/ios-device-debug-service.js +1 -0
  260. package/lib/services/ios-entitlements-service.js +1 -0
  261. package/lib/services/ios-extensions-service.js +1 -0
  262. package/lib/services/ios-log-filter.js +20 -0
  263. package/lib/services/ios-native-target-service.js +6 -4
  264. package/lib/services/ios-project-service.js +91 -1
  265. package/lib/services/ios-provision-service.js +3 -0
  266. package/lib/services/ios-watch-app-service.js +1 -0
  267. package/lib/services/ip-service.js +2 -0
  268. package/lib/services/itmstransporter-service.js +1 -0
  269. package/lib/services/karma-execution.js +2 -0
  270. package/lib/services/livesync/android-device-livesync-service-base.js +1 -0
  271. package/lib/services/livesync/android-device-livesync-service.js +2 -0
  272. package/lib/services/livesync/android-device-livesync-sockets-service.js +3 -0
  273. package/lib/services/livesync/android-livesync-service.js +1 -0
  274. package/lib/services/livesync/android-livesync-tool.js +4 -0
  275. package/lib/services/livesync/device-livesync-service-base.js +2 -0
  276. package/lib/services/livesync/ios-device-livesync-service.js +7 -0
  277. package/lib/services/livesync/ios-livesync-service.js +2 -0
  278. package/lib/services/livesync/livesync-socket.js +1 -0
  279. package/lib/services/livesync/platform-livesync-service-base.js +5 -0
  280. package/lib/services/livesync-process-data-service.js +1 -0
  281. package/lib/services/log-parser-service.js +1 -0
  282. package/lib/services/log-source-map-service.js +15 -0
  283. package/lib/services/marking-mode-service.js +8 -5
  284. package/lib/services/metadata-filtering-service.js +1 -0
  285. package/lib/services/npm-config-service.js +4 -0
  286. package/lib/services/pacote-service.js +7 -0
  287. package/lib/services/performance-service.js +3 -1
  288. package/lib/services/platform/add-platform-service.js +49 -2
  289. package/lib/services/platform/platform-validation-service.js +1 -0
  290. package/lib/services/platform/prepare-native-platform-service.js +5 -2
  291. package/lib/services/platform-environment-requirements.js +8 -3
  292. package/lib/services/platform-project-service-base.js +1 -0
  293. package/lib/services/platforms-data-service.js +1 -0
  294. package/lib/services/plugins-service.js +20 -2
  295. package/lib/services/prepare-data-service.js +1 -0
  296. package/lib/services/project-backup-service.js +4 -0
  297. package/lib/services/project-changes-service.js +14 -3
  298. package/lib/services/project-cleanup-service.js +2 -0
  299. package/lib/services/project-config-service.js +21 -2
  300. package/lib/services/project-data-service.js +36 -7
  301. package/lib/services/project-name-service.js +1 -0
  302. package/lib/services/project-service.js +10 -0
  303. package/lib/services/project-templates-service.js +3 -2
  304. package/lib/services/qr-code-terminal-service.js +1 -0
  305. package/lib/services/require-service.js +1 -0
  306. package/lib/services/start-service.js +1 -0
  307. package/lib/services/temp-service.js +1 -0
  308. package/lib/services/terminal-spinner-service.js +2 -0
  309. package/lib/services/test-execution-service.js +9 -2
  310. package/lib/services/test-initialization-service.js +4 -0
  311. package/lib/services/timeline-profiler-service.js +1 -0
  312. package/lib/services/user-settings-service.js +1 -0
  313. package/lib/services/versions-service.js +6 -4
  314. package/lib/services/watch-ignore-list-service.js +1 -0
  315. package/lib/services/webpack/webpack-compiler-service.js +40 -0
  316. package/lib/services/xcconfig-service.js +2 -0
  317. package/lib/services/xcproj-service.js +1 -0
  318. package/lib/shared-event-bus.js +6 -0
  319. package/lib/sys-info.js +2 -1
  320. package/lib/tools/config-manipulation/config-transformer.js +12 -0
  321. package/lib/tools/node-modules/node-modules-builder.js +1 -0
  322. package/lib/tools/node-modules/node-modules-dependencies-builder.js +6 -0
  323. package/lib/yarn-package-manager.js +1 -0
  324. package/lib/yarn2-package-manager.js +3 -0
  325. package/package.json +8 -6
  326. package/vendor/gradle-plugin/build.gradle +3 -3
@@ -27,12 +27,14 @@ class ProjectDataService {
27
27
  this.$injector = $injector;
28
28
  this.projectDataCache = {};
29
29
  try {
30
+ // add the ProjectData of the default projectDir to the projectData cache
30
31
  const projectData = this.$injector.resolve("projectData");
31
32
  projectData.initializeProjectData();
32
33
  this.defaultProjectDir = projectData.projectDir;
33
34
  this.projectDataCache[this.defaultProjectDir] = projectData;
34
35
  }
35
36
  catch (e) {
37
+ // the CLI is required as a lib from a non-project folder
36
38
  }
37
39
  }
38
40
  get $pluginsService() {
@@ -61,6 +63,8 @@ class ProjectDataService {
61
63
  delete projectFileInfo.projectData[ProjectDataService.DEPENDENCIES_KEY_NAME][dependencyName];
62
64
  this.$fs.writeJson(projectFileInfo.projectFilePath, projectFileInfo.projectData);
63
65
  }
66
+ // TODO: Add tests
67
+ // TODO: Remove $projectData and replace it with $projectDataService.getProjectData
64
68
  getProjectData(projectDir) {
65
69
  projectDir = projectDir || this.defaultProjectDir;
66
70
  this.projectDataCache[projectDir] =
@@ -112,6 +116,10 @@ class ProjectDataService {
112
116
  this.$logger.trace(`"${propertyName}" property successfully removed.`);
113
117
  }
114
118
  async getAndroidAssetsStructure(opts) {
119
+ // TODO: Use image-size package to get the width and height of an image.
120
+ // TODO: Parse the splash_screen.xml in nodpi directory and get from it the names of the background and center image.
121
+ // TODO: Parse the AndroidManifest.xml to get the name of the icon.
122
+ // This way we'll not use the image-definitions.json and the method will return the real android structure.
115
123
  const projectDir = opts.projectDir;
116
124
  const projectData = this.getProjectData(projectDir);
117
125
  const pathToAndroidDir = path.join(projectData.appResourcesDirectoryPath, this.$devicePlatformsConstants.Android);
@@ -125,6 +133,7 @@ class ProjectDataService {
125
133
  useLegacy = !manifest.includes(`android:icon="@mipmap/ic_launcher"`);
126
134
  }
127
135
  catch (err) {
136
+ // ignore
128
137
  }
129
138
  const content = this.getImageDefinitions()[useLegacy ? "android_legacy" : "android"];
130
139
  return {
@@ -148,6 +157,8 @@ class ProjectDataService {
148
157
  }
149
158
  if (fstat.isDirectory()) {
150
159
  if (filePath === pathToProjectNodeModules) {
160
+ // we do not want to get the files from node_modules directory of the project.
161
+ // We'll get here only when you have nativescript.config with appDirectoryPath set to "."
151
162
  return false;
152
163
  }
153
164
  return true;
@@ -162,6 +173,9 @@ class ProjectDataService {
162
173
  }
163
174
  }
164
175
  updateNsConfigValue(projectDir, updateObject, propertiesToRemove) {
176
+ // todo: figure out a way to update js/ts configs
177
+ // most likely needs an ast parser/writer
178
+ // should be delegated to the config service
165
179
  const nsConfigPath = path.join(projectDir, constants.CONFIG_FILE_NAME_JS);
166
180
  const currentNsConfig = this.getNsConfig(nsConfigPath);
167
181
  let newNsConfig = currentNsConfig;
@@ -202,10 +216,14 @@ class ProjectDataService {
202
216
  const imageDefinitions = this.getImageDefinitions().ios;
203
217
  _.each(content && content.images, (image) => {
204
218
  let foundMatchingDefinition = false;
219
+ // In some cases the image may not be available, it will just be described.
220
+ // When this happens, the filename will be empty.
221
+ // So we'll keep the path empty as well.
205
222
  if (image.filename) {
206
223
  image.path = path.join(dirPath, image.filename);
207
224
  }
208
225
  if (image.size) {
226
+ // size is basically <width>x<height>
209
227
  const [width, height] = image.size
210
228
  .toString()
211
229
  .split(constants_1.AssetConstants.sizeDelimiter);
@@ -214,6 +232,7 @@ class ProjectDataService {
214
232
  image.height = +height;
215
233
  }
216
234
  }
235
+ // Find the image size based on the hardcoded values in the image-definitions.json
217
236
  _.each(imageDefinitions, (assetSubGroup) => {
218
237
  const assetItem = _.find(assetSubGroup, (assetElement) => assetElement.filename === image.filename &&
219
238
  path.basename(assetElement.directory) === path.basename(dirPath));
@@ -233,6 +252,7 @@ class ProjectDataService {
233
252
  image.scale = image.scale || assetItem.scale;
234
253
  image.rgba = assetItem.rgba;
235
254
  finalContent.images.push(image);
255
+ // break each
236
256
  return false;
237
257
  }
238
258
  });
@@ -335,13 +355,16 @@ class ProjectDataService {
335
355
  getRuntimePackage(projectDir, platform) {
336
356
  platform = platform.toLowerCase();
337
357
  const packageJson = this.$fs.readJson(path.join(projectDir, constants.PACKAGE_JSON_FILE_NAME));
338
- const runtimeName = platform === "android"
358
+ const runtimeName = platform === "android" /* PlatformTypes.android */
339
359
  ? constants.TNS_ANDROID_RUNTIME_NAME
340
360
  : constants.TNS_IOS_RUNTIME_NAME;
341
361
  if (packageJson &&
342
362
  packageJson.nativescript &&
343
363
  packageJson.nativescript[runtimeName] &&
344
364
  packageJson.nativescript[runtimeName].version) {
365
+ // if we have a nativescript key with a runtime version in package.json
366
+ // that means we are dealing with a legacy project, and should respect
367
+ // that information
345
368
  return {
346
369
  name: runtimeName,
347
370
  version: packageJson.nativescript[runtimeName].version,
@@ -353,19 +376,19 @@ class ProjectDataService {
353
376
  const runtimePackage = this.$pluginsService
354
377
  .getDependenciesFromPackageJson(projectDir)
355
378
  .devDependencies.find((d) => {
356
- if (platform === "ios") {
379
+ if (platform === "ios" /* constants.PlatformTypes.ios */) {
357
380
  return [
358
381
  constants.SCOPED_IOS_RUNTIME_NAME,
359
382
  constants.TNS_IOS_RUNTIME_NAME,
360
383
  ].includes(d.name);
361
384
  }
362
- else if (platform === "android") {
385
+ else if (platform === "android" /* constants.PlatformTypes.android */) {
363
386
  return [
364
387
  constants.SCOPED_ANDROID_RUNTIME_NAME,
365
388
  constants.TNS_ANDROID_RUNTIME_NAME,
366
389
  ].includes(d.name);
367
390
  }
368
- else if (platform === "visionos") {
391
+ else if (platform === "visionos" /* constants.PlatformTypes.visionos */) {
369
392
  return d.name === constants.SCOPED_VISIONOS_RUNTIME_NAME;
370
393
  }
371
394
  });
@@ -373,12 +396,14 @@ class ProjectDataService {
373
396
  const coerced = semver.coerce(runtimePackage.version);
374
397
  const isRange = !!coerced && coerced.version !== runtimePackage.version;
375
398
  const isTag = !coerced;
399
+ // in case we are using a local tgz for the runtime or a range like ~8.0.0, ^8.0.0 etc. or a tag like JSC
376
400
  if (runtimePackage.version.includes("tgz") || isRange || isTag) {
377
401
  try {
378
402
  const runtimePackageJsonPath = (0, package_path_helper_1.resolvePackageJSONPath)(runtimePackage.name, {
379
403
  paths: [projectDir],
380
404
  });
381
405
  if (!runtimePackageJsonPath) {
406
+ // caught below
382
407
  throw new Error("Runtime package.json not found.");
383
408
  }
384
409
  runtimePackage.version = this.$fs.readJson(runtimePackageJsonPath).version;
@@ -395,20 +420,21 @@ class ProjectDataService {
395
420
  }
396
421
  return runtimePackage;
397
422
  }
423
+ // default to the scoped runtimes
398
424
  this.$logger.trace("Could not find an installed runtime, falling back to default runtimes");
399
- if (platform === "ios") {
425
+ if (platform === "ios" /* constants.PlatformTypes.ios */) {
400
426
  return {
401
427
  name: constants.SCOPED_IOS_RUNTIME_NAME,
402
428
  version: null,
403
429
  };
404
430
  }
405
- else if (platform === "android") {
431
+ else if (platform === "android" /* constants.PlatformTypes.android */) {
406
432
  return {
407
433
  name: constants.SCOPED_ANDROID_RUNTIME_NAME,
408
434
  version: null,
409
435
  };
410
436
  }
411
- else if (platform === "visionos") {
437
+ else if (platform === "visionos" /* constants.PlatformTypes.visionos */) {
412
438
  return {
413
439
  name: constants.SCOPED_VISIONOS_RUNTIME_NAME,
414
440
  version: null,
@@ -443,9 +469,11 @@ __decorate([
443
469
  return projectDir + ":" + platform;
444
470
  },
445
471
  shouldCache(result) {
472
+ // don't cache coerced versions
446
473
  if (result._coerced) {
447
474
  return false;
448
475
  }
476
+ // only cache if version is defined
449
477
  return !!result.version;
450
478
  },
451
479
  })
@@ -454,3 +482,4 @@ __decorate([
454
482
  (0, decorators_1.exported)("projectDataService")
455
483
  ], ProjectDataService.prototype, "getNsConfigDefaultContent", null);
456
484
  yok_1.injector.register("projectDataService", ProjectDataService);
485
+ //# sourceMappingURL=project-data-service.js.map
@@ -50,3 +50,4 @@ class ProjectNameService {
50
50
  }
51
51
  exports.ProjectNameService = ProjectNameService;
52
52
  yok_1.injector.register("projectNameService", ProjectNameService);
53
+ //# sourceMappingURL=project-name-service.js.map
@@ -64,11 +64,15 @@ class ProjectService {
64
64
  appId: appId,
65
65
  projectName,
66
66
  });
67
+ // can pass --no-git to skip creating a git repo
68
+ // useful in monorepos where we're creating
69
+ // sub projects in an existing git repo.
67
70
  if (this.$options.git) {
68
71
  try {
69
72
  if (!this.$options.force) {
70
73
  const git = (0, simple_git_1.default)(projectDir);
71
74
  if (await git.checkIsRepo()) {
75
+ // throwing here since we're catching below.
72
76
  throw new Error("Already part of a git repository.");
73
77
  }
74
78
  }
@@ -108,6 +112,7 @@ class ProjectService {
108
112
  this.alterPackageJsonData(projectCreationSettings);
109
113
  this.$projectConfigService.writeDefaultConfig(projectDir, appId);
110
114
  await this.ensureAppResourcesExist(projectDir);
115
+ // Install devDependencies and execute all scripts:
111
116
  await this.$packageManager.install(projectDir, projectDir, {
112
117
  disableNpmInstall: false,
113
118
  frameworkPath: null,
@@ -137,6 +142,7 @@ class ProjectService {
137
142
  this.$logger.trace("Project does not have App_Resources - fetching from default template.");
138
143
  this.$fs.createDirectory(appResourcesDestinationPath);
139
144
  const tempDir = await this.$tempService.mkdirSync("ns-default-template");
145
+ // the template installed doesn't have App_Resources -> get from a default template
140
146
  await this.$pacoteService.extractPackage(constants.RESERVED_TEMPLATE_NAMES["default"], tempDir);
141
147
  const templateProjectData = this.$projectDataService.getProjectData(tempDir);
142
148
  const templateAppResourcesDir = templateProjectData.getAppResourcesDirectoryPath(tempDir);
@@ -147,12 +153,14 @@ class ProjectService {
147
153
  const { projectDir, projectName } = projectCreationSettings;
148
154
  const projectFilePath = path.join(projectDir, this.$staticConfig.PROJECT_FILE_NAME);
149
155
  let packageJsonData = this.$fs.readJson(projectFilePath);
156
+ // clean up keys from the template package.json that we don't care about.
150
157
  Object.keys(packageJsonData).forEach((key) => {
151
158
  if (key.startsWith("_") ||
152
159
  constants.TemplatesV2PackageJsonKeysToRemove.includes(key)) {
153
160
  delete packageJsonData[key];
154
161
  }
155
162
  });
163
+ // this is used to ensure the order of keys is consistent, the blanks are filled in from the template
156
164
  const packageJsonSchema = {
157
165
  name: projectName,
158
166
  main: "",
@@ -160,6 +168,7 @@ class ProjectService {
160
168
  private: true,
161
169
  dependencies: {},
162
170
  devDependencies: {},
171
+ // anythign else would go below
163
172
  };
164
173
  packageJsonData = Object.assign(packageJsonSchema, packageJsonData);
165
174
  this.$fs.writeJson(projectFilePath, packageJsonData);
@@ -183,3 +192,4 @@ __decorate([
183
192
  (0, decorators_2.performanceLog)()
184
193
  ], ProjectService.prototype, "alterPackageJsonData", null);
185
194
  yok_1.injector.register("projectService", ProjectService);
195
+ //# sourceMappingURL=project-service.js.map
@@ -40,12 +40,12 @@ class ProjectTemplatesService {
40
40
  const templateNameToBeTracked = this.getTemplateNameToBeTracked(templateValue, templatePackageJsonContent);
41
41
  if (templateNameToBeTracked) {
42
42
  await this.$analyticsService.trackEventActionInGoogleAnalytics({
43
- action: "Create project",
43
+ action: "Create project" /* constants.TrackActionNames.CreateProject */,
44
44
  isForDevice: null,
45
45
  additionalData: templateNameToBeTracked,
46
46
  });
47
47
  await this.$analyticsService.trackEventActionInGoogleAnalytics({
48
- action: "Using Template",
48
+ action: "Using Template" /* constants.TrackActionNames.UsingTemplate */,
49
49
  additionalData: templateNameToBeTracked,
50
50
  });
51
51
  }
@@ -97,3 +97,4 @@ __decorate([
97
97
  (0, decorators_1.performanceLog)()
98
98
  ], ProjectTemplatesService.prototype, "prepareTemplate", null);
99
99
  yok_1.injector.register("projectTemplatesService", ProjectTemplatesService);
100
+ //# sourceMappingURL=project-templates-service.js.map
@@ -18,3 +18,4 @@ class QrCodeTerminalService {
18
18
  }
19
19
  exports.QrCodeTerminalService = QrCodeTerminalService;
20
20
  yok_1.injector.register("qrCodeTerminalService", QrCodeTerminalService);
21
+ //# sourceMappingURL=qr-code-terminal-service.js.map
@@ -9,3 +9,4 @@ class RequireService {
9
9
  }
10
10
  exports.RequireService = RequireService;
11
11
  yok_1.injector.register("requireService", RequireService);
12
+ //# sourceMappingURL=require-service.js.map
@@ -96,3 +96,4 @@ class StartService {
96
96
  }
97
97
  exports.default = StartService;
98
98
  yok_1.injector.register("startService", StartService);
99
+ //# sourceMappingURL=start-service.js.map
@@ -21,3 +21,4 @@ class TempService {
21
21
  }
22
22
  exports.TempService = TempService;
23
23
  yok_1.injector.register("tempService", TempService);
24
+ //# sourceMappingURL=temp-service.js.map
@@ -5,6 +5,7 @@ const ora = require("ora");
5
5
  const yok_1 = require("../common/yok");
6
6
  class TerminalSpinnerService {
7
7
  createSpinner(spinnerOptions = {}) {
8
+ // @ts-expect-error - options are readonly, however we still want to override them before passing them on...
8
9
  spinnerOptions.stream = spinnerOptions.stream || process.stdout;
9
10
  return ora(spinnerOptions);
10
11
  }
@@ -25,3 +26,4 @@ class TerminalSpinnerService {
25
26
  }
26
27
  exports.TerminalSpinnerService = TerminalSpinnerService;
27
28
  yok_1.injector.register("terminalSpinnerService", TerminalSpinnerService);
29
+ //# sourceMappingURL=terminal-spinner-service.js.map
@@ -24,8 +24,10 @@ class TestExecutionService {
24
24
  platform = platform.toLowerCase();
25
25
  this.platform = platform;
26
26
  const projectData = this.$projectDataService.getProjectData(liveSyncInfo.projectDir);
27
+ // We need the dependencies installed here, so we can start the Karma server.
27
28
  await this.$pluginsService.ensureAllDependenciesAreInstalled(projectData);
28
29
  const karmaConfig = this.getKarmaConfiguration(platform, projectData);
30
+ // In case you want to debug the unit test runner, add "--inspect-brk=<port>" as a first element in the array of args.
29
31
  const karmaRunner = this.$childProcess.spawn(process.execPath, [path.join(__dirname, "karma-execution.js")], { stdio: ["inherit", "inherit", "inherit", "ipc"] });
30
32
  const launchKarmaTests = async (karmaData) => {
31
33
  this.$logger.trace("## Unit-testing: Parent process received message", karmaData);
@@ -42,6 +44,8 @@ class TestExecutionService {
42
44
  const configJs = this.generateConfig(port, configOptions);
43
45
  this.$fs.writeFile(path.join(liveSyncInfo.projectDir, TestExecutionService.CONFIG_FILE_NAME), configJs);
44
46
  }
47
+ // Prepare the project AFTER the TestExecutionService.CONFIG_FILE_NAME file is created in node_modules
48
+ // so it will be sent to device.
45
49
  await this.$runController.run({
46
50
  liveSyncInfo,
47
51
  deviceDescriptors,
@@ -54,12 +58,13 @@ class TestExecutionService {
54
58
  }
55
59
  launchKarmaTests(karmaData).catch((result) => {
56
60
  this.$logger.error(result);
57
- process.exit(130);
61
+ process.exit(130 /* ErrorCodes.KARMA_FAIL */);
58
62
  });
59
63
  });
60
64
  return new Promise((resolve, reject) => {
61
65
  karmaRunner.on("exit", (exitCode) => {
62
66
  if (exitCode !== 0) {
67
+ //End our process with a non-zero exit code
63
68
  const testError = new Error("Test run failed.");
64
69
  reject(testError);
65
70
  }
@@ -72,7 +77,7 @@ class TestExecutionService {
72
77
  }
73
78
  async canStartKarmaServer(projectData) {
74
79
  let canStartKarmaServer = true;
75
- const requiredDependencies = ["@nativescript/unit-test-runner"];
80
+ const requiredDependencies = ["@nativescript/unit-test-runner"]; // we need @nativescript/unit-test-runner at the local level because of hooks!
76
81
  _.each(requiredDependencies, (dep) => {
77
82
  if (!projectData.dependencies[dep] && !projectData.devDependencies[dep]) {
78
83
  canStartKarmaServer = false;
@@ -121,6 +126,7 @@ class TestExecutionService {
121
126
  karmaConfig.logLevel = "DEBUG";
122
127
  }
123
128
  if (!this.$options.watch) {
129
+ // Setting singleRun to true will automatically start the tests when new browser (device in our case) is registered in karma.
124
130
  karmaConfig.singleRun = true;
125
131
  }
126
132
  if (this.$options.debugBrk) {
@@ -139,3 +145,4 @@ exports.TestExecutionService = TestExecutionService;
139
145
  TestExecutionService.CONFIG_FILE_NAME = `node_modules/${constants.TEST_RUNNER_NAME}/config.js`;
140
146
  TestExecutionService.SOCKETIO_JS_FILE_NAME = `node_modules/${constants.TEST_RUNNER_NAME}/socket.io.js`;
141
147
  yok_1.injector.register("testExecutionService", TestExecutionService);
148
+ //# sourceMappingURL=test-execution-service.js.map
@@ -34,6 +34,9 @@ class TestInitializationService {
34
34
  });
35
35
  return targetFrameworkDependencies;
36
36
  }
37
+ /**
38
+ * This method is used from test-init.md file so it is not allowed to use "this" inside the method's body.
39
+ */
37
40
  getFrameworkNames() {
38
41
  const configsPath = path.join(__dirname, "..", "..", "config");
39
42
  const dependenciesPath = path.join(configsPath, "test-dependencies.json");
@@ -52,3 +55,4 @@ __decorate([
52
55
  (0, decorators_1.cache)()
53
56
  ], TestInitializationService.prototype, "getFrameworkNames", null);
54
57
  yok_1.injector.register("testInitializationService", TestInitializationService);
58
+ //# sourceMappingURL=test-initialization-service.js.map
@@ -98,3 +98,4 @@ __decorate([
98
98
  (0, decorators_1.cache)()
99
99
  ], TimelineProfilerService.prototype, "isEnabled", null);
100
100
  yok_1.injector.register("timelineProfilerService", TimelineProfilerService);
101
+ //# sourceMappingURL=timeline-profiler-service.js.map
@@ -32,3 +32,4 @@ class UserSettingsService {
32
32
  }
33
33
  exports.UserSettingsService = UserSettingsService;
34
34
  yok_1.injector.register("userSettingsService", UserSettingsService);
35
+ //# sourceMappingURL=user-settings-service.js.map
@@ -47,6 +47,7 @@ class VersionsService {
47
47
  const tnsCoreModulesPath = path.join(nodeModulesPath, constants.TNS_CORE_MODULES_NAME);
48
48
  const dependsOnNonScopedPackage = !!this.projectData.dependencies[constants.TNS_CORE_MODULES_NAME];
49
49
  const dependsOnScopedPackage = !!this.projectData.dependencies[constants.SCOPED_TNS_CORE_MODULES];
50
+ // ensure the dependencies are installed, so we can get their actual versions from node_modules
50
51
  if (!this.$fs.exists(nodeModulesPath) ||
51
52
  (dependsOnNonScopedPackage && !this.$fs.exists(tnsCoreModulesPath)) ||
52
53
  (dependsOnScopedPackage && !this.$fs.exists(scopedPackagePath))) {
@@ -73,16 +74,16 @@ class VersionsService {
73
74
  return versionInformations;
74
75
  }
75
76
  async getRuntimesVersions(platform) {
76
- const iosRuntime = this.$projectDataService.getRuntimePackage(this.projectData.projectDir, "ios");
77
- const androidRuntime = this.$projectDataService.getRuntimePackage(this.projectData.projectDir, "android");
77
+ const iosRuntime = this.$projectDataService.getRuntimePackage(this.projectData.projectDir, "ios" /* constants.PlatformTypes.ios */);
78
+ const androidRuntime = this.$projectDataService.getRuntimePackage(this.projectData.projectDir, "android" /* constants.PlatformTypes.android */);
78
79
  let runtimes = [];
79
80
  if (!platform) {
80
81
  runtimes = [iosRuntime, androidRuntime];
81
82
  }
82
- else if (platform === "ios") {
83
+ else if (platform === "ios" /* PlatformTypes.ios */) {
83
84
  runtimes.push(iosRuntime);
84
85
  }
85
- else if (platform === "android") {
86
+ else if (platform === "android" /* PlatformTypes.android */) {
86
87
  runtimes.push(androidRuntime);
87
88
  }
88
89
  const runtimesVersions = await Promise.all(runtimes.map(async (runtime) => {
@@ -175,3 +176,4 @@ VersionsService.UP_TO_DATE_MESSAGE = "up to date";
175
176
  VersionsService.UPDATE_AVAILABLE_MESSAGE = "Update available";
176
177
  VersionsService.NOT_INSTALLED_MESSAGE = "not installed";
177
178
  yok_1.injector.register("versionsService", VersionsService);
179
+ //# sourceMappingURL=versions-service.js.map
@@ -18,3 +18,4 @@ class WatchIgnoreListService {
18
18
  }
19
19
  exports.WatchIgnoreListService = WatchIgnoreListService;
20
20
  yok_1.injector.register("watchIgnoreListService", WatchIgnoreListService);
21
+ //# sourceMappingURL=watch-ignore-list-service.js.map
@@ -50,14 +50,23 @@ class WebpackCompilerService extends events_1.EventEmitter {
50
50
  });
51
51
  childProcess.on("message", (message) => {
52
52
  this.$logger.trace("Message from webpack", message);
53
+ // if we are on webpack5 - we handle HMR in a slightly different way
53
54
  if (typeof message === "object" &&
54
55
  "version" in message &&
55
56
  "type" in message) {
57
+ // first compilation can be ignored because it will be synced regardless
58
+ // handling it here would trigger 2 syncs
56
59
  if (isFirstWebpackWatchCompilation) {
57
60
  isFirstWebpackWatchCompilation = false;
58
61
  resolve(childProcess);
59
62
  return;
60
63
  }
64
+ // if ((message as IWebpackMessage).type === "hmr-status") {
65
+ // // we pass message through our event-bus to be handled wherever needed
66
+ // // in this case webpack-hmr-status-service listens for this event
67
+ // this.$sharedEventBus.emit("webpack:hmr-status", message);
68
+ // return;
69
+ // }
61
70
  return this.handleHMRMessage(message, platformData, projectData, prepareData);
62
71
  }
63
72
  if (message === "Webpack compilation complete.") {
@@ -72,6 +81,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
72
81
  prepareData.hmr ? message.hash : "";
73
82
  return;
74
83
  }
84
+ // Persist the previousHash value before calling `this.getUpdatedEmittedFiles` as it will modify the expectedHashes object with the current hash
75
85
  const previousHash = this.expectedHashes[platformData.platformNameLowerCase];
76
86
  let result;
77
87
  if (prepareData.hmr) {
@@ -96,6 +106,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
96
106
  platform: platformData.platformNameLowerCase,
97
107
  };
98
108
  this.$logger.trace("Generated data from webpack message:", data);
109
+ // the hash of the compilation is the same as the previous one and there are only hot updates produced
99
110
  if (data.hasOnlyHotUpdateFiles && previousHash === message.hash) {
100
111
  return;
101
112
  }
@@ -168,6 +179,9 @@ class WebpackCompilerService extends events_1.EventEmitter {
168
179
  }
169
180
  }
170
181
  async shouldUsePreserveSymlinksOption() {
182
+ // pnpm does not require symlink (https://github.com/nodejs/node-eps/issues/46#issuecomment-277373566)
183
+ // and it also does not work in some cases.
184
+ // Check https://github.com/NativeScript/nativescript-cli/issues/5259 for more information
171
185
  const currentPackageManager = await this.$packageManager.getPackageManagerName();
172
186
  const res = currentPackageManager !== constants_1.PackageManagers.pnpm;
173
187
  return res;
@@ -231,16 +245,28 @@ class WebpackCompilerService extends events_1.EventEmitter {
231
245
  });
232
246
  envData.verbose = envData.verbose || this.$logger.isVerbose();
233
247
  envData.production = envData.production || prepareData.release;
248
+ // add the config file name to the env data so the webpack process can read the
249
+ // correct config file when resolving the CLI lib and the config service
250
+ // we are explicitly setting it to false to force using the defaults
234
251
  envData.config =
235
252
  (_b = (_a = process.env.NATIVESCRIPT_CONFIG_NAME) !== null && _a !== void 0 ? _a : this.$options.config) !== null && _b !== void 0 ? _b : "false";
253
+ // explicitly set the env variable
236
254
  process.env.NATIVESCRIPT_CONFIG_NAME = envData.config;
255
+ // The snapshot generation is wrongly located in the Webpack plugin.
256
+ // It should be moved in the Native Prepare of the CLI or a Gradle task in the Runtime.
257
+ // As a workaround, we skip the mksnapshot, xxd and android-ndk calls based on skipNativePrepare.
258
+ // In this way the plugin will prepare only the snapshot JS entry without any native prepare and
259
+ // we will able to execute cloud builds with snapshot without having any local snapshot or Docker setup.
260
+ // TODO: Remove this flag when we remove the native part from the plugin.
237
261
  envData.skipSnapshotTools =
238
262
  prepareData.nativePrepare && prepareData.nativePrepare.skipNativePrepare;
263
+ // only set sourceMap if not explicitly set through a flag
239
264
  if (typeof ((_c = prepareData === null || prepareData === void 0 ? void 0 : prepareData.env) === null || _c === void 0 ? void 0 : _c.sourceMap) === "undefined") {
240
265
  if (!prepareData.release) {
241
266
  envData.sourceMap = true;
242
267
  }
243
268
  }
269
+ // convert string to boolean
244
270
  if (envData.sourceMap === "true" || envData.sourceMap === "false") {
245
271
  envData.sourceMap = envData.sourceMap === "true";
246
272
  }
@@ -292,6 +318,15 @@ class WebpackCompilerService extends events_1.EventEmitter {
292
318
  }
293
319
  getUpdatedEmittedFiles(allEmittedFiles, chunkFiles, nextHash, platform) {
294
320
  const currentHash = this.getCurrentHotUpdateHash(allEmittedFiles);
321
+ // This logic is needed as there are already cases when webpack doesn't emit any files physically.
322
+ // We've set noEmitOnErrors in webpack.config.js based on noEmitOnError from tsconfig.json,
323
+ // so webpack doesn't emit any files when noEmitOnErrors: true is set in webpack.config.js and
324
+ // there is a compilation error in the source code. On the other side, hmr generates new hot-update files
325
+ // on every change and the hash of the next hmr update is written inside hot-update.json file.
326
+ // Although webpack doesn't emit any files, hmr hash is still generated. The hash is generated per compilation no matter
327
+ // if files will be emitted or not. This way, the first successful compilation after fixing the compilation error generates
328
+ // a hash that is not the same as the one expected in the latest emitted hot-update.json file.
329
+ // As a result, the hmr chain is broken and the changes are not applied.
295
330
  const isHashValid = nextHash
296
331
  ? this.expectedHashes[platform] === currentHash
297
332
  : true;
@@ -310,6 +345,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
310
345
  let hotHash;
311
346
  const hotUpdateScripts = emittedFiles.filter((x) => x.endsWith(".hot-update.js"));
312
347
  if (hotUpdateScripts && hotUpdateScripts.length) {
348
+ // the hash is the same for each hot update in the current compilation
313
349
  const hotUpdateName = hotUpdateScripts[0];
314
350
  const matcher = /^(.+)\.(.+)\.hot-update/gm;
315
351
  const matches = matcher.exec(hotUpdateName);
@@ -327,6 +363,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
327
363
  }
328
364
  }
329
365
  handleHMRMessage(message, platformData, projectData, prepareData) {
366
+ // handle new webpack hmr packets
330
367
  this.$logger.trace("Received message from webpack process:", message);
331
368
  if (message.type !== "compilation") {
332
369
  return;
@@ -334,6 +371,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
334
371
  this.$logger.trace("Webpack build done!");
335
372
  const files = message.data.emittedAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, asset));
336
373
  const staleFiles = message.data.staleAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, asset));
374
+ // extract last hash from emitted filenames
337
375
  const lastHash = (() => {
338
376
  const absoluteFileNameWithLastHash = files.find((fileName) => fileName.endsWith("hot-update.js"));
339
377
  if (!absoluteFileNameWithLastHash) {
@@ -346,6 +384,7 @@ class WebpackCompilerService extends events_1.EventEmitter {
346
384
  }
347
385
  })();
348
386
  if (!files.length) {
387
+ // ignore compilations if no new files are emitted
349
388
  return;
350
389
  }
351
390
  this.emit(constants_1.WEBPACK_COMPILATION_COMPLETE, {
@@ -395,3 +434,4 @@ __decorate([
395
434
  (0, decorators_1.performanceLog)()
396
435
  ], WebpackCompilerService.prototype, "startWebpackProcess", null);
397
436
  yok_1.injector.register("webpackCompilerService", WebpackCompilerService);
437
+ //# sourceMappingURL=webpack-compiler-service.js.map
@@ -55,6 +55,7 @@ class XcconfigService {
55
55
  }
56
56
  });
57
57
  if (isPropertyParsed) {
58
+ // property can be an empty string, so we don't check for that.
58
59
  return property;
59
60
  }
60
61
  }
@@ -63,3 +64,4 @@ class XcconfigService {
63
64
  }
64
65
  exports.XcconfigService = XcconfigService;
65
66
  yok_1.injector.register("xcconfigService", XcconfigService);
67
+ //# sourceMappingURL=xcconfig-service.js.map
@@ -21,3 +21,4 @@ class XcprojService {
21
21
  }
22
22
  }
23
23
  yok_1.injector.register("xcprojService", XcprojService);
24
+ //# sourceMappingURL=xcproj-service.js.map
@@ -2,6 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const events_1 = require("events");
4
4
  const yok_1 = require("./common/yok");
5
+ /**
6
+ * Event Bus used by different services to emit state changes and
7
+ * allow listening for these state changes without needing a reference
8
+ * to the emitting service.
9
+ */
5
10
  class SharedEventBus extends events_1.EventEmitter {
6
11
  }
7
12
  yok_1.injector.register("sharedEventBus", SharedEventBus);
13
+ //# sourceMappingURL=shared-event-bus.js.map
package/lib/sys-info.js CHANGED
@@ -79,7 +79,7 @@ class SysInfo {
79
79
  if (macOSVersion && macOSVersion < constants_1.MacOSVersions.HighSierra) {
80
80
  return {
81
81
  message: (0, util_1.format)(constants_1.MacOSDeprecationStringFormat, macOSVersion),
82
- severity: "high",
82
+ severity: "high" /* SystemWarningsSeverity.high */,
83
83
  };
84
84
  }
85
85
  return null;
@@ -101,3 +101,4 @@ __decorate([
101
101
  (0, decorators_1.exported)("sysInfo")
102
102
  ], SysInfo.prototype, "getSupportedNodeVersionRange", null);
103
103
  yok_1.injector.register("sysInfo", SysInfo);
104
+ //# sourceMappingURL=sys-info.js.map