nativescript 9.1.0-alpha.0 → 9.1.0-alpha.10

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 (267) hide show
  1. package/README.md +49 -0
  2. package/config/test-deps-versions-generated.json +3 -3
  3. package/lib/.d.ts +1 -0
  4. package/lib/bootstrap.js +0 -2
  5. package/lib/commands/build.js +1 -30
  6. package/lib/commands/prepare.js +5 -0
  7. package/lib/commands/run.js +1 -39
  8. package/lib/commands/widget.js +1 -2
  9. package/lib/common/definitions/mobile.d.ts +15 -13
  10. package/lib/common/file-system.js +11 -15
  11. package/lib/common/mobile/android/android-emulator-services.js +11 -3
  12. package/lib/common/mobile/device-platforms-constants.js +0 -4
  13. package/lib/common/mobile/emulator-helper.js +1 -0
  14. package/lib/common/mobile/ios/device/ios-device-file-system.js +29 -1
  15. package/lib/common/mobile/mobile-helper.js +1 -12
  16. package/lib/constants.js +7 -2
  17. package/lib/controllers/prepare-controller.js +53 -39
  18. package/lib/controllers/run-controller.js +200 -13
  19. package/lib/data/prepare-data.js +4 -0
  20. package/lib/declarations.d.ts +38 -42
  21. package/lib/definitions/nativescript-dev-xcode.d.ts +25 -1
  22. package/lib/definitions/project.d.ts +51 -6
  23. package/lib/key-commands/bootstrap.js +0 -1
  24. package/lib/key-commands/index.js +1 -53
  25. package/lib/options.js +1 -0
  26. package/lib/project-data.js +0 -6
  27. package/lib/services/android-plugin-build-service.js +20 -12
  28. package/lib/services/bundler/bundler-compiler-service.js +182 -13
  29. package/lib/services/debug-service-base.js +1 -1
  30. package/lib/services/ios/ios-signing-service.js +10 -3
  31. package/lib/services/ios/spm-service.js +1 -8
  32. package/lib/services/ios/xcodebuild-args-service.js +36 -29
  33. package/lib/services/ios-entitlements-service.js +3 -1
  34. package/lib/services/ios-project-service.js +55 -78
  35. package/lib/services/ios-watch-app-service.js +663 -16
  36. package/lib/services/livesync/ios-livesync-service.js +113 -2
  37. package/lib/services/platforms-data-service.js +0 -1
  38. package/lib/services/plugins-service.js +16 -28
  39. package/lib/services/project-changes-service.js +4 -15
  40. package/lib/services/project-data-service.js +16 -31
  41. package/lib/services/versions-service.js +0 -4
  42. package/lib/tools/config-manipulation/config-transformer.js +55 -3
  43. package/node_modules/debug/LICENSE +20 -0
  44. package/node_modules/debug/README.md +481 -0
  45. package/node_modules/debug/package.json +64 -0
  46. package/node_modules/debug/src/browser.js +272 -0
  47. package/node_modules/debug/src/common.js +292 -0
  48. package/node_modules/debug/src/index.js +10 -0
  49. package/node_modules/debug/src/node.js +263 -0
  50. package/node_modules/ms/index.js +162 -0
  51. package/node_modules/ms/license.md +21 -0
  52. package/node_modules/ms/package.json +38 -0
  53. package/node_modules/ms/readme.md +59 -0
  54. package/node_modules/universal-analytics/.travis.yml +11 -0
  55. package/node_modules/universal-analytics/AcceptableParams.md +757 -0
  56. package/node_modules/universal-analytics/HISTORY.md +170 -0
  57. package/node_modules/universal-analytics/Makefile +5 -0
  58. package/node_modules/universal-analytics/README.md +651 -0
  59. package/node_modules/universal-analytics/index.js +2 -0
  60. package/node_modules/universal-analytics/lib/config.js +171 -0
  61. package/node_modules/universal-analytics/lib/index.js +563 -0
  62. package/node_modules/universal-analytics/lib/request.js +73 -0
  63. package/node_modules/universal-analytics/lib/utils.js +29 -0
  64. package/node_modules/universal-analytics/package.json +33 -0
  65. package/node_modules/universal-analytics/test/_enqueue.js +144 -0
  66. package/node_modules/universal-analytics/test/event.js +346 -0
  67. package/node_modules/universal-analytics/test/exception.js +233 -0
  68. package/node_modules/universal-analytics/test/index.js +141 -0
  69. package/node_modules/universal-analytics/test/item.js +550 -0
  70. package/node_modules/universal-analytics/test/middleware.js +119 -0
  71. package/node_modules/universal-analytics/test/mocha.opts +3 -0
  72. package/node_modules/universal-analytics/test/pageview.js +286 -0
  73. package/node_modules/universal-analytics/test/send.js +232 -0
  74. package/node_modules/universal-analytics/test/set.js +68 -0
  75. package/node_modules/universal-analytics/test/timing.js +363 -0
  76. package/node_modules/universal-analytics/test/transaction.js +371 -0
  77. package/node_modules/uuid/LICENSE.md +9 -0
  78. package/node_modules/uuid/README.md +510 -0
  79. package/node_modules/uuid/dist/cjs/index.d.ts +15 -0
  80. package/node_modules/uuid/dist/cjs/index.js +31 -0
  81. package/node_modules/uuid/dist/cjs/max.d.ts +2 -0
  82. package/node_modules/uuid/dist/cjs/max.js +3 -0
  83. package/node_modules/uuid/dist/cjs/md5.d.ts +4 -0
  84. package/node_modules/uuid/dist/cjs/md5.js +13 -0
  85. package/node_modules/uuid/dist/cjs/native.d.ts +6 -0
  86. package/node_modules/uuid/dist/cjs/native.js +4 -0
  87. package/node_modules/uuid/dist/cjs/nil.d.ts +2 -0
  88. package/node_modules/uuid/dist/cjs/nil.js +3 -0
  89. package/node_modules/uuid/dist/cjs/package.json +1 -0
  90. package/node_modules/uuid/dist/cjs/parse.d.ts +2 -0
  91. package/node_modules/uuid/dist/cjs/parse.js +11 -0
  92. package/node_modules/uuid/dist/cjs/regex.d.ts +2 -0
  93. package/node_modules/uuid/dist/cjs/regex.js +3 -0
  94. package/node_modules/uuid/dist/cjs/rng.d.ts +1 -0
  95. package/node_modules/uuid/dist/cjs/rng.js +13 -0
  96. package/node_modules/uuid/dist/cjs/sha1.d.ts +4 -0
  97. package/node_modules/uuid/dist/cjs/sha1.js +13 -0
  98. package/node_modules/uuid/dist/cjs/stringify.d.ts +3 -0
  99. package/node_modules/uuid/dist/cjs/stringify.js +39 -0
  100. package/node_modules/uuid/dist/cjs/types.d.ts +21 -0
  101. package/node_modules/uuid/dist/cjs/types.js +2 -0
  102. package/node_modules/uuid/dist/cjs/uuid-bin.d.ts +1 -0
  103. package/node_modules/uuid/dist/cjs/uuid-bin.js +72 -0
  104. package/node_modules/uuid/dist/cjs/v1.d.ts +11 -0
  105. package/node_modules/uuid/dist/cjs/v1.js +87 -0
  106. package/node_modules/uuid/dist/cjs/v1ToV6.d.ts +2 -0
  107. package/node_modules/uuid/dist/cjs/v1ToV6.js +13 -0
  108. package/node_modules/uuid/dist/cjs/v3.d.ts +9 -0
  109. package/node_modules/uuid/dist/cjs/v3.js +14 -0
  110. package/node_modules/uuid/dist/cjs/v35.d.ts +7 -0
  111. package/node_modules/uuid/dist/cjs/v35.js +41 -0
  112. package/node_modules/uuid/dist/cjs/v4.d.ts +4 -0
  113. package/node_modules/uuid/dist/cjs/v4.js +29 -0
  114. package/node_modules/uuid/dist/cjs/v5.d.ts +9 -0
  115. package/node_modules/uuid/dist/cjs/v5.js +14 -0
  116. package/node_modules/uuid/dist/cjs/v6.d.ts +4 -0
  117. package/node_modules/uuid/dist/cjs/v6.js +19 -0
  118. package/node_modules/uuid/dist/cjs/v6ToV1.d.ts +2 -0
  119. package/node_modules/uuid/dist/cjs/v6ToV1.js +13 -0
  120. package/node_modules/uuid/dist/cjs/v7.d.ts +9 -0
  121. package/node_modules/uuid/dist/cjs/v7.js +69 -0
  122. package/node_modules/uuid/dist/cjs/validate.d.ts +2 -0
  123. package/node_modules/uuid/dist/cjs/validate.js +7 -0
  124. package/node_modules/uuid/dist/cjs/version.d.ts +2 -0
  125. package/node_modules/uuid/dist/cjs/version.js +10 -0
  126. package/node_modules/uuid/dist/cjs-browser/index.d.ts +15 -0
  127. package/node_modules/uuid/dist/cjs-browser/index.js +31 -0
  128. package/node_modules/uuid/dist/cjs-browser/max.d.ts +2 -0
  129. package/node_modules/uuid/dist/cjs-browser/max.js +3 -0
  130. package/node_modules/uuid/dist/cjs-browser/md5.d.ts +2 -0
  131. package/node_modules/uuid/dist/cjs-browser/md5.js +137 -0
  132. package/node_modules/uuid/dist/cjs-browser/native.d.ts +4 -0
  133. package/node_modules/uuid/dist/cjs-browser/native.js +4 -0
  134. package/node_modules/uuid/dist/cjs-browser/nil.d.ts +2 -0
  135. package/node_modules/uuid/dist/cjs-browser/nil.js +3 -0
  136. package/node_modules/uuid/dist/cjs-browser/package.json +1 -0
  137. package/node_modules/uuid/dist/cjs-browser/parse.d.ts +2 -0
  138. package/node_modules/uuid/dist/cjs-browser/parse.js +11 -0
  139. package/node_modules/uuid/dist/cjs-browser/regex.d.ts +2 -0
  140. package/node_modules/uuid/dist/cjs-browser/regex.js +3 -0
  141. package/node_modules/uuid/dist/cjs-browser/rng.d.ts +1 -0
  142. package/node_modules/uuid/dist/cjs-browser/rng.js +14 -0
  143. package/node_modules/uuid/dist/cjs-browser/sha1.d.ts +2 -0
  144. package/node_modules/uuid/dist/cjs-browser/sha1.js +72 -0
  145. package/node_modules/uuid/dist/cjs-browser/stringify.d.ts +3 -0
  146. package/node_modules/uuid/dist/cjs-browser/stringify.js +39 -0
  147. package/node_modules/uuid/dist/cjs-browser/types.d.ts +21 -0
  148. package/node_modules/uuid/dist/cjs-browser/types.js +2 -0
  149. package/node_modules/uuid/dist/cjs-browser/uuid-bin.d.ts +1 -0
  150. package/node_modules/uuid/dist/cjs-browser/uuid-bin.js +72 -0
  151. package/node_modules/uuid/dist/cjs-browser/v1.d.ts +11 -0
  152. package/node_modules/uuid/dist/cjs-browser/v1.js +87 -0
  153. package/node_modules/uuid/dist/cjs-browser/v1ToV6.d.ts +2 -0
  154. package/node_modules/uuid/dist/cjs-browser/v1ToV6.js +13 -0
  155. package/node_modules/uuid/dist/cjs-browser/v3.d.ts +9 -0
  156. package/node_modules/uuid/dist/cjs-browser/v3.js +14 -0
  157. package/node_modules/uuid/dist/cjs-browser/v35.d.ts +7 -0
  158. package/node_modules/uuid/dist/cjs-browser/v35.js +41 -0
  159. package/node_modules/uuid/dist/cjs-browser/v4.d.ts +4 -0
  160. package/node_modules/uuid/dist/cjs-browser/v4.js +29 -0
  161. package/node_modules/uuid/dist/cjs-browser/v5.d.ts +9 -0
  162. package/node_modules/uuid/dist/cjs-browser/v5.js +14 -0
  163. package/node_modules/uuid/dist/cjs-browser/v6.d.ts +4 -0
  164. package/node_modules/uuid/dist/cjs-browser/v6.js +19 -0
  165. package/node_modules/uuid/dist/cjs-browser/v6ToV1.d.ts +2 -0
  166. package/node_modules/uuid/dist/cjs-browser/v6ToV1.js +13 -0
  167. package/node_modules/uuid/dist/cjs-browser/v7.d.ts +9 -0
  168. package/node_modules/uuid/dist/cjs-browser/v7.js +69 -0
  169. package/node_modules/uuid/dist/cjs-browser/validate.d.ts +2 -0
  170. package/node_modules/uuid/dist/cjs-browser/validate.js +7 -0
  171. package/node_modules/uuid/dist/cjs-browser/version.d.ts +2 -0
  172. package/node_modules/uuid/dist/cjs-browser/version.js +10 -0
  173. package/node_modules/uuid/dist/esm/bin/uuid +2 -0
  174. package/node_modules/uuid/dist/esm/index.d.ts +15 -0
  175. package/node_modules/uuid/dist/esm/index.js +14 -0
  176. package/node_modules/uuid/dist/esm/max.d.ts +2 -0
  177. package/node_modules/uuid/dist/esm/max.js +1 -0
  178. package/node_modules/uuid/dist/esm/md5.d.ts +4 -0
  179. package/node_modules/uuid/dist/esm/md5.js +11 -0
  180. package/node_modules/uuid/dist/esm/native.d.ts +6 -0
  181. package/node_modules/uuid/dist/esm/native.js +2 -0
  182. package/node_modules/uuid/dist/esm/nil.d.ts +2 -0
  183. package/node_modules/uuid/dist/esm/nil.js +1 -0
  184. package/node_modules/uuid/dist/esm/parse.d.ts +2 -0
  185. package/node_modules/uuid/dist/esm/parse.js +9 -0
  186. package/node_modules/uuid/dist/esm/regex.d.ts +2 -0
  187. package/node_modules/uuid/dist/esm/regex.js +1 -0
  188. package/node_modules/uuid/dist/esm/rng.d.ts +1 -0
  189. package/node_modules/uuid/dist/esm/rng.js +10 -0
  190. package/node_modules/uuid/dist/esm/sha1.d.ts +4 -0
  191. package/node_modules/uuid/dist/esm/sha1.js +11 -0
  192. package/node_modules/uuid/dist/esm/stringify.d.ts +3 -0
  193. package/node_modules/uuid/dist/esm/stringify.js +35 -0
  194. package/node_modules/uuid/dist/esm/types.d.ts +21 -0
  195. package/node_modules/uuid/dist/esm/types.js +1 -0
  196. package/node_modules/uuid/dist/esm/uuid-bin.d.ts +1 -0
  197. package/node_modules/uuid/dist/esm/uuid-bin.js +70 -0
  198. package/node_modules/uuid/dist/esm/v1.d.ts +11 -0
  199. package/node_modules/uuid/dist/esm/v1.js +83 -0
  200. package/node_modules/uuid/dist/esm/v1ToV6.d.ts +2 -0
  201. package/node_modules/uuid/dist/esm/v1ToV6.js +10 -0
  202. package/node_modules/uuid/dist/esm/v3.d.ts +9 -0
  203. package/node_modules/uuid/dist/esm/v3.js +9 -0
  204. package/node_modules/uuid/dist/esm/v35.d.ts +7 -0
  205. package/node_modules/uuid/dist/esm/v35.js +36 -0
  206. package/node_modules/uuid/dist/esm/v4.d.ts +4 -0
  207. package/node_modules/uuid/dist/esm/v4.js +27 -0
  208. package/node_modules/uuid/dist/esm/v5.d.ts +9 -0
  209. package/node_modules/uuid/dist/esm/v5.js +9 -0
  210. package/node_modules/uuid/dist/esm/v6.d.ts +4 -0
  211. package/node_modules/uuid/dist/esm/v6.js +17 -0
  212. package/node_modules/uuid/dist/esm/v6ToV1.d.ts +2 -0
  213. package/node_modules/uuid/dist/esm/v6ToV1.js +10 -0
  214. package/node_modules/uuid/dist/esm/v7.d.ts +9 -0
  215. package/node_modules/uuid/dist/esm/v7.js +65 -0
  216. package/node_modules/uuid/dist/esm/validate.d.ts +2 -0
  217. package/node_modules/uuid/dist/esm/validate.js +5 -0
  218. package/node_modules/uuid/dist/esm/version.d.ts +2 -0
  219. package/node_modules/uuid/dist/esm/version.js +8 -0
  220. package/node_modules/uuid/dist/esm-browser/index.d.ts +15 -0
  221. package/node_modules/uuid/dist/esm-browser/index.js +14 -0
  222. package/node_modules/uuid/dist/esm-browser/max.d.ts +2 -0
  223. package/node_modules/uuid/dist/esm-browser/max.js +1 -0
  224. package/node_modules/uuid/dist/esm-browser/md5.d.ts +2 -0
  225. package/node_modules/uuid/dist/esm-browser/md5.js +135 -0
  226. package/node_modules/uuid/dist/esm-browser/native.d.ts +4 -0
  227. package/node_modules/uuid/dist/esm-browser/native.js +2 -0
  228. package/node_modules/uuid/dist/esm-browser/nil.d.ts +2 -0
  229. package/node_modules/uuid/dist/esm-browser/nil.js +1 -0
  230. package/node_modules/uuid/dist/esm-browser/parse.d.ts +2 -0
  231. package/node_modules/uuid/dist/esm-browser/parse.js +9 -0
  232. package/node_modules/uuid/dist/esm-browser/regex.d.ts +2 -0
  233. package/node_modules/uuid/dist/esm-browser/regex.js +1 -0
  234. package/node_modules/uuid/dist/esm-browser/rng.d.ts +1 -0
  235. package/node_modules/uuid/dist/esm-browser/rng.js +11 -0
  236. package/node_modules/uuid/dist/esm-browser/sha1.d.ts +2 -0
  237. package/node_modules/uuid/dist/esm-browser/sha1.js +70 -0
  238. package/node_modules/uuid/dist/esm-browser/stringify.d.ts +3 -0
  239. package/node_modules/uuid/dist/esm-browser/stringify.js +35 -0
  240. package/node_modules/uuid/dist/esm-browser/types.d.ts +21 -0
  241. package/node_modules/uuid/dist/esm-browser/types.js +1 -0
  242. package/node_modules/uuid/dist/esm-browser/uuid-bin.d.ts +1 -0
  243. package/node_modules/uuid/dist/esm-browser/uuid-bin.js +70 -0
  244. package/node_modules/uuid/dist/esm-browser/v1.d.ts +11 -0
  245. package/node_modules/uuid/dist/esm-browser/v1.js +83 -0
  246. package/node_modules/uuid/dist/esm-browser/v1ToV6.d.ts +2 -0
  247. package/node_modules/uuid/dist/esm-browser/v1ToV6.js +10 -0
  248. package/node_modules/uuid/dist/esm-browser/v3.d.ts +9 -0
  249. package/node_modules/uuid/dist/esm-browser/v3.js +9 -0
  250. package/node_modules/uuid/dist/esm-browser/v35.d.ts +7 -0
  251. package/node_modules/uuid/dist/esm-browser/v35.js +36 -0
  252. package/node_modules/uuid/dist/esm-browser/v4.d.ts +4 -0
  253. package/node_modules/uuid/dist/esm-browser/v4.js +27 -0
  254. package/node_modules/uuid/dist/esm-browser/v5.d.ts +9 -0
  255. package/node_modules/uuid/dist/esm-browser/v5.js +9 -0
  256. package/node_modules/uuid/dist/esm-browser/v6.d.ts +4 -0
  257. package/node_modules/uuid/dist/esm-browser/v6.js +17 -0
  258. package/node_modules/uuid/dist/esm-browser/v6ToV1.d.ts +2 -0
  259. package/node_modules/uuid/dist/esm-browser/v6ToV1.js +10 -0
  260. package/node_modules/uuid/dist/esm-browser/v7.d.ts +9 -0
  261. package/node_modules/uuid/dist/esm-browser/v7.js +65 -0
  262. package/node_modules/uuid/dist/esm-browser/validate.d.ts +2 -0
  263. package/node_modules/uuid/dist/esm-browser/validate.js +5 -0
  264. package/node_modules/uuid/dist/esm-browser/version.d.ts +2 -0
  265. package/node_modules/uuid/dist/esm-browser/version.js +8 -0
  266. package/node_modules/uuid/package.json +132 -0
  267. package/package.json +29 -14
@@ -15,6 +15,7 @@ const decorators_1 = require("../common/decorators");
15
15
  const helpers_1 = require("../common/helpers");
16
16
  const yok_1 = require("../common/yok");
17
17
  const constants_1 = require("../constants");
18
+ const resolve_package_path_1 = require("@rigor789/resolve-package-path");
18
19
  class PrepareController extends events_1.EventEmitter {
19
20
  constructor($platformController, $hooksService, $fs, $logger, $options, $mobileHelper, $nodeModulesDependenciesBuilder, $platformsDataService, $pluginsService, $prepareNativePlatformService, $projectChangesService, $projectDataService, $bundlerCompilerService, $watchIgnoreListService, $analyticsService, $markingModeService, $projectConfigService, $projectService) {
20
21
  super();
@@ -100,7 +101,6 @@ class PrepareController extends events_1.EventEmitter {
100
101
  platform: prepareData.platform.toLowerCase(),
101
102
  };
102
103
  }
103
- this.syncMacOSBundleArtifacts(projectData, platformData);
104
104
  await this.writeRuntimePackageJson(projectData, platformData, prepareData);
105
105
  await this.$projectChangesService.savePrepareInfo(platformData, projectData, prepareData);
106
106
  this.$logger.info(`Project successfully prepared (${prepareData.platform.toLowerCase()})`);
@@ -230,28 +230,69 @@ class PrepareController extends events_1.EventEmitter {
230
230
  * TODO: move this logic to the webpack side of things - WIP and deprecate here with a webpack version check...
231
231
  */
232
232
  async writeRuntimePackageJson(projectData, platformData, prepareData = null) {
233
+ var _a, _b, _c, _d, _e;
233
234
  const configInfo = this.$projectConfigService.detectProjectConfigs(projectData.projectDir);
234
235
  if (configInfo.usingNSConfig) {
235
236
  return;
236
237
  }
237
238
  this.$logger.info("Updating runtime package.json with configuration values...");
238
- const nsConfig = this.$projectConfigService.readConfig(projectData.projectDir);
239
+ // Tolerate a missing/unreadable config — prior to the destructure this
240
+ // was a plain object spread, where `undefined` is a legal no-op.
241
+ const { hooks, ignoredNativeDependencies, webpackPackageName, webpackConfigPath, appResourcesPath, buildPath, appPath, ...nsConfig } = (_a = this.$projectConfigService.readConfig(projectData.projectDir)) !== null && _a !== void 0 ? _a : {};
242
+ const platform = platformData.platformNameLowerCase;
243
+ let installedRuntimePackageJSON;
244
+ let runtimePackageName;
245
+ if (platform === "ios" /* PlatformTypes.ios */) {
246
+ runtimePackageName =
247
+ ((_c = (_b = projectData.nsConfig) === null || _b === void 0 ? void 0 : _b.ios) === null || _c === void 0 ? void 0 : _c.runtimePackageName) ||
248
+ constants_1.SCOPED_IOS_RUNTIME_NAME;
249
+ }
250
+ else if (platform === "android" /* PlatformTypes.android */) {
251
+ runtimePackageName =
252
+ ((_e = (_d = projectData.nsConfig) === null || _d === void 0 ? void 0 : _d.android) === null || _e === void 0 ? void 0 : _e.runtimePackageName) ||
253
+ constants_1.SCOPED_ANDROID_RUNTIME_NAME;
254
+ }
255
+ // try reading from installed runtime first before reading from the npm registry...
256
+ const installedRuntimePackageJSONPath = (0, resolve_package_path_1.resolvePackageJSONPath)(runtimePackageName, {
257
+ paths: [projectData.projectDir],
258
+ });
259
+ if (installedRuntimePackageJSONPath) {
260
+ installedRuntimePackageJSON = this.$fs.readJson(installedRuntimePackageJSONPath);
261
+ }
239
262
  const packageData = {
240
263
  ..._.pick(projectData.packageJsonData, ["name"]),
241
264
  ...nsConfig,
242
265
  main: "bundle",
266
+ ...(installedRuntimePackageJSON ? {} : {}),
243
267
  };
244
- if (platformData.platformNameLowerCase === "ios" &&
245
- packageData.ios &&
246
- packageData.ios.discardUncaughtJsExceptions) {
247
- packageData.discardUncaughtJsExceptions =
248
- packageData.ios.discardUncaughtJsExceptions;
268
+ if (platform === "ios" /* PlatformTypes.ios */) {
269
+ if (installedRuntimePackageJSON) {
270
+ packageData.ios = packageData.ios || {};
271
+ packageData.ios.runtime = {
272
+ version: installedRuntimePackageJSON.version,
273
+ };
274
+ }
275
+ if (packageData.ios && packageData.ios.discardUncaughtJsExceptions) {
276
+ packageData.discardUncaughtJsExceptions =
277
+ packageData.ios.discardUncaughtJsExceptions;
278
+ }
279
+ delete packageData.android;
249
280
  }
250
- if (platformData.platformNameLowerCase === "android" &&
251
- packageData.android &&
252
- packageData.android.discardUncaughtJsExceptions) {
253
- packageData.discardUncaughtJsExceptions =
254
- packageData.android.discardUncaughtJsExceptions;
281
+ if (platform === "android" /* PlatformTypes.android */) {
282
+ if (installedRuntimePackageJSON) {
283
+ packageData.android = packageData.android || {};
284
+ packageData.android.runtime = {
285
+ version: installedRuntimePackageJSON.version,
286
+ version_info: installedRuntimePackageJSON.version_info,
287
+ gradle: installedRuntimePackageJSON.gradle,
288
+ };
289
+ }
290
+ if (packageData.android &&
291
+ packageData.android.discardUncaughtJsExceptions) {
292
+ packageData.discardUncaughtJsExceptions =
293
+ packageData.android.discardUncaughtJsExceptions;
294
+ }
295
+ delete packageData.ios;
255
296
  }
256
297
  let packagePath;
257
298
  if (this.$mobileHelper.isApplePlatform(platformData.platformNameLowerCase)) {
@@ -278,33 +319,6 @@ class PrepareController extends events_1.EventEmitter {
278
319
  }
279
320
  this.$fs.writeJson(packagePath, packageData);
280
321
  }
281
- syncMacOSBundleArtifacts(projectData, platformData) {
282
- if (platformData.platformNameLowerCase !== "macos") {
283
- return;
284
- }
285
- if (process.env.NS_MACOS_IOS_BUNDLE_FALLBACK !== "1") {
286
- return;
287
- }
288
- const macosAppPath = path.join(platformData.projectRoot, projectData.projectName, "app");
289
- const hasMacBundle = this.$fs.exists(path.join(macosAppPath, "bundle.js")) ||
290
- this.$fs.exists(path.join(macosAppPath, "bundle.mjs"));
291
- if (hasMacBundle) {
292
- return;
293
- }
294
- const iosAppPath = path.join(projectData.platformsDir, "ios", projectData.projectName, "app");
295
- if (!this.$fs.exists(iosAppPath)) {
296
- return;
297
- }
298
- this.$logger.trace(`Copying bundle artifacts from ${iosAppPath} to ${macosAppPath} for macOS prepare.`);
299
- this.$fs.ensureDirectoryExists(macosAppPath);
300
- const emittedFiles = this.$fs.enumerateFilesInDirectorySync(iosAppPath);
301
- emittedFiles.forEach((sourcePath) => {
302
- const relativePath = path.relative(iosAppPath, sourcePath);
303
- const destinationPath = path.join(macosAppPath, relativePath);
304
- this.$fs.ensureDirectoryExists(path.dirname(destinationPath));
305
- this.$fs.copyFile(sourcePath, destinationPath);
306
- });
307
- }
308
322
  emitPrepareEvent(filesChangeEventData) {
309
323
  if (this.isInitialPrepareReady) {
310
324
  this.emit(constants_1.PREPARE_READY_EVENT_NAME, filesChangeEventData);
@@ -15,7 +15,7 @@ const util = require("util");
15
15
  const _ = require("lodash");
16
16
  const yok_1 = require("../common/yok");
17
17
  class RunController extends events_1.EventEmitter {
18
- constructor($analyticsService, $buildController, $debugController, $deviceInstallAppService, $devicesService, $errors, $injector, $hmrStatusService, $hooksService, $liveSyncServiceResolver, $liveSyncProcessDataService, $logger, $mobileHelper, $platformsDataService, $pluginsService, $prepareController, $prepareDataService, $prepareNativePlatformService, $projectChangesService, $projectDataService) {
18
+ constructor($analyticsService, $buildController, $debugController, $deviceInstallAppService, $devicesService, $errors, $injector, $hmrStatusService, $hooksService, $liveSyncServiceResolver, $liveSyncProcessDataService, $logger, $mobileHelper, $platformsDataService, $pluginsService, $prepareController, $prepareDataService, $prepareNativePlatformService, $projectChangesService, $projectDataService, $staticConfig) {
19
19
  super();
20
20
  this.$analyticsService = $analyticsService;
21
21
  this.$buildController = $buildController;
@@ -37,7 +37,10 @@ class RunController extends events_1.EventEmitter {
37
37
  this.$prepareNativePlatformService = $prepareNativePlatformService;
38
38
  this.$projectChangesService = $projectChangesService;
39
39
  this.$projectDataService = $projectDataService;
40
+ this.$staticConfig = $staticConfig;
40
41
  this.prepareReadyEventHandler = null;
42
+ this._syncInProgress = false;
43
+ this._pendingSyncs = new Map();
41
44
  }
42
45
  async run(runData) {
43
46
  const { liveSyncInfo, deviceDescriptors } = runData;
@@ -60,13 +63,11 @@ class RunController extends events_1.EventEmitter {
60
63
  const platformData = this.$platformsDataService.getPlatformData(data.platform, projectData);
61
64
  const prepareData = this.$prepareDataService.getPrepareData(liveSyncInfo.projectDir, data.platform, { ...liveSyncInfo, watch: !liveSyncInfo.skipWatcher });
62
65
  const changesInfo = await this.$projectChangesService.checkForChanges(platformData, projectData, prepareData);
63
- if (changesInfo.hasChanges) {
64
- await this.syncChangedDataOnDevices(data, projectData, liveSyncInfo);
66
+ if (!changesInfo.hasChanges) {
67
+ return;
65
68
  }
66
69
  }
67
- else {
68
- await this.syncChangedDataOnDevices(data, projectData, liveSyncInfo);
69
- }
70
+ this.scheduleSyncOnDevices(data, projectData, liveSyncInfo);
70
71
  };
71
72
  this.prepareReadyEventHandler = handler.bind(this);
72
73
  this.$prepareController.on(constants_2.PREPARE_READY_EVENT_NAME, this.prepareReadyEventHandler);
@@ -277,6 +278,14 @@ class RunController extends events_1.EventEmitter {
277
278
  },
278
279
  watch: !liveSyncInfo.skipWatcher,
279
280
  });
281
+ // For Android + Vite HMR, own the `adb reverse` ourselves —
282
+ // with our SDK-resolved adb, scoped to this exact serial, and
283
+ // only after the device is up — then hand the bundler the
284
+ // result via env vars. This MUST run before `prepare` (which
285
+ // spawns the Vite bundler that inherits `process.env`) so the
286
+ // bundler trusts the tunnel instead of racing us to spawn its
287
+ // own adb during config-load. See packages/vite hardening.
288
+ await this.setupAndroidViteHmrReverse(device, projectData, liveSyncInfo, "pre-build");
280
289
  const prepareResultData = await this.$prepareController.prepare(prepareData);
281
290
  const buildData = {
282
291
  ...deviceDescriptor.buildData,
@@ -327,6 +336,11 @@ class RunController extends events_1.EventEmitter {
327
336
  watch: !skipWatcher,
328
337
  liveSyncDeviceData: deviceDescriptor,
329
338
  });
339
+ // Re-establish the adb reverse on the CURRENT transport right
340
+ // before launch — the transport can change during build/install
341
+ // and drop the mapping set in `pre-build`, which would leave the
342
+ // app unable to reach the Vite dev server at 127.0.0.1.
343
+ await this.setupAndroidViteHmrReverse(device, projectData, liveSyncInfo, "pre-launch");
330
344
  await this.refreshApplication(projectData, liveSyncResultInfo, null, deviceDescriptor);
331
345
  this.$logger.info(`Successfully synced application ${liveSyncResultInfo.deviceAppData.appIdentifier} on device ${liveSyncResultInfo.deviceAppData.device.deviceInfo.identifier}.`);
332
346
  this.emitCore(constants_2.RunOnDeviceEvents.runOnDeviceStarted, {
@@ -353,6 +367,134 @@ class RunController extends events_1.EventEmitter {
353
367
  };
354
368
  await this.addActionToChain(projectData.projectDir, () => this.$devicesService.execute(deviceAction, (device) => _.some(deviceDescriptors, (deviceDescriptor) => deviceDescriptor.identifier === device.deviceInfo.identifier)));
355
369
  }
370
+ /**
371
+ * Set up `adb reverse tcp:<port> tcp:<port>` for an Android device
372
+ * when the project bundles with Vite in HMR/watch mode, then export
373
+ * the result to the bundler subprocess via environment variables.
374
+ *
375
+ * The Vite dev-host helper prefers an ADB tunnel (device-side
376
+ * `127.0.0.1:<port>` → host) over the emulator's flaky slirp NAT
377
+ * (`10.0.2.2`). Historically the bundler tried to wire that tunnel
378
+ * itself at config-load time, racing this CLI's device discovery
379
+ * over the single global adb daemon and intermittently freezing the
380
+ * run at "Searching for devices…". The CLI is the right owner: it
381
+ * knows the exact target serial and when the device is ready, and it
382
+ * already drives a single, version-matched adb. We do the reverse
383
+ * here and signal the bundler with `NS_ADB_REVERSE_READY=1` so it
384
+ * never spawns adb on its own.
385
+ *
386
+ * Best-effort: any failure is logged at trace level and swallowed.
387
+ * The bundler then falls back to its own (now hardened) adb path, or
388
+ * ultimately to `10.0.2.2`, so a reverse hiccup never fails the run.
389
+ */
390
+ async setupAndroidViteHmrReverse(device, projectData, liveSyncInfo, phase) {
391
+ try {
392
+ if (!this.$mobileHelper.isAndroidPlatform(device.deviceInfo.platform)) {
393
+ return;
394
+ }
395
+ if (projectData.bundler !== "vite") {
396
+ return;
397
+ }
398
+ // HMR over the tunnel only matters for a live watch session.
399
+ if (liveSyncInfo.skipWatcher || !liveSyncInfo.useHotModuleReload) {
400
+ return;
401
+ }
402
+ // Respect the user's explicit opt-out — they want the
403
+ // `10.0.2.2` / LAN path, so don't create a tunnel or claim one
404
+ // exists.
405
+ if (this.isTruthyEnvFlag(process.env.NS_HMR_NO_ADB_REVERSE)) {
406
+ return;
407
+ }
408
+ // `NS_HMR_PREFER_LAN_HOST` means the dev wants LAN routing
409
+ // (physical device over Wi-Fi); the dev-host resolver suppresses
410
+ // the adb-reverse path for it, so don't bother wiring one.
411
+ if (this.isTruthyEnvFlag(process.env.NS_HMR_PREFER_LAN_HOST)) {
412
+ return;
413
+ }
414
+ const serial = device.deviceInfo.identifier;
415
+ const port = this.getViteHmrPort();
416
+ if (phase === "pre-build") {
417
+ // Decide the origin baked into bundle.mjs. Hand the bundler our
418
+ // exact adb (so any self-managed fallback can't version-mismatch
419
+ // the daemon) and, if the tunnel comes up, tell it to emit
420
+ // `127.0.0.1` and skip adb entirely.
421
+ process.env.NS_ADB_PATH = await this.$staticConfig.getAdbFilePath();
422
+ process.env.NS_DEVICE_SERIAL = serial;
423
+ const ok = await this.ensureAndroidReverse(device, serial, port);
424
+ if (ok) {
425
+ process.env.NS_ADB_REVERSE_READY = "1";
426
+ this.$logger.info(`Set up adb reverse tcp:${port} tcp:${port} for ${serial} (Vite HMR routes device-side 127.0.0.1:${port} through ADB).`);
427
+ }
428
+ else {
429
+ this.$logger.warn(`Could not confirm 'adb reverse tcp:${port}' on ${serial} (device adbd slow/unresponsive). Vite HMR will fall back to 10.0.2.2. If this persists, cold-boot/wipe the emulator, or set NS_HMR_NO_ADB_REVERSE=1.`);
430
+ }
431
+ return;
432
+ }
433
+ // phase === "pre-launch": re-establish the mapping right before the
434
+ // app boots. `adb reverse` mappings are bound to the device's adb
435
+ // transport, and that transport can change during the (long) build
436
+ // + install (fresh emulators reconnect as they settle), silently
437
+ // dropping the early mapping. We only bother when we actually told
438
+ // the bundle to use `127.0.0.1` (READY set during pre-build).
439
+ if (!this.isTruthyEnvFlag(process.env.NS_ADB_REVERSE_READY)) {
440
+ return;
441
+ }
442
+ const ok = await this.ensureAndroidReverse(device, serial, port);
443
+ if (!ok) {
444
+ this.$logger.warn(`adb reverse tcp:${port} was not active before launch on ${serial}; the app may fail to reach the Vite dev server at 127.0.0.1:${port}.`);
445
+ }
446
+ }
447
+ catch (err) {
448
+ this.$logger.trace(`Setting up adb reverse for Vite HMR (${phase}) failed; leaving it to the bundler fallback. Error: ${err}`);
449
+ }
450
+ }
451
+ /**
452
+ * Apply `adb reverse tcp:<port> tcp:<port>` to the device and confirm
453
+ * via `adb reverse --list` that it actually landed, retrying a few
454
+ * times. Every device-side call is bounded with a Node `spawn` timeout
455
+ * + `SIGKILL` so a wedged/slow adbd (observed blocking 90s+ on some
456
+ * fresh-boot / API-36 arm64 emulators) can never hang the run — the
457
+ * hung adb child is reaped, not orphaned. Returns whether the mapping
458
+ * is confirmed present.
459
+ */
460
+ async ensureAndroidReverse(device, serial, port) {
461
+ var _a, _b, _c;
462
+ const adb = device.adb;
463
+ const ADB_WAIT_MS = 15000;
464
+ const ADB_REVERSE_MS = 20000;
465
+ const bounded = (timeout) => ({
466
+ deviceIdentifier: serial,
467
+ treatErrorsAsWarnings: true,
468
+ childProcessOptions: { timeout, killSignal: "SIGKILL" },
469
+ });
470
+ // `wait-for-device` only blocks until the transport is up; bounded so a
471
+ // never-ready device can't stall us.
472
+ await adb.executeCommand(["wait-for-device"], bounded(ADB_WAIT_MS));
473
+ for (let attempt = 1; attempt <= 3; attempt++) {
474
+ await adb.executeCommand(["reverse", `tcp:${port}`, `tcp:${port}`], bounded(ADB_REVERSE_MS));
475
+ // Verify it landed (a SIGKILL'd-on-timeout reverse resolves rather
476
+ // than throws, so success of the call isn't proof).
477
+ const list = (_c = (_b = (_a = (await adb.executeCommand(["reverse", "--list"], bounded(ADB_WAIT_MS)))) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : "";
478
+ if (list.includes(`tcp:${port}`)) {
479
+ return true;
480
+ }
481
+ }
482
+ return false;
483
+ }
484
+ getViteHmrPort() {
485
+ // The Vite dev server defaults to 5173; the bundler reads the same
486
+ // default. If a project runs Vite on a different port, the dev sets
487
+ // `NS_HMR_PORT` so the CLI reverses the matching port.
488
+ const fromEnv = Number(process.env.NS_HMR_PORT);
489
+ return Number.isFinite(fromEnv) && fromEnv > 0 ? fromEnv : 5173;
490
+ }
491
+ isTruthyEnvFlag(value) {
492
+ if (typeof value !== "string") {
493
+ return false;
494
+ }
495
+ const v = value.trim().toLowerCase();
496
+ return !!v && v !== "0" && v !== "false" && v !== "off" && v !== "no";
497
+ }
356
498
  async syncChangedDataOnDevices(data, projectData, liveSyncInfo) {
357
499
  const successfullySyncedMessageFormat = `Successfully synced application %s on device %s.`;
358
500
  const rebuiltInformation = {};
@@ -476,18 +618,13 @@ class RunController extends events_1.EventEmitter {
476
618
  }
477
619
  }
478
620
  catch (err) {
479
- this.$logger.warn(`Unable to apply changes for device: ${device.deviceInfo.identifier}. Error is: ${err && err.message}.`);
621
+ this.$logger.warn(`Unable to apply changes for device: ${device.deviceInfo.identifier}. Error is: ${err && err.message}. Will retry on next change.`);
480
622
  this.emitCore(constants_2.RunOnDeviceEvents.runOnDeviceError, {
481
623
  projectDir: projectData.projectDir,
482
624
  deviceIdentifier: device.deviceInfo.identifier,
483
625
  applicationIdentifier: projectData.projectIdentifiers[device.deviceInfo.platform.toLowerCase()],
484
626
  error: err,
485
627
  });
486
- await this.stop({
487
- projectDir: projectData.projectDir,
488
- deviceIdentifiers: [device.deviceInfo.identifier],
489
- stopOptions: { shouldAwaitAllActions: false },
490
- });
491
628
  }
492
629
  };
493
630
  await this.addActionToChain(projectData.projectDir, () => this.$devicesService.execute(deviceAction, (device) => {
@@ -498,15 +635,65 @@ class RunController extends events_1.EventEmitter {
498
635
  _.some(liveSyncProcessInfo.deviceDescriptors, (deviceDescriptor) => deviceDescriptor.identifier === device.deviceInfo.identifier));
499
636
  }));
500
637
  }
638
+ scheduleSyncOnDevices(data, projectData, liveSyncInfo) {
639
+ if (this._syncInProgress) {
640
+ const platform = data.platform;
641
+ const existing = this._pendingSyncs.get(platform);
642
+ if (existing) {
643
+ existing.data = this.mergeFilesChangeEvents(existing.data, data);
644
+ }
645
+ else {
646
+ this._pendingSyncs.set(platform, { data, projectData, liveSyncInfo });
647
+ }
648
+ return;
649
+ }
650
+ this.executeSyncOnDevices(data, projectData, liveSyncInfo);
651
+ }
652
+ async executeSyncOnDevices(data, projectData, liveSyncInfo) {
653
+ this._syncInProgress = true;
654
+ try {
655
+ await this.syncChangedDataOnDevices(data, projectData, liveSyncInfo);
656
+ }
657
+ catch (err) {
658
+ this.$logger.trace(`Error during sync on devices: ${err.message || err}`);
659
+ }
660
+ finally {
661
+ const nextEntry = this._pendingSyncs.entries().next();
662
+ if (!nextEntry.done) {
663
+ const [platform, pending] = nextEntry.value;
664
+ this._pendingSyncs.delete(platform);
665
+ this.executeSyncOnDevices(pending.data, pending.projectData, pending.liveSyncInfo);
666
+ }
667
+ else {
668
+ this._syncInProgress = false;
669
+ }
670
+ }
671
+ }
672
+ mergeFilesChangeEvents(a, b) {
673
+ return {
674
+ files: [...new Set([...a.files, ...b.files])],
675
+ staleFiles: [
676
+ ...new Set([...(a.staleFiles || []), ...(b.staleFiles || [])]),
677
+ ],
678
+ hasOnlyHotUpdateFiles: a.hasOnlyHotUpdateFiles && b.hasOnlyHotUpdateFiles,
679
+ hasNativeChanges: a.hasNativeChanges || b.hasNativeChanges,
680
+ hmrData: b.hmrData,
681
+ platform: b.platform,
682
+ };
683
+ }
501
684
  async addActionToChain(projectDir, action) {
502
685
  const liveSyncInfo = this.$liveSyncProcessDataService.getPersistedData(projectDir);
503
686
  if (liveSyncInfo) {
504
- liveSyncInfo.actionsChain = liveSyncInfo.actionsChain.then(async () => {
687
+ liveSyncInfo.actionsChain = liveSyncInfo.actionsChain
688
+ .then(async () => {
505
689
  if (!liveSyncInfo.isStopped) {
506
690
  liveSyncInfo.currentSyncAction = action();
507
691
  const res = await liveSyncInfo.currentSyncAction;
508
692
  return res;
509
693
  }
694
+ })
695
+ .catch((err) => {
696
+ this.$logger.warn(`Error in action chain: ${err.message || err}`);
510
697
  });
511
698
  const result = await liveSyncInfo.actionsChain;
512
699
  return result;
@@ -33,6 +33,10 @@ class PrepareData extends controller_data_base_1.ControllerDataBase {
33
33
  this.watchNative = data.watchNative;
34
34
  }
35
35
  this.hostProjectPath = data.hostProjectPath;
36
+ if (data.skipNative) {
37
+ this.nativePrepare = { skipNativePrepare: true };
38
+ this.watchNative = false;
39
+ }
36
40
  this.uniqueBundle = !this.watch && data.uniqueBundle ? Date.now() : 0;
37
41
  }
38
42
  }