nativescript 9.0.0-alpha.8 → 9.0.0-dev.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 (89) hide show
  1. package/config/config.json +1 -1
  2. package/config/test-deps-versions-generated.json +3 -3
  3. package/docs/build-jekyll-md.sh +1 -1
  4. package/docs/man_pages/config/config-get.md +36 -0
  5. package/docs/man_pages/config/config-set.md +40 -0
  6. package/docs/man_pages/config/config.md +39 -0
  7. package/docs/man_pages/project/hooks/hooks.md +35 -0
  8. package/docs/man_pages/start.md +1 -0
  9. package/lib/.d.ts +4 -0
  10. package/lib/bootstrap.js +2 -0
  11. package/lib/commands/build.js +22 -3
  12. package/lib/commands/clean.js +3 -3
  13. package/lib/commands/config.js +9 -3
  14. package/lib/commands/hooks/common.js +79 -0
  15. package/lib/commands/hooks/hooks-lock.js +100 -0
  16. package/lib/commands/hooks/hooks.js +71 -0
  17. package/lib/commands/plugin/build-plugin.js +6 -2
  18. package/lib/commands/typings.js +1 -1
  19. package/lib/common/declarations.d.ts +5 -0
  20. package/lib/common/definitions/extensibility.d.ts +2 -2
  21. package/lib/common/definitions/mobile.d.ts +78 -72
  22. package/lib/common/file-system.js +1 -1
  23. package/lib/common/logger/logger.js +1 -1
  24. package/lib/common/mobile/android/android-device.js +8 -2
  25. package/lib/common/mobile/mobile-core/devices-service.js +1 -1
  26. package/lib/common/plist-parser.js +3 -3
  27. package/lib/common/project-helper.js +15 -2
  28. package/lib/common/services/hooks-service.js +1 -1
  29. package/lib/config.js +2 -38
  30. package/lib/constants.js +3 -2
  31. package/lib/controllers/build-controller.js +1 -1
  32. package/lib/controllers/deploy-controller.js +5 -2
  33. package/lib/controllers/migrate-controller.js +6 -5
  34. package/lib/controllers/platform-controller.js +3 -1
  35. package/lib/controllers/prepare-controller.js +54 -13
  36. package/lib/controllers/run-controller.js +12 -13
  37. package/lib/controllers/update-controller.js +2 -2
  38. package/lib/data/build-data.js +2 -0
  39. package/lib/declarations.d.ts +3 -1
  40. package/lib/definitions/android-plugin-migrator.d.ts +3 -2
  41. package/lib/definitions/build.d.ts +4 -2
  42. package/lib/definitions/hooks.d.ts +1 -0
  43. package/lib/definitions/ios-debugger-port-service.d.ts +1 -1
  44. package/lib/definitions/livesync.d.ts +1 -1
  45. package/lib/definitions/project.d.ts +14 -0
  46. package/lib/definitions/run.d.ts +2 -4
  47. package/lib/helpers/deploy-command-helper.js +1 -0
  48. package/lib/nativescript-cli.js +28 -0
  49. package/lib/options.js +9 -2
  50. package/lib/project-data.js +8 -2
  51. package/lib/services/analytics/analytics-broker-process.js +1 -1
  52. package/lib/services/analytics/analytics-service.js +1 -1
  53. package/lib/services/android/gradle-build-args-service.js +21 -7
  54. package/lib/services/android/gradle-build-service.js +15 -1
  55. package/lib/services/android-plugin-build-service.js +58 -44
  56. package/lib/services/android-project-service.js +63 -4
  57. package/lib/services/build-artifacts-service.js +24 -9
  58. package/lib/services/bundler/bundler-compiler-service.js +77 -104
  59. package/lib/services/cocoapods-service.js +10 -4
  60. package/lib/services/device/device-install-app-service.js +27 -5
  61. package/lib/services/extensibility-service.js +1 -1
  62. package/lib/services/ios/xcodebuild-args-service.js +7 -5
  63. package/lib/services/ios-project-service.js +5 -2
  64. package/lib/services/plugins-service.js +3 -2
  65. package/lib/services/project-data-service.js +16 -18
  66. package/lib/services/timeline-profiler-service.js +21 -13
  67. package/lib/services/versions-service.js +2 -1
  68. package/package.json +18 -15
  69. package/vendor/aab-tool/README.txt +1 -1
  70. package/vendor/aab-tool/bundletool.jar +0 -0
  71. package/vendor/gradle-app/app/build.gradle +1292 -0
  72. package/vendor/gradle-app/app/gradle-helpers/AnalyticsCollector.gradle +48 -0
  73. package/vendor/gradle-app/app/gradle-helpers/BuildToolTask.gradle +50 -0
  74. package/vendor/gradle-app/app/gradle-helpers/CustomExecutionLogger.gradle +52 -0
  75. package/vendor/gradle-app/app/gradle.properties +45 -0
  76. package/vendor/gradle-app/build.gradle +170 -0
  77. package/vendor/gradle-app/settings.gradle +78 -0
  78. package/vendor/gradle-plugin/build.gradle +214 -91
  79. package/vendor/gradle-plugin/gradle.properties +2 -18
  80. package/vendor/gradle-plugin/settings.gradle +23 -11
  81. package/lib/common/resources/platform-tools/android/darwin/NOTICE.txt +0 -3407
  82. package/lib/common/resources/platform-tools/android/darwin/adb +0 -0
  83. package/lib/common/resources/platform-tools/android/linux/NOTICE.txt +0 -4451
  84. package/lib/common/resources/platform-tools/android/linux/adb +0 -0
  85. package/lib/common/resources/platform-tools/android/win32/AdbWinApi.dll +0 -0
  86. package/lib/common/resources/platform-tools/android/win32/AdbWinUsbApi.dll +0 -0
  87. package/lib/common/resources/platform-tools/android/win32/NOTICE.txt +0 -4451
  88. package/lib/common/resources/platform-tools/android/win32/adb.exe +0 -0
  89. package/lib/common/resources/platform-tools/android/win32/fastboot.exe +0 -0
@@ -15,6 +15,7 @@ const decorators_1 = require("../../common/decorators");
15
15
  const constants_1 = require("../../constants");
16
16
  const yok_1 = require("../../common/yok");
17
17
  const package_path_helper_1 = require("../../helpers/package-path-helper");
18
+ const debugLog = false;
18
19
  class BundlerCompilerService extends events_1.EventEmitter {
19
20
  constructor($options, $errors, $childProcess, $fs, $hooksService, $hostInfo, $logger, $mobileHelper, $cleanupService, $packageManager, $packageInstallationManager, $projectConfigService) {
20
21
  super();
@@ -56,37 +57,34 @@ class BundlerCompilerService extends events_1.EventEmitter {
56
57
  message &&
57
58
  message.emittedFiles) {
58
59
  message = message;
59
- console.log("Received Vite IPC message:", message);
60
- const distOutput = path.join(projectData.projectDir, "dist");
60
+ if (debugLog) {
61
+ console.log("Received Vite IPC message:", message);
62
+ }
63
+ const distOutput = path.join(projectData.projectDir, ".ns-vite-build");
61
64
  const destDir = path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName);
62
- console.log(`🔥 Copying from ${distOutput} to ${destDir}`);
63
- if (message.isHMR) {
64
- console.log("🔥 HMR update - copying only changed files for:", message.changedFiles);
65
- let filesToCopy = message.emittedFiles;
66
- const hasHTMLChanges = message.changedFiles.some((f) => f.endsWith(".html"));
67
- if (hasHTMLChanges) {
68
- filesToCopy = message.emittedFiles.filter((f) => f.includes(".component") ||
69
- f === "bundle.mjs" ||
70
- f === "bundle.mjs.map");
71
- console.log("🔥 HTML change detected - copying component files:", filesToCopy);
72
- }
73
- this.copyViteBundleToNative(distOutput, destDir, filesToCopy);
65
+ if (debugLog) {
66
+ console.log(`Copying from ${distOutput} to ${destDir}.`);
74
67
  }
75
- else if (message.buildType === "incremental" &&
76
- message.changedFiles &&
77
- message.changedFiles.length > 0) {
78
- console.log("🔥 Incremental build - copying only relevant files for:", message.changedFiles);
79
- const filesToCopy = this.getIncrementalFilesToCopy(message.emittedFiles, message.changedFiles);
80
- console.log("🔥 Incremental build - files to copy:", filesToCopy);
68
+ if (message.buildType === "incremental" &&
69
+ message.emittedFiles &&
70
+ message.emittedFiles.length > 0) {
71
+ const filesToCopy = this.getIncrementalFilesToCopy(message.emittedFiles);
72
+ if (debugLog) {
73
+ console.log("Incremental build - files to copy:", filesToCopy);
74
+ }
81
75
  this.copyViteBundleToNative(distOutput, destDir, filesToCopy);
82
76
  }
83
77
  else {
84
- console.log("🔥 Full build - copying all files");
78
+ if (debugLog) {
79
+ console.log("Full build - copying all files.");
80
+ }
85
81
  this.copyViteBundleToNative(distOutput, destDir);
86
82
  }
87
83
  if (isFirstBundlerWatchCompilation) {
88
84
  isFirstBundlerWatchCompilation = false;
89
- console.log("Vite first build completed, resolving compileWithWatch");
85
+ if (debugLog) {
86
+ console.log("Vite first build completed, resolving compileWithWatch");
87
+ }
90
88
  resolve(childProcess);
91
89
  }
92
90
  const files = message.emittedFiles.map((file) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, file));
@@ -100,20 +98,10 @@ class BundlerCompilerService extends events_1.EventEmitter {
100
98
  platform: platformData.platformNameLowerCase,
101
99
  };
102
100
  this.$logger.info(`Vite build completed! Files copied to native platform.`);
103
- this.notifyHMRClients({
104
- type: message.isHMR ? "js-update" : "build-complete",
105
- timestamp: Date.now(),
106
- changedFiles: message.changedFiles || [],
107
- buildType: message.buildType || "incremental",
108
- isHMR: message.isHMR || false,
109
- });
110
- if (message.isHMR) {
111
- console.log("🔥 Skipping BUNDLER_COMPILATION_COMPLETE for HMR update - app will not restart");
112
- }
113
- else {
114
- console.log("🔥 Emitting BUNDLER_COMPILATION_COMPLETE for full build");
115
- this.emit(constants_1.BUNDLER_COMPILATION_COMPLETE, data);
101
+ if (debugLog) {
102
+ console.log("Emitting BUNDLER_COMPILATION_COMPLETE for full build.");
116
103
  }
104
+ this.emit(constants_1.BUNDLER_COMPILATION_COMPLETE, data);
117
105
  return;
118
106
  }
119
107
  if (typeof message === "object" &&
@@ -255,7 +243,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
255
243
  const cliArgs = await this.buildEnvCommandLineParams(envData, platformData, projectData, prepareData);
256
244
  const envParams = isVite
257
245
  ? [
258
- `--mode=${platformData.platformNameLowerCase}`,
246
+ `--mode=${prepareData.release ? "production" : "development"}`,
259
247
  `--watch`,
260
248
  "--",
261
249
  ...cliArgs,
@@ -271,7 +259,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
271
259
  const args = [
272
260
  ...additionalNodeArgs,
273
261
  this.getBundlerExecutablePath(projectData),
274
- isVite ? "build" : this.isModernBundler(projectData) ? `build` : null,
262
+ isVite || this.isModernBundler(projectData) ? "build" : null,
275
263
  `--config=${projectData.bundlerConfigPath}`,
276
264
  ...envParams,
277
265
  ].filter(Boolean);
@@ -300,7 +288,9 @@ class BundlerCompilerService extends events_1.EventEmitter {
300
288
  USER_PROJECT_PLATFORMS_IOS: this.$options.hostProjectPath,
301
289
  });
302
290
  }
303
- console.log("args:", args);
291
+ if (debugLog) {
292
+ console.log("args:", args);
293
+ }
304
294
  const childProcess = this.$childProcess.spawn(process.execPath, args, options);
305
295
  this.bundlerProcesses[platformData.platformNameLowerCase] = childProcess;
306
296
  await this.$cleanupService.addKillProcess(childProcess.pid.toString());
@@ -313,7 +303,8 @@ class BundlerCompilerService extends events_1.EventEmitter {
313
303
  const appId = projectData.projectIdentifiers[platform];
314
304
  const appPath = projectData.getAppDirectoryRelativePath();
315
305
  const appResourcesPath = projectData.getAppResourcesRelativeDirectoryPath();
316
- Object.assign(envData, appId && { appId }, appPath && { appPath }, appResourcesPath && { appResourcesPath }, {
306
+ const buildPath = projectData.getBuildRelativeDirectoryPath();
307
+ Object.assign(envData, appId && { appId }, appPath && { appPath }, appResourcesPath && { appResourcesPath }, buildPath && { buildPath }, {
317
308
  nativescriptLibPath: path.resolve(__dirname, "..", "..", "nativescript-cli-lib.js"),
318
309
  });
319
310
  envData.verbose = envData.verbose || this.$logger.isVerbose();
@@ -459,20 +450,15 @@ class BundlerCompilerService extends events_1.EventEmitter {
459
450
  }
460
451
  }
461
452
  else if (this.isModernBundler(projectData)) {
462
- const packagePath = (0, package_path_helper_1.resolvePackagePath)(`@nativescript/${bundler}`, {
453
+ const webpackPluginName = this.$projectConfigService.getValue(`webpackPackageName`, constants_1.WEBPACK_PLUGIN_NAME);
454
+ const packagePath = (0, package_path_helper_1.resolvePackagePath)(webpackPluginName, {
463
455
  paths: [projectData.projectDir],
464
456
  });
465
457
  if (packagePath) {
466
458
  return path.resolve(packagePath, "dist", "bin", "index.js");
467
459
  }
468
460
  }
469
- const packagePath = (0, package_path_helper_1.resolvePackagePath)("webpack", {
470
- paths: [projectData.projectDir],
471
- });
472
- if (!packagePath) {
473
- return "";
474
- }
475
- return path.resolve(packagePath, "bin", "webpack.js");
461
+ throw new Error('could not find bundler executable');
476
462
  }
477
463
  isModernBundler(projectData) {
478
464
  const bundler = this.getBundler();
@@ -480,7 +466,8 @@ class BundlerCompilerService extends events_1.EventEmitter {
480
466
  case "rspack":
481
467
  return true;
482
468
  default:
483
- const packageJSONPath = (0, package_path_helper_1.resolvePackageJSONPath)(constants_1.WEBPACK_PLUGIN_NAME, {
469
+ const webpackPluginName = this.$projectConfigService.getValue(`webpackPackageName`, constants_1.WEBPACK_PLUGIN_NAME);
470
+ const packageJSONPath = (0, package_path_helper_1.resolvePackageJSONPath)(webpackPluginName, {
484
471
  paths: [projectData.projectDir],
485
472
  });
486
473
  if (packageJSONPath) {
@@ -498,30 +485,37 @@ class BundlerCompilerService extends events_1.EventEmitter {
498
485
  return this.$projectConfigService.getValue(`bundler`, "webpack");
499
486
  }
500
487
  copyViteBundleToNative(distOutput, destDir, specificFiles = null) {
501
- console.log(`Copying Vite bundle from "${distOutput}" to "${destDir}"`);
502
- const fs = require("fs");
488
+ if (debugLog) {
489
+ console.log(`Copying Vite bundle from "${distOutput}" to "${destDir}".`);
490
+ }
503
491
  try {
504
492
  if (specificFiles) {
505
- console.log("🔥 Selective copy - copying specific files:", specificFiles);
506
- fs.mkdirSync(destDir, { recursive: true });
493
+ if (debugLog) {
494
+ console.log("Selective copy - copying specific files:", specificFiles);
495
+ }
496
+ this.$fs.createDirectory(destDir);
507
497
  for (const file of specificFiles) {
508
498
  const srcPath = path.join(distOutput, file);
509
499
  const destPath = path.join(destDir, file);
510
- if (!fs.existsSync(srcPath))
500
+ if (!this.$fs.exists(srcPath))
511
501
  continue;
512
- fs.mkdirSync(path.dirname(destPath), { recursive: true });
513
- fs.copyFileSync(srcPath, destPath);
514
- console.log(`🔥 Copied ${file}`);
502
+ this.$fs.createDirectory(path.dirname(destPath));
503
+ this.$fs.copyFile(srcPath, destPath);
504
+ if (debugLog) {
505
+ console.log(`Copied ${file}`);
506
+ }
515
507
  }
516
508
  }
517
509
  else {
518
- console.log("🔥 Full build: Copying all files");
519
- if (fs.existsSync(destDir)) {
520
- fs.rmSync(destDir, { recursive: true, force: true });
510
+ if (debugLog) {
511
+ console.log("Full build: Copying all files.");
521
512
  }
522
- fs.mkdirSync(destDir, { recursive: true });
523
- if (fs.existsSync(distOutput)) {
524
- this.copyRecursiveSync(distOutput, destDir, fs);
513
+ if (this.$fs.exists(destDir)) {
514
+ this.$fs.deleteDirectory(destDir);
515
+ }
516
+ this.$fs.createDirectory(destDir);
517
+ if (this.$fs.exists(distOutput)) {
518
+ this.copyRecursiveSync(distOutput, destDir);
525
519
  }
526
520
  else {
527
521
  this.$logger.warn(`Vite output directory does not exist: ${distOutput}`);
@@ -532,56 +526,35 @@ class BundlerCompilerService extends events_1.EventEmitter {
532
526
  this.$logger.warn(`Failed to copy Vite bundle: ${error.message}`);
533
527
  }
534
528
  }
535
- getIncrementalFilesToCopy(emittedFiles, changedFiles) {
529
+ getIncrementalFilesToCopy(emittedFiles) {
536
530
  const filesToCopy = [];
537
531
  const bundleFiles = emittedFiles.filter((file) => !file.includes("vendor") &&
538
- (file.includes("bundle") ||
539
- file.includes("main") ||
540
- file.includes("app") ||
541
- file.endsWith(".mjs") ||
542
- file.endsWith(".js")));
532
+ (file.endsWith(".mjs") ||
533
+ file.endsWith(".js") ||
534
+ file.endsWith(".map")));
543
535
  filesToCopy.push(...bundleFiles);
544
- const sourceMapFiles = emittedFiles.filter((file) => !file.includes("vendor") && file.endsWith(".map"));
545
- filesToCopy.push(...sourceMapFiles);
546
- const hasAssetChanges = changedFiles.some((file) => file.includes("/assets/") ||
547
- file.includes("/static/") ||
548
- file.includes("/public/"));
549
- if (hasAssetChanges) {
550
- const assetFiles = emittedFiles.filter((file) => file.includes("assets/") ||
551
- file.includes("static/") ||
552
- file.includes("fonts/") ||
553
- file.includes("images/"));
536
+ const assetFiles = emittedFiles.filter((file) => file.includes("assets/") ||
537
+ file.includes("static/") ||
538
+ file.includes("fonts/") ||
539
+ file.includes("images/"));
540
+ if (assetFiles.length > 0) {
554
541
  filesToCopy.push(...assetFiles);
555
542
  }
556
543
  return [...new Set(filesToCopy)];
557
544
  }
558
- notifyHMRClients(message) {
559
- try {
560
- const WebSocket = require("ws");
561
- const ws = new WebSocket("ws://localhost:24678");
562
- ws.on("open", () => {
563
- console.log("🔥 Sending HMR notification to bridge:", message.type);
564
- ws.send(JSON.stringify(message));
565
- ws.close();
566
- });
567
- ws.on("error", () => {
568
- console.log("🔥 HMR bridge not available (this is normal without HMR)");
569
- });
570
- }
571
- catch (error) {
572
- console.log("🔥 WebSocket not available for HMR notifications");
573
- }
574
- }
575
- copyRecursiveSync(src, dest, fs) {
576
- for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
577
- const srcPath = path.join(src, entry.name);
578
- const destPath = path.join(dest, entry.name);
579
- if (entry.isDirectory()) {
580
- fs.mkdirSync(destPath, { recursive: true });
581
- this.copyRecursiveSync(srcPath, destPath, fs);
545
+ copyRecursiveSync(src, dest) {
546
+ this.$fs.createDirectory(dest);
547
+ const entries = this.$fs.readDirectory(src);
548
+ for (const name of entries) {
549
+ const srcPath = path.join(src, name);
550
+ const destPath = path.join(dest, name);
551
+ const lstats = this.$fs.getLsStats(srcPath);
552
+ if (lstats.isDirectory()) {
553
+ this.copyRecursiveSync(srcPath, destPath);
582
554
  }
583
- else if (entry.isFile() || entry.isSymbolicLink()) {
584
- fs.copyFileSync(srcPath, destPath);
555
+ else if (lstats.isFile() || lstats.isSymbolicLink()) {
556
+ this.$fs.createDirectory(path.dirname(destPath));
557
+ this.$fs.copyFile(srcPath, destPath);
585
558
  }
586
559
  }
587
560
  }
@@ -9,7 +9,7 @@ const helpers_1 = require("../common/helpers");
9
9
  const yok_1 = require("../common/yok");
10
10
  const constants = require("../constants");
11
11
  class CocoaPodsService {
12
- constructor($cocoaPodsPlatformManager, $fs, $childProcess, $errors, $logger, $config, $xcconfigService, $xcodeSelectService) {
12
+ constructor($cocoaPodsPlatformManager, $fs, $childProcess, $errors, $logger, $config, $xcconfigService, $xcodeSelectService, $projectData) {
13
13
  this.$cocoaPodsPlatformManager = $cocoaPodsPlatformManager;
14
14
  this.$fs = $fs;
15
15
  this.$childProcess = $childProcess;
@@ -18,6 +18,7 @@ class CocoaPodsService {
18
18
  this.$config = $config;
19
19
  this.$xcconfigService = $xcconfigService;
20
20
  this.$xcodeSelectService = $xcodeSelectService;
21
+ this.$projectData = $projectData;
21
22
  this.getCocoaPodsFromPodfile = _.memoize(this._getCocoaPodsFromPodfile, helpers_1.getHash);
22
23
  }
23
24
  getPodfileHeader(targetName) {
@@ -30,12 +31,17 @@ class CocoaPodsService {
30
31
  return path.join(projectRoot, constants_1.PODFILE_NAME);
31
32
  }
32
33
  async executePodInstall(projectRoot, xcodeProjPath) {
33
- this.$logger.info("Installing pods...");
34
+ var _a;
35
+ const cocoapodUseBundleExec = (_a = this.$projectData.nsConfig.ios) === null || _a === void 0 ? void 0 : _a.cocoapodUseBundleExec;
34
36
  let podTool = this.$config.USE_POD_SANDBOX ? "sandbox-pod" : "pod";
37
+ if (cocoapodUseBundleExec === true) {
38
+ podTool = `bundle exec ${podTool}`;
39
+ }
40
+ this.$logger.info(`Installing pods using "${podTool}"...`);
35
41
  const args = ["install"];
36
42
  if (process.platform === "darwin" && process.arch === "arm64") {
37
43
  const res = await this.$childProcess
38
- .exec("arch -x86_64 pod --version", null, {
44
+ .exec(`arch -x86_64 ${podTool} --version`, null, {
39
45
  showStderr: true,
40
46
  })
41
47
  .then((res) => res.stdout + " " + res.stderr)
@@ -163,7 +169,7 @@ end`.trim();
163
169
  removePodfileFromProject(moduleName, podfilePath, projectData, projectRoot) {
164
170
  if (this.$fs.exists(this.getProjectPodfilePath(projectRoot))) {
165
171
  let projectPodFileContent = this.$fs.readText(this.getProjectPodfilePath(projectRoot));
166
- const regExpToRemove = new RegExp(`${this.getPluginPodfileHeader(podfilePath)}[\\s\\S]*?${this.getPluginPodfileEnd()}`, "mg");
172
+ const regExpToRemove = new RegExp(`${this.getPluginPodfileHeader(podfilePath).replace(/\+/g, "\\+")}[\\s\\S]*?${this.getPluginPodfileEnd()}`, "mg");
167
173
  projectPodFileContent = projectPodFileContent.replace(regExpToRemove, "");
168
174
  projectPodFileContent = this.removePostInstallHook(moduleName, projectPodFileContent);
169
175
  projectPodFileContent =
@@ -15,7 +15,7 @@ class DeviceInstallAppService {
15
15
  this.$projectDataService = $projectDataService;
16
16
  this.$platformsDataService = $platformsDataService;
17
17
  }
18
- async installOnDevice(device, buildData, packageFile) {
18
+ async installOnDevice(device, buildData) {
19
19
  this.$logger.info(`Installing on device ${device.deviceInfo.identifier}...`);
20
20
  const platform = device.deviceInfo.platform.toLowerCase();
21
21
  const projectData = this.$projectDataService.getProjectData(buildData.projectDir);
@@ -25,8 +25,30 @@ class DeviceInstallAppService {
25
25
  device,
26
26
  projectDir: projectData.projectDir,
27
27
  });
28
+ const buildOutputOptions = platformData.getValidBuildOutputData(buildData);
29
+ const outputPath = buildData.outputPath || platformData.getBuildOutputPath(buildData);
30
+ const packages = await this.$buildArtifactsService.getAllAppPackages(outputPath, buildOutputOptions);
31
+ let packageFile;
32
+ if (packages.length === 1) {
33
+ packageFile = packages.at(0).packageName;
34
+ }
35
+ else if (device.deviceInfo.abis) {
36
+ packages.find(({ packageName }) => {
37
+ if (device.deviceInfo.abis.some((abi) => packageName.includes(abi))) {
38
+ packageFile = packageName;
39
+ return true;
40
+ }
41
+ });
42
+ }
43
+ else {
44
+ const universalPackage = packages.find((p) => p.packageName.includes("universal"));
45
+ if (universalPackage) {
46
+ packageFile = universalPackage.packageName;
47
+ }
48
+ }
28
49
  if (!packageFile) {
29
- packageFile = await this.$buildArtifactsService.getLatestAppPackagePath(platformData, buildData);
50
+ this.$logger.error(`Could not find a package corresponding to the device with identifier '${device.deviceInfo.identifier}'.`);
51
+ return;
30
52
  }
31
53
  await platformData.platformProjectService.cleanDeviceTempFolder(device.deviceInfo.identifier, projectData);
32
54
  const appIdentifier = projectData.projectIdentifiers[platform];
@@ -41,12 +63,12 @@ class DeviceInstallAppService {
41
63
  if (!buildData.release) {
42
64
  await this.$buildInfoFileService.saveDeviceBuildInfo(device, projectData, outputFilePath);
43
65
  }
44
- this.$logger.info(`Successfully installed on device with identifier '${device.deviceInfo.identifier}'.`);
66
+ this.$logger.info(`Successfully installed on device with identifier '${device.deviceInfo.identifier} using package ${packageFile}'.`);
45
67
  }
46
- async installOnDeviceIfNeeded(device, buildData, packageFile) {
68
+ async installOnDeviceIfNeeded(device, buildData) {
47
69
  const shouldInstall = await this.shouldInstall(device, buildData);
48
70
  if (shouldInstall) {
49
- await this.installOnDevice(device, buildData, packageFile);
71
+ await this.installOnDevice(device, buildData);
50
72
  }
51
73
  }
52
74
  async shouldInstall(device, buildData) {
@@ -138,7 +138,7 @@ class ExtensibilityService {
138
138
  return {
139
139
  extensionName,
140
140
  registeredCommandName: currentCommand,
141
- installationMessage: `The command ${beautifiedCommandName} is registered in extension ${extensionName}. You can install it by executing 'tns extension install ${extensionName}'`,
141
+ installationMessage: `The command ${beautifiedCommandName} is registered in extension ${extensionName}. You can install it by executing 'ns extension install ${extensionName}'`,
142
142
  };
143
143
  }
144
144
  copyOfFullArgs.splice(-1, 1);
@@ -27,7 +27,7 @@ class XcodebuildArgsService {
27
27
  let destination = "generic/platform=iOS Simulator";
28
28
  let isvisionOS = this.$devicePlatformsConstants.isvisionOS(buildConfig.platform);
29
29
  if (isvisionOS) {
30
- destination = "platform=visionOS Simulator";
30
+ destination = "generic/platform=visionOS Simulator";
31
31
  if (buildConfig._device) {
32
32
  destination += `,id=${buildConfig._device.deviceInfo.identifier}`;
33
33
  }
@@ -40,7 +40,9 @@ class XcodebuildArgsService {
40
40
  "-configuration",
41
41
  buildConfig.release ? constants_1.Configurations.Release : constants_1.Configurations.Debug,
42
42
  ])
43
- .concat(this.getBuildCommonArgs(platformData, projectData, isvisionOS ? ios_project_service_1.VisionSimulatorPlatformSdkName : ios_project_service_1.SimulatorPlatformSdkName))
43
+ .concat(this.getBuildCommonArgs(platformData, projectData, isvisionOS
44
+ ? ios_project_service_1.VisionSimulatorPlatformSdkName
45
+ : ios_project_service_1.SimulatorPlatformSdkName))
44
46
  .concat(this.getBuildLoggingArgs())
45
47
  .concat(this.getXcodeProjectArgs(platformData, projectData));
46
48
  return args;
@@ -51,7 +53,7 @@ class XcodebuildArgsService {
51
53
  let destination = "generic/platform=iOS";
52
54
  let isvisionOS = this.$devicePlatformsConstants.isvisionOS(buildConfig.platform);
53
55
  if (isvisionOS) {
54
- destination = "platform=visionOS";
56
+ destination = "generic/platform=visionOS";
55
57
  if (buildConfig._device) {
56
58
  destination += `,id=${buildConfig._device.deviceInfo.identifier}`;
57
59
  }
@@ -68,14 +70,14 @@ class XcodebuildArgsService {
68
70
  ]
69
71
  .concat(this.getXcodeProjectArgs(platformData, projectData))
70
72
  .concat(architectures)
71
- .concat(this.getBuildCommonArgs(platformData, projectData, ios_project_service_1.DevicePlatformSdkName))
73
+ .concat(this.getBuildCommonArgs(platformData, projectData, isvisionOS ? ios_project_service_1.VisionDevicePlatformSdkName : ios_project_service_1.DevicePlatformSdkName))
72
74
  .concat(this.getBuildLoggingArgs());
73
75
  return args;
74
76
  }
75
77
  async getArchitecturesArgs(buildConfig) {
76
78
  const args = [];
77
79
  if (this.$devicePlatformsConstants.isvisionOS(buildConfig.platform)) {
78
- args.push("ONLY_ACTIVE_ARCH=YES");
80
+ args.push("ONLY_ACTIVE_ARCH=YES", "EXCLUDED_ARCHS=x86_64");
79
81
  return args;
80
82
  }
81
83
  const devicesArchitectures = buildConfig.buildForDevice
@@ -622,9 +622,12 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
622
622
  return this.getAllNativeLibrariesForPlugin(pluginData, IOSProjectService.IOS_PLATFORM_NAME, filterCallback);
623
623
  }
624
624
  validateFramework(libraryPath) {
625
- const infoPlistPath = path.join(libraryPath, constants.INFO_PLIST_FILE_NAME);
625
+ let infoPlistPath = path.join(libraryPath, constants.INFO_PLIST_FILE_NAME);
626
626
  if (!this.$fs.exists(infoPlistPath)) {
627
- this.$errors.fail("The bundle at %s does not contain an Info.plist file.", libraryPath);
627
+ infoPlistPath = path.join(libraryPath, "Resources", constants.INFO_PLIST_FILE_NAME);
628
+ if (!this.$fs.exists(infoPlistPath)) {
629
+ this.$errors.fail("The bundle at %s does not contain an Info.plist file.", libraryPath);
630
+ }
628
631
  }
629
632
  const plistJson = this.$plistParser.parseFileSync(infoPlistPath);
630
633
  const packageType = plistJson["CFBundlePackageType"];
@@ -213,7 +213,7 @@ class PluginsService {
213
213
  ensureValidProductionPluginsForIOS(productionDependencies, projectDir, platform) {
214
214
  const dependenciesWithFrameworks = [];
215
215
  _.each(productionDependencies, (d) => {
216
- const pathToPlatforms = path.join(d.directory, "platforms", platform);
216
+ const pathToPlatforms = path.join(d.directory, constants.PLATFORMS_DIR_NAME, platform);
217
217
  if (this.$fs.exists(pathToPlatforms)) {
218
218
  const contents = this.$fs.readDirectory(pathToPlatforms);
219
219
  _.each(contents, (file) => {
@@ -296,12 +296,13 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
296
296
  if (this.$mobileHelper.isvisionOSPlatform(platform)) {
297
297
  platform = "ios";
298
298
  }
299
- return path.join(pluginData.fullPath, "platforms", platform.toLowerCase());
299
+ return path.join(pluginData.fullPath, constants.PLATFORMS_DIR_NAME, platform.toLowerCase());
300
300
  };
301
301
  const data = cacheData.nativescript;
302
302
  if (pluginData.isPlugin) {
303
303
  pluginData.platformsData = data.platforms;
304
304
  pluginData.pluginVariables = data.variables;
305
+ pluginData.nativescript = data;
305
306
  }
306
307
  return pluginData;
307
308
  }
@@ -18,10 +18,11 @@ const yok_1 = require("../common/yok");
18
18
  const semver = require("semver");
19
19
  const package_path_helper_1 = require("../helpers/package-path-helper");
20
20
  class ProjectDataService {
21
- constructor($fs, $staticConfig, $logger, $devicePlatformsConstants, $androidResourcesMigrationService, $injector) {
21
+ constructor($fs, $staticConfig, $logger, $projectData, $devicePlatformsConstants, $androidResourcesMigrationService, $injector) {
22
22
  this.$fs = $fs;
23
23
  this.$staticConfig = $staticConfig;
24
24
  this.$logger = $logger;
25
+ this.$projectData = $projectData;
25
26
  this.$devicePlatformsConstants = $devicePlatformsConstants;
26
27
  this.$androidResourcesMigrationService = $androidResourcesMigrationService;
27
28
  this.$injector = $injector;
@@ -350,24 +351,21 @@ class ProjectDataService {
350
351
  return this.getInstalledRuntimePackage(projectDir, platform);
351
352
  }
352
353
  getInstalledRuntimePackage(projectDir, platform) {
354
+ var _a, _b, _c, _d;
355
+ let packageName = [];
356
+ if (platform === "ios") {
357
+ packageName.push((_a = this.$projectData.nsConfig.ios) === null || _a === void 0 ? void 0 : _a.runtimePackageName, constants.SCOPED_IOS_RUNTIME_NAME, constants.TNS_IOS_RUNTIME_NAME);
358
+ }
359
+ else if (platform === "android") {
360
+ packageName.push((_b = this.$projectData.nsConfig.android) === null || _b === void 0 ? void 0 : _b.runtimePackageName, constants.SCOPED_ANDROID_RUNTIME_NAME, constants.TNS_IOS_RUNTIME_NAME);
361
+ }
362
+ else if (platform === "visionos") {
363
+ packageName.push(constants.SCOPED_VISIONOS_RUNTIME_NAME);
364
+ }
353
365
  const runtimePackage = this.$pluginsService
354
366
  .getDependenciesFromPackageJson(projectDir)
355
367
  .devDependencies.find((d) => {
356
- if (platform === "ios") {
357
- return [
358
- constants.SCOPED_IOS_RUNTIME_NAME,
359
- constants.TNS_IOS_RUNTIME_NAME,
360
- ].includes(d.name);
361
- }
362
- else if (platform === "android") {
363
- return [
364
- constants.SCOPED_ANDROID_RUNTIME_NAME,
365
- constants.TNS_ANDROID_RUNTIME_NAME,
366
- ].includes(d.name);
367
- }
368
- else if (platform === "visionos") {
369
- return d.name === constants.SCOPED_VISIONOS_RUNTIME_NAME;
370
- }
368
+ return packageName.includes(d.name);
371
369
  });
372
370
  if (runtimePackage) {
373
371
  const coerced = semver.coerce(runtimePackage.version);
@@ -398,13 +396,13 @@ class ProjectDataService {
398
396
  this.$logger.trace("Could not find an installed runtime, falling back to default runtimes");
399
397
  if (platform === "ios") {
400
398
  return {
401
- name: constants.SCOPED_IOS_RUNTIME_NAME,
399
+ name: ((_c = this.$projectData.nsConfig.ios) === null || _c === void 0 ? void 0 : _c.runtimePackageName) || constants.SCOPED_IOS_RUNTIME_NAME,
402
400
  version: null,
403
401
  };
404
402
  }
405
403
  else if (platform === "android") {
406
404
  return {
407
- name: constants.SCOPED_ANDROID_RUNTIME_NAME,
405
+ name: ((_d = this.$projectData.nsConfig.android) === null || _d === void 0 ? void 0 : _d.runtimePackageName) || constants.SCOPED_ANDROID_RUNTIME_NAME,
408
406
  version: null,
409
407
  };
410
408
  }
@@ -51,8 +51,8 @@ class TimelineProfilerService {
51
51
  var _a;
52
52
  const trace = this.toTrace(line.trim());
53
53
  if (trace) {
54
- (_a = deviceTimeline.startPoint) !== null && _a !== void 0 ? _a : (deviceTimeline.startPoint = trace.from);
55
- deviceTimeline.timeline.push(trace);
54
+ (_a = deviceTimeline.startPoint) !== null && _a !== void 0 ? _a : (deviceTimeline.startPoint = trace[0].ts);
55
+ deviceTimeline.timeline.push(...trace);
56
56
  }
57
57
  });
58
58
  }
@@ -60,26 +60,34 @@ class TimelineProfilerService {
60
60
  return this.$projectConfigService.getValue("profiling") === "timeline";
61
61
  }
62
62
  toTrace(text) {
63
- var _a, _b;
63
+ var _a, _b, _c;
64
64
  const result = text.match(TIMELINE_LOG_RE);
65
65
  if (!result) {
66
66
  return;
67
67
  }
68
68
  const trace = {
69
- domain: (_a = result[2]) === null || _a === void 0 ? void 0 : _a.trim().replace(":", ""),
69
+ domain: (_a = result[2]) === null || _a === void 0 ? void 0 : _a.trim().replace(":", ".").toLowerCase(),
70
70
  name: result[3].trim(),
71
71
  from: parseFloat(result[4]),
72
72
  to: parseFloat(result[5]),
73
73
  };
74
- return {
75
- pid: 1,
76
- tid: 1,
77
- ts: trace.from * 1000,
78
- dur: (trace.to - trace.from) * 1000,
79
- name: trace.name,
80
- cat: (_b = trace.domain) !== null && _b !== void 0 ? _b : "default",
81
- ph: ChromeTraceEventPhase.COMPLETE,
82
- };
74
+ return [{
75
+ args: {},
76
+ pid: 1,
77
+ tid: 1,
78
+ ts: trace.from * 1000,
79
+ name: trace.name,
80
+ cat: (_b = trace.domain) !== null && _b !== void 0 ? _b : "default",
81
+ ph: ChromeTraceEventPhase.BEGIN,
82
+ }, {
83
+ args: {},
84
+ pid: 1,
85
+ tid: 1,
86
+ ts: trace.to * 1000,
87
+ name: trace.name,
88
+ cat: (_c = trace.domain) !== null && _c !== void 0 ? _c : "default",
89
+ ph: ChromeTraceEventPhase.END,
90
+ }];
83
91
  }
84
92
  writeTimelines() {
85
93
  this.$logger.info("\n\nWriting timeline data to json...");
@@ -43,7 +43,8 @@ class VersionsService {
43
43
  const versionInformations = [];
44
44
  if (this.projectData) {
45
45
  const nodeModulesPath = path.join(this.projectData.projectDir, constants.NODE_MODULES_FOLDER_NAME);
46
- const scopedPackagePath = path.join(nodeModulesPath, constants.SCOPED_TNS_CORE_MODULES);
46
+ const packageName = this.projectData.nsConfig.corePackageName || constants.SCOPED_TNS_CORE_MODULES;
47
+ const scopedPackagePath = path.join(nodeModulesPath, packageName);
47
48
  const tnsCoreModulesPath = path.join(nodeModulesPath, constants.TNS_CORE_MODULES_NAME);
48
49
  const dependsOnNonScopedPackage = !!this.projectData.dependencies[constants.TNS_CORE_MODULES_NAME];
49
50
  const dependsOnScopedPackage = !!this.projectData.dependencies[constants.SCOPED_TNS_CORE_MODULES];