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
@@ -8,6 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.BundlerCompilerService = void 0;
10
10
  const path = require("path");
11
+ const net = require("net");
11
12
  const semver = require("semver");
12
13
  const _ = require("lodash");
13
14
  const events_1 = require("events");
@@ -34,8 +35,15 @@ class BundlerCompilerService extends events_1.EventEmitter {
34
35
  this.$packageInstallationManager = $packageInstallationManager;
35
36
  this.$projectConfigService = $projectConfigService;
36
37
  this.bundlerProcesses = {};
38
+ // Vite-only: the long-lived `vite serve` dev server the device fetches
39
+ // modules and HMR updates from. Keyed by platform, managed by this CLI
40
+ // so users no longer need a separate `concurrently`/`wait-on` process.
41
+ this.viteServeProcesses = {};
37
42
  this.expectedHashes = {};
38
43
  }
44
+ getViteDistOutputPath(projectDir) {
45
+ return path.join(projectDir, process.env.NS_VITE_DIST_DIR || constants_1.VITE_DIST_FOLDER_NAME);
46
+ }
39
47
  async compileWithWatch(platformData, projectData, prepareData) {
40
48
  return new Promise(async (resolve, reject) => {
41
49
  if (this.bundlerProcesses[platformData.platformNameLowerCase]) {
@@ -44,6 +52,14 @@ class BundlerCompilerService extends events_1.EventEmitter {
44
52
  }
45
53
  let isFirstBundlerWatchCompilation = true;
46
54
  prepareData.watch = true;
55
+ // Bring up the Vite HMR dev server the device fetches modules /
56
+ // HMR updates from. No-op unless bundler is vite + hmr + watch.
57
+ // Fired in parallel with the build watcher; both child processes
58
+ // inherit the adb-reverse env the run-controller set before
59
+ // prepare, so neither one spawns adb on its own. Intentionally not
60
+ // awaited — the device only connects to it at app launch, well
61
+ // after the first build.
62
+ this.startViteDevServer(platformData, projectData, prepareData);
47
63
  try {
48
64
  const childProcess = await this.startBundleProcess(platformData, projectData, prepareData);
49
65
  // Handle Vite differently from webpack
@@ -67,7 +83,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
67
83
  console.log("Received Vite IPC message:", message);
68
84
  }
69
85
  // Copy Vite output files directly to platform destination
70
- const distOutput = path.join(projectData.projectDir, ".ns-vite-build");
86
+ const distOutput = this.getViteDistOutputPath(projectData.projectDir);
71
87
  const destDir = path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName);
72
88
  if (debugLog) {
73
89
  console.log(`Copying from ${distOutput} to ${destDir}.`);
@@ -96,6 +112,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
96
112
  console.log("Vite first build completed, resolving compileWithWatch");
97
113
  }
98
114
  resolve(childProcess);
115
+ return;
99
116
  }
100
117
  // Transform Vite message to match webpack format
101
118
  const files = message.emittedFiles.map((file) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, file));
@@ -214,11 +231,31 @@ class BundlerCompilerService extends events_1.EventEmitter {
214
231
  delete this.bundlerProcesses[platformData.platformNameLowerCase];
215
232
  reject(err);
216
233
  });
234
+ const isVite = this.getBundler() === "vite";
217
235
  childProcess.on("close", async (arg) => {
218
236
  await this.$cleanupService.removeKillProcess(childProcess.pid.toString());
219
237
  delete this.bundlerProcesses[platformData.platformNameLowerCase];
220
238
  const exitCode = typeof arg === "number" ? arg : arg && arg.code;
221
239
  if (exitCode === 0) {
240
+ // Non-watch Vite builds spawn the child with stdio:"inherit"
241
+ // (no IPC channel), so the emittedFiles message handler in
242
+ // compileWithWatch never fires and the Vite output is never
243
+ // copied to the platforms app folder. Mirror that copy step
244
+ // here so release/CI prepare and build flows actually deploy
245
+ // the freshly built bundle. Without this, the deploy folder
246
+ // is left empty (or worse, runs stale dev/HMR artifacts from
247
+ // a previous `ns debug` run) and the runtime crashes on
248
+ // launch with `Check failed: has_pending_exception()`.
249
+ if (isVite) {
250
+ try {
251
+ const distOutput = this.getViteDistOutputPath(projectData.projectDir);
252
+ const destDir = path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName);
253
+ this.copyViteBundleToNative(distOutput, destDir);
254
+ }
255
+ catch (copyErr) {
256
+ this.$logger.warn(`Failed to copy Vite output to platform destination: ${copyErr.message}`);
257
+ }
258
+ }
222
259
  resolve();
223
260
  }
224
261
  else {
@@ -244,13 +281,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
244
281
  }
245
282
  }
246
283
  }
247
- async shouldUsePreserveSymlinksOption(projectData) {
248
- // Modern bundlers (webpack v5+ and rspack) are more sensitive to
249
- // duplicate module identities when symlink paths are preserved.
250
- // In local file-linked setups this can load webpack internals twice.
251
- if (this.isModernBundler(projectData)) {
252
- return false;
253
- }
284
+ async shouldUsePreserveSymlinksOption() {
254
285
  // pnpm does not require symlink (https://github.com/nodejs/node-eps/issues/46#issuecomment-277373566)
255
286
  // and it also does not work in some cases.
256
287
  // Check https://github.com/NativeScript/nativescript-cli/issues/5259 for more information
@@ -282,7 +313,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
282
313
  ]
283
314
  : cliArgs;
284
315
  const additionalNodeArgs = semver.major(process.version) <= 8 ? ["--harmony"] : [];
285
- if (await this.shouldUsePreserveSymlinksOption(projectData)) {
316
+ if (await this.shouldUsePreserveSymlinksOption()) {
286
317
  additionalNodeArgs.push("--preserve-symlinks");
287
318
  }
288
319
  if (process.arch === "x64") {
@@ -318,7 +349,6 @@ class BundlerCompilerService extends events_1.EventEmitter {
318
349
  USER_PROJECT_PLATFORMS_ANDROID: this.$options.hostProjectPath,
319
350
  USER_PROJECT_PLATFORMS_ANDROID_MODULE: this.$options.hostProjectModuleName,
320
351
  USER_PROJECT_PLATFORMS_IOS: this.$options.hostProjectPath,
321
- USER_PROJECT_PLATFORMS_MACOS: this.$options.hostProjectPath,
322
352
  });
323
353
  }
324
354
  if (debugLog) {
@@ -329,13 +359,145 @@ class BundlerCompilerService extends events_1.EventEmitter {
329
359
  await this.$cleanupService.addKillProcess(childProcess.pid.toString());
330
360
  return childProcess;
331
361
  }
362
+ getViteHmrPort() {
363
+ const fromEnv = Number(process.env.NS_HMR_PORT);
364
+ return Number.isFinite(fromEnv) && fromEnv > 0 ? fromEnv : 5173;
365
+ }
366
+ /**
367
+ * Spawn and manage the Vite dev server (`vite serve`) for HMR.
368
+ *
369
+ * Why the CLI owns this. With Vite, HMR needs a long-lived dev server
370
+ * (HTTP + the `/ns-hmr` websocket on port 5173) that the device fetches
371
+ * modules and hot updates from — it is SEPARATE from the
372
+ * `vite build --watch` process that emits the `bundle.mjs` bootstrap
373
+ * baked into the app. Historically users wired this up themselves with
374
+ * `concurrently`/`wait-on`, which left two uncoordinated processes both
375
+ * touching adb during cold start (the source of the Android
376
+ * "Searching for devices…" freeze). By spawning it here as a child of
377
+ * the CLI, the dev server inherits the CLI's environment — crucially
378
+ * `NS_ADB_REVERSE_READY`/`NS_DEVICE_SERIAL`/`NS_ADB_PATH` set by the
379
+ * run-controller — so the CLI is the single adb owner and the dev
380
+ * server never spawns adb itself.
381
+ *
382
+ * No-op unless bundler is vite, HMR is on, watch mode, and not release.
383
+ * Best-effort: failures are logged, never thrown — a dev-server hiccup
384
+ * must not fail the run.
385
+ */
386
+ async startViteDevServer(platformData, projectData, prepareData) {
387
+ try {
388
+ if (this.getBundler() !== "vite") {
389
+ return;
390
+ }
391
+ if (!prepareData.watch || !prepareData.hmr || prepareData.release) {
392
+ return;
393
+ }
394
+ const key = platformData.platformNameLowerCase;
395
+ if (this.viteServeProcesses[key]) {
396
+ return;
397
+ }
398
+ const port = this.getViteHmrPort();
399
+ // One dev server per port. Simultaneous multi-platform HMR in a
400
+ // single CLI invocation would collide on 5173 — that case still
401
+ // needs a distinct NS_HMR_PORT per platform, so skip + warn rather
402
+ // than fail to bind.
403
+ const collidingPlatform = Object.keys(this.viteServeProcesses)[0];
404
+ if (collidingPlatform) {
405
+ this.$logger.warn(`Vite dev server already running for '${collidingPlatform}' on port ${port}; skipping a second server for '${key}'. For simultaneous multi-platform HMR, set a distinct NS_HMR_PORT per platform.`);
406
+ return;
407
+ }
408
+ const envData = this.buildEnvData(platformData.platformNameLowerCase, projectData, prepareData);
409
+ const cliArgs = await this.buildEnvCommandLineParams(envData, platformData, projectData, prepareData);
410
+ const additionalNodeArgs = semver.major(process.version) <= 8 ? ["--harmony"] : [];
411
+ if (await this.shouldUsePreserveSymlinksOption()) {
412
+ additionalNodeArgs.push("--preserve-symlinks");
413
+ }
414
+ // `vite serve` (not `build`): runs the dev server and watches on
415
+ // its own — no `--watch`. Env flags (`--env.android --env.hmr …`)
416
+ // go after `--` so vite's CLI doesn't choke on unknown options.
417
+ const args = [
418
+ ...additionalNodeArgs,
419
+ this.getBundlerExecutablePath(projectData),
420
+ "serve",
421
+ `--config=${projectData.bundlerConfigPath}`,
422
+ `--mode=development`,
423
+ "--",
424
+ ...cliArgs,
425
+ ].filter(Boolean);
426
+ const options = {
427
+ cwd: projectData.projectDir,
428
+ // Inherit so the dev server's URLs/logs stream to the user as
429
+ // before. No IPC needed here — the build watcher provides the
430
+ // bundle-complete IPC; the dev server is fetched over HTTP/ws.
431
+ stdio: "inherit",
432
+ env: {
433
+ ...process.env,
434
+ NATIVESCRIPT_BUNDLER_ENV: JSON.stringify(envData),
435
+ },
436
+ };
437
+ if (this.$hostInfo.isWindows) {
438
+ Object.assign(options.env, { APPDATA: process.env.appData });
439
+ }
440
+ this.$logger.info(`Starting Vite dev server (HMR) for ${key} on port ${port}…`);
441
+ const childProcess = this.$childProcess.spawn(process.execPath, args, options);
442
+ this.viteServeProcesses[key] = childProcess;
443
+ await this.$cleanupService.addKillProcess(childProcess.pid.toString());
444
+ childProcess.once("exit", (code) => {
445
+ delete this.viteServeProcesses[key];
446
+ if (code) {
447
+ this.$logger.warn(`Vite dev server for ${key} exited with code ${code}.`);
448
+ }
449
+ });
450
+ // Bounded readiness probe so we can surface a clear log once the
451
+ // device can actually reach modules.
452
+ const ready = await this.waitForPort(port, 30000);
453
+ if (ready) {
454
+ this.$logger.info(`Vite dev server ready on port ${port} (HMR for ${key}).`);
455
+ }
456
+ else {
457
+ this.$logger.trace(`Vite dev server port ${port} not observed open within the readiness probe window; continuing (it may bind shortly).`);
458
+ }
459
+ }
460
+ catch (err) {
461
+ this.$logger.warn(`Failed to start the Vite dev server: ${err}. HMR may be unavailable.`);
462
+ }
463
+ }
464
+ /**
465
+ * Resolve true once `127.0.0.1:<port>` accepts a TCP connection, or
466
+ * false after `timeoutMs`. Used to detect the Vite dev server is up.
467
+ */
468
+ waitForPort(port, timeoutMs) {
469
+ const deadline = Date.now() + timeoutMs;
470
+ return new Promise((resolve) => {
471
+ const attempt = () => {
472
+ const socket = net.connect({ port, host: "127.0.0.1" });
473
+ let settled = false;
474
+ const done = (ok) => {
475
+ if (settled) {
476
+ return;
477
+ }
478
+ settled = true;
479
+ socket.destroy();
480
+ if (ok) {
481
+ resolve(true);
482
+ }
483
+ else if (Date.now() >= deadline) {
484
+ resolve(false);
485
+ }
486
+ else {
487
+ setTimeout(attempt, 250);
488
+ }
489
+ };
490
+ socket.once("connect", () => done(true));
491
+ socket.once("error", () => done(false));
492
+ socket.setTimeout(1000, () => done(false));
493
+ };
494
+ attempt();
495
+ });
496
+ }
332
497
  buildEnvData(platform, projectData, prepareData) {
333
498
  var _a, _b, _c;
334
499
  const { env } = prepareData;
335
500
  const envData = Object.assign({}, env, { [platform.toLowerCase()]: true });
336
- if (platform.toLowerCase() === "macos") {
337
- envData.platform = "macos";
338
- }
339
501
  const appId = projectData.projectIdentifiers[platform];
340
502
  const appPath = projectData.getAppDirectoryRelativePath();
341
503
  const appResourcesPath = projectData.getAppResourcesRelativeDirectoryPath();
@@ -463,6 +625,13 @@ class BundlerCompilerService extends events_1.EventEmitter {
463
625
  bundlerProcess.kill("SIGINT");
464
626
  delete this.bundlerProcesses[platform];
465
627
  }
628
+ // Tear down the Vite dev server we manage alongside the build watcher.
629
+ const viteServeProcess = this.viteServeProcesses[platform];
630
+ if (viteServeProcess) {
631
+ await this.$cleanupService.removeKillProcess(viteServeProcess.pid.toString());
632
+ viteServeProcess.kill("SIGINT");
633
+ delete this.viteServeProcesses[platform];
634
+ }
466
635
  }
467
636
  handleHMRMessage(message, platformData, projectData, prepareData) {
468
637
  // handle new bundler hmr packets
@@ -43,7 +43,7 @@ class DebugServiceBase extends events_1.EventEmitter {
43
43
  if (debugOptions.useHttpUrl) {
44
44
  chromeDevToolsPrefix = `https://chrome-devtools-frontend.appspot.com/serve_file/@${commitSHA}`;
45
45
  }
46
- const chromeUrl = `${chromeDevToolsPrefix}/inspector.html?ws=localhost:${port}`;
46
+ const chromeUrl = `${chromeDevToolsPrefix}/inspector.html?ws=127.0.0.1:${port}`;
47
47
  return chromeUrl;
48
48
  }
49
49
  }
@@ -8,11 +8,12 @@ const _ = require("lodash");
8
8
  const yok_1 = require("../../common/yok");
9
9
  const constants = require("../../constants");
10
10
  class IOSSigningService {
11
- constructor($errors, $fs, $iOSProvisionService, $logger, $pbxprojDomXcode, $prompter, $xcconfigService, $xcprojService) {
11
+ constructor($errors, $fs, $iOSProvisionService, $logger, $options, $pbxprojDomXcode, $prompter, $xcconfigService, $xcprojService) {
12
12
  this.$errors = $errors;
13
13
  this.$fs = $fs;
14
14
  this.$iOSProvisionService = $iOSProvisionService;
15
15
  this.$logger = $logger;
16
+ this.$options = $options;
16
17
  this.$pbxprojDomXcode = $pbxprojDomXcode;
17
18
  this.$prompter = $prompter;
18
19
  this.$xcconfigService = $xcconfigService;
@@ -150,6 +151,7 @@ class IOSSigningService {
150
151
  return [];
151
152
  }
152
153
  async getManualSigningConfiguration(projectData, provision, mobileProvisionData) {
154
+ var _a;
153
155
  const pickStart = Date.now();
154
156
  const mobileprovision = mobileProvisionData ||
155
157
  (await this.$iOSProvisionService.pick(provision, projectData.projectIdentifiers.ios));
@@ -162,6 +164,7 @@ class IOSSigningService {
162
164
  if (!mobileprovision) {
163
165
  this.$errors.fail("Failed to find mobile provision with UUID or Name: " + provision);
164
166
  }
167
+ const isVisionOS = ((_a = this.$options.platformOverride) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "visionos";
165
168
  const configuration = {
166
169
  team: mobileprovision.TeamIdentifier &&
167
170
  mobileprovision.TeamIdentifier.length > 0
@@ -170,8 +173,12 @@ class IOSSigningService {
170
173
  uuid: mobileprovision.UUID,
171
174
  name: mobileprovision.Name,
172
175
  identity: mobileprovision.Type === "Development"
173
- ? "iPhone Developer"
174
- : "iPhone Distribution",
176
+ ? isVisionOS
177
+ ? "Apple Development"
178
+ : "iPhone Developer"
179
+ : isVisionOS
180
+ ? "Apple Distribution"
181
+ : "iPhone Distribution",
175
182
  };
176
183
  return configuration;
177
184
  }
@@ -86,18 +86,11 @@ class SPMService {
86
86
  }
87
87
  }
88
88
  async resolveSPMDependencies(platformData, projectData) {
89
- let destination = "generic/platform=iOS";
90
- if (platformData.platformNameLowerCase === "visionos") {
91
- destination = "generic/platform=visionOS";
92
- }
93
- else if (platformData.platformNameLowerCase === "macos") {
94
- destination = "generic/platform=macOS";
95
- }
96
89
  await this.$xcodebuildCommandService.executeCommand(this.$xcodebuildArgsService
97
90
  .getXcodeProjectArgs(platformData, projectData)
98
91
  .concat([
99
92
  "-destination",
100
- destination,
93
+ "generic/platform=iOS",
101
94
  "-resolvePackageDependencies",
102
95
  ]), {
103
96
  cwd: projectData.projectDir,
@@ -18,11 +18,7 @@ class XcodebuildArgsService {
18
18
  }
19
19
  async getBuildForSimulatorArgs(platformData, projectData, buildConfig) {
20
20
  let args = await this.getArchitecturesArgs(buildConfig);
21
- const isMacOS = this.$devicePlatformsConstants.ismacOS(buildConfig.platform);
22
- if (isMacOS) {
23
- args = args.concat(["CODE_SIGNING_ALLOWED=NO"]);
24
- }
25
- else if (this.$iOSWatchAppService.hasWatchApp(platformData, projectData)) {
21
+ if (this.$iOSWatchAppService.hasWatchApp(platformData, projectData)) {
26
22
  args = args.concat(["CODE_SIGNING_ALLOWED=NO"]);
27
23
  }
28
24
  else {
@@ -30,9 +26,6 @@ class XcodebuildArgsService {
30
26
  }
31
27
  let destination = "generic/platform=iOS Simulator";
32
28
  let isvisionOS = this.$devicePlatformsConstants.isvisionOS(buildConfig.platform);
33
- if (isMacOS) {
34
- destination = "generic/platform=macOS";
35
- }
36
29
  if (isvisionOS) {
37
30
  destination = "generic/platform=visionOS Simulator";
38
31
  if (buildConfig._device) {
@@ -47,11 +40,9 @@ class XcodebuildArgsService {
47
40
  "-configuration",
48
41
  buildConfig.release ? constants_1.Configurations.Release : constants_1.Configurations.Debug,
49
42
  ])
50
- .concat(this.getBuildCommonArgs(platformData, projectData, isMacOS
51
- ? ios_project_service_1.MacOSPlatformSdkName
52
- : isvisionOS
53
- ? ios_project_service_1.VisionSimulatorPlatformSdkName
54
- : ios_project_service_1.SimulatorPlatformSdkName))
43
+ .concat(this.getBuildCommonArgs(platformData, projectData, isvisionOS
44
+ ? ios_project_service_1.VisionSimulatorPlatformSdkName
45
+ : ios_project_service_1.SimulatorPlatformSdkName))
55
46
  .concat(this.getBuildLoggingArgs())
56
47
  .concat(this.getXcodeProjectArgs(platformData, projectData));
57
48
  return args;
@@ -61,10 +52,6 @@ class XcodebuildArgsService {
61
52
  const archivePath = path.join(platformData.getBuildOutputPath(buildConfig), projectData.projectName + ".xcarchive");
62
53
  let destination = "generic/platform=iOS";
63
54
  let isvisionOS = this.$devicePlatformsConstants.isvisionOS(buildConfig.platform);
64
- const isMacOS = this.$devicePlatformsConstants.ismacOS(buildConfig.platform);
65
- if (isMacOS) {
66
- destination = "generic/platform=macOS";
67
- }
68
55
  if (isvisionOS) {
69
56
  destination = "generic/platform=visionOS";
70
57
  if (buildConfig._device) {
@@ -83,12 +70,13 @@ class XcodebuildArgsService {
83
70
  ]
84
71
  .concat(this.getXcodeProjectArgs(platformData, projectData))
85
72
  .concat(architectures)
86
- .concat(this.getBuildCommonArgs(platformData, projectData, isMacOS
87
- ? ios_project_service_1.MacOSPlatformSdkName
88
- : isvisionOS
89
- ? ios_project_service_1.VisionDevicePlatformSdkName
90
- : ios_project_service_1.DevicePlatformSdkName))
73
+ .concat(this.getBuildCommonArgs(platformData, projectData, isvisionOS ? ios_project_service_1.VisionDevicePlatformSdkName : ios_project_service_1.DevicePlatformSdkName))
91
74
  .concat(this.getBuildLoggingArgs());
75
+ // pbxproj-dom sets CODE_SIGN_IDENTITY[sdk=iphoneos*] which doesn't match
76
+ // the xros SDK used by visionOS builds — pass it explicitly as an override
77
+ if (isvisionOS) {
78
+ args.push(`CODE_SIGN_IDENTITY=${buildConfig.release ? "Apple Distribution" : "Apple Development"}`);
79
+ }
92
80
  return args;
93
81
  }
94
82
  async getArchitecturesArgs(buildConfig) {
@@ -99,13 +87,6 @@ class XcodebuildArgsService {
99
87
  args.push("ONLY_ACTIVE_ARCH=YES", "EXCLUDED_ARCHS=x86_64");
100
88
  return args;
101
89
  }
102
- if (this.$devicePlatformsConstants.ismacOS(buildConfig.platform)) {
103
- if (process.arch === "arm64") {
104
- // Avoid attempting x86_64 builds against arm64-only frameworks.
105
- args.push("ONLY_ACTIVE_ARCH=YES", "EXCLUDED_ARCHS=x86_64");
106
- }
107
- return args;
108
- }
109
90
  const devicesArchitectures = buildConfig.buildForDevice
110
91
  ? await this.getArchitecturesFromConnectedDevices(buildConfig)
111
92
  : [];
@@ -119,10 +100,17 @@ class XcodebuildArgsService {
119
100
  // Introduced in Xcode 14+
120
101
  // ref: https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/5
121
102
  const skipPackageValidation = "-skipPackagePluginValidation";
103
+ // Introduced in Xcode 15+ to trust Swift macros (compiler plugins)
104
+ // non-interactively. Required for SPM packages that ship macros
105
+ // (e.g. apple/RealityKitScripting), otherwise the build fails with:
106
+ // "Macro '...' from package '...' must be enabled before it can be used"
107
+ // ref: https://developer.apple.com/documentation/xcode/writing-swift-macros
108
+ const skipMacroValidation = "-skipMacroValidation";
122
109
  const extraArgs = [
123
110
  "-scheme",
124
111
  projectData.projectName,
125
112
  skipPackageValidation,
113
+ skipMacroValidation,
126
114
  ];
127
115
  const BUILD_SETTINGS_FILE_PATH = path.join(projectData.appResourcesDirectoryPath, platformData.normalizedPlatformName, constants.BUILD_XCCONFIG_FILE_NAME);
128
116
  // Only include explicit properties from build.xcconfig
@@ -131,6 +119,17 @@ class XcodebuildArgsService {
131
119
  // like cocoapods issues related to ASSETCATALOG_COMPILER_APPICON_NAME
132
120
  // references: https://medium.com/@iostechset/why-cocoapods-eats-app-icons-79fe729808d4
133
121
  // https://github.com/CocoaPods/CocoaPods/issues/7003
122
+ // Xcode 26 makes Swift "explicitly built modules" the default. A
123
+ // regression there prevents macro/compiler-plugin SPM targets from
124
+ // resolving their swift-syntax module dependencies, failing with:
125
+ // "Unable to resolve module dependency: 'SwiftSyntax'" (and SwiftParser,
126
+ // SwiftSyntaxMacros, SwiftCompilerPlugin, SwiftDiagnostics).
127
+ // Passed as a command-line build setting so it overrides ALL targets,
128
+ // including the package targets we don't control.
129
+ // ref: https://forums.swift.org/t/xcode-26-unable-to-find-module-dependency/80516
130
+ const explicitModulesProperty = "SWIFT_ENABLE_EXPLICIT_MODULES";
131
+ const explicitModulesValue = this.$xcconfigService.readPropertyValue(BUILD_SETTINGS_FILE_PATH, explicitModulesProperty) || "NO";
132
+ extraArgs.push(`${explicitModulesProperty}=${explicitModulesValue}`);
134
133
  const deployTargetProperty = "IPHONEOS_DEPLOYMENT_TARGET";
135
134
  const deployTargetVersion = this.$xcconfigService.readPropertyValue(BUILD_SETTINGS_FILE_PATH, deployTargetProperty);
136
135
  if (deployTargetVersion) {
@@ -141,6 +140,14 @@ class XcodebuildArgsService {
141
140
  if (swiftUIBootValue) {
142
141
  extraArgs.push(`${swiftUIBootProperty}=${swiftUIBootValue}`);
143
142
  }
143
+ // Swift macro/compiler-plugin SPM targets must be code-signed with a
144
+ // development team when building for a device. Pass DEVELOPMENT_TEAM as a
145
+ // command-line build setting so it applies to SPM package targets too.
146
+ const developmentTeamProperty = "DEVELOPMENT_TEAM";
147
+ const developmentTeamValue = this.$xcconfigService.readPropertyValue(BUILD_SETTINGS_FILE_PATH, developmentTeamProperty);
148
+ if (developmentTeamValue) {
149
+ extraArgs.push(`${developmentTeamProperty}=${developmentTeamValue}`);
150
+ }
144
151
  if (this.$fs.exists(xcworkspacePath)) {
145
152
  return ["-workspace", xcworkspacePath, ...extraArgs];
146
153
  }
@@ -21,7 +21,9 @@ class IOSEntitlementsService {
21
21
  }
22
22
  getPlatformsEntitlementsPath(projectData) {
23
23
  var _a;
24
- return path.join(projectData.platformsDir, (_a = this.$options.platformOverride) !== null && _a !== void 0 ? _a : this.$devicePlatformsConstants.iOS.toLowerCase(), projectData.projectName, projectData.projectName + ".entitlements");
24
+ return path.join(projectData.platformsDir, this.$mobileHelper
25
+ .normalizePlatformName((_a = this.$options.platformOverride) !== null && _a !== void 0 ? _a : this.$devicePlatformsConstants.iOS)
26
+ .toLowerCase(), projectData.projectName, projectData.projectName + ".entitlements");
25
27
  }
26
28
  getPlatformsEntitlementsRelativePath(projectData) {
27
29
  return path.join(projectData.projectName, projectData.projectName + ".entitlements");