nativescript 8.6.2-embed.0 → 8.6.2-vision.8

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 (47) hide show
  1. package/lib/bootstrap.js +4 -0
  2. package/lib/commands/add-platform.js +1 -1
  3. package/lib/commands/create-project.js +69 -9
  4. package/lib/commands/run.js +21 -4
  5. package/lib/common/definitions/mobile.d.ts +11 -0
  6. package/lib/common/mobile/device-platforms-constants.js +10 -0
  7. package/lib/common/mobile/ios/simulator/ios-emulator-services.js +8 -1
  8. package/lib/common/mobile/log-filter.js +3 -1
  9. package/lib/common/mobile/mobile-core/devices-service.js +18 -5
  10. package/lib/common/mobile/mobile-core/ios-device-discovery.js +7 -2
  11. package/lib/common/mobile/mobile-helper.js +12 -0
  12. package/lib/constants.js +11 -4
  13. package/lib/controllers/prepare-controller.js +1 -2
  14. package/lib/data/build-data.js +1 -2
  15. package/lib/data/prepare-data.js +0 -1
  16. package/lib/declarations.d.ts +9 -9
  17. package/lib/definitions/build.d.ts +1 -0
  18. package/lib/definitions/platform.d.ts +0 -1
  19. package/lib/definitions/project.d.ts +5 -0
  20. package/lib/device-path-provider.js +2 -2
  21. package/lib/helpers/livesync-command-helper.js +3 -3
  22. package/lib/helpers/platform-command-helper.js +3 -7
  23. package/lib/options.js +5 -1
  24. package/lib/package-installation-manager.js +15 -3
  25. package/lib/project-data.js +6 -0
  26. package/lib/resolvers/livesync-service-resolver.js +1 -1
  27. package/lib/services/android-project-service.js +4 -7
  28. package/lib/services/assets-generation/assets-generation-service.js +1 -8
  29. package/lib/services/build-data-service.js +1 -1
  30. package/lib/services/ios/spm-service.js +7 -7
  31. package/lib/services/ios/xcodebuild-args-service.js +16 -5
  32. package/lib/services/ios-project-service.js +43 -36
  33. package/lib/services/platform/add-platform-service.js +2 -8
  34. package/lib/services/platform/prepare-native-platform-service.js +3 -6
  35. package/lib/services/platforms-data-service.js +6 -1
  36. package/lib/services/plugins-service.js +6 -1
  37. package/lib/services/prepare-data-service.js +1 -1
  38. package/lib/services/project-changes-service.js +6 -1
  39. package/lib/services/project-data-service.js +9 -0
  40. package/lib/services/webpack/webpack-compiler-service.js +2 -9
  41. package/lib/services/xcproj-service.js +0 -12
  42. package/package.json +6 -6
  43. package/vendor/gradle-plugin/build.gradle +6 -21
  44. package/vendor/gradle-plugin/settings.gradle +3 -13
  45. package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +0 -15
  46. package/node_modules/rimraf/CHANGELOG.md +0 -65
  47. package/node_modules/stringify-package/CHANGELOG.md +0 -16
@@ -24,7 +24,7 @@ class DevicePathProvider {
24
24
  getDeviceProjectRootPath(device, options) {
25
25
  return __awaiter(this, void 0, void 0, function* () {
26
26
  let projectRoot = "";
27
- if (this.$mobileHelper.isiOSPlatform(device.deviceInfo.platform)) {
27
+ if (this.$mobileHelper.isApplePlatfrom(device.deviceInfo.platform)) {
28
28
  projectRoot = device.isEmulator
29
29
  ? yield this.$iOSSimResolver.iOSSim.getApplicationPath(device.deviceInfo.identifier, options.appIdentifier)
30
30
  : constants_2.LiveSyncPaths.IOS_DEVICE_PROJECT_ROOT_PATH;
@@ -50,7 +50,7 @@ class DevicePathProvider {
50
50
  });
51
51
  }
52
52
  getDeviceSyncZipPath(device) {
53
- return this.$mobileHelper.isiOSPlatform(device.deviceInfo.platform) &&
53
+ return this.$mobileHelper.isApplePlatfrom(device.deviceInfo.platform) &&
54
54
  !device.isEmulator
55
55
  ? constants_2.LiveSyncPaths.IOS_DEVICE_SYNC_ZIP_PATH
56
56
  : undefined;
@@ -76,7 +76,7 @@ class LiveSyncCommandHelper {
76
76
  });
77
77
  const buildData = this.$buildDataService.getBuildData(this.$projectData.projectDir, d.deviceInfo.platform, Object.assign(Object.assign({}, this.$options.argv), { outputPath, buildForDevice: !d.isEmulator, watch: !this.$options.release && this.$options.watch, nativePrepare: {
78
78
  forceRebuildNativeApp: additionalOptions.forceRebuildNativeApp,
79
- } }));
79
+ }, _device: d }));
80
80
  this.$androidBundleValidatorHelper.validateDeviceApiLevel(d, buildData);
81
81
  const buildAction = additionalOptions && additionalOptions.buildPlatform
82
82
  ? additionalOptions.buildPlatform.bind(additionalOptions.buildPlatform, d.deviceInfo.platform, buildData, this.$projectData)
@@ -167,12 +167,12 @@ class LiveSyncCommandHelper {
167
167
  this.$errors.fail("Unable to find applicable devices to execute operation and unable to start emulator when platform is not specified.");
168
168
  }
169
169
  }
170
- const workingWithiOSDevices = !platform || this.$mobileHelper.isiOSPlatform(platform);
170
+ const workingWithAppleDevices = !platform || this.$mobileHelper.isApplePlatfrom(platform);
171
171
  const shouldKeepProcessAlive = this.$options.watch || !this.$options.justlaunch;
172
172
  if (shouldKeepProcessAlive) {
173
173
  this.$analyticsService.setShouldDispose(false);
174
174
  this.$cleanupService.setShouldDispose(false);
175
- if (workingWithiOSDevices) {
175
+ if (workingWithAppleDevices) {
176
176
  this.$iosDeviceOperations.setShouldDispose(false);
177
177
  this.$iOSSimulatorLogProvider.setShouldDispose(false);
178
178
  }
@@ -16,12 +16,11 @@ const _ = require("lodash");
16
16
  const constants = require("../constants");
17
17
  const yok_1 = require("../common/yok");
18
18
  class PlatformCommandHelper {
19
- constructor($platformController, $fs, $errors, $logger, $options, $mobileHelper, $packageInstallationManager, $pacoteService, $platformsDataService, $platformValidationService, $projectChangesService, $projectDataService, $tempService) {
19
+ constructor($platformController, $fs, $errors, $logger, $mobileHelper, $packageInstallationManager, $pacoteService, $platformsDataService, $platformValidationService, $projectChangesService, $projectDataService, $tempService) {
20
20
  this.$platformController = $platformController;
21
21
  this.$fs = $fs;
22
22
  this.$errors = $errors;
23
23
  this.$logger = $logger;
24
- this.$options = $options;
25
24
  this.$mobileHelper = $mobileHelper;
26
25
  this.$packageInstallationManager = $packageInstallationManager;
27
26
  this.$pacoteService = $pacoteService;
@@ -31,7 +30,7 @@ class PlatformCommandHelper {
31
30
  this.$projectDataService = $projectDataService;
32
31
  this.$tempService = $tempService;
33
32
  }
34
- addPlatforms(platforms, projectData, frameworkPath, nativeHost) {
33
+ addPlatforms(platforms, projectData, frameworkPath) {
35
34
  return __awaiter(this, void 0, void 0, function* () {
36
35
  const platformsDir = projectData.platformsDir;
37
36
  this.$fs.ensureDirectoryExists(platformsDir);
@@ -46,7 +45,6 @@ class PlatformCommandHelper {
46
45
  projectDir: projectData.projectDir,
47
46
  platform,
48
47
  frameworkPath,
49
- nativeHost,
50
48
  });
51
49
  }
52
50
  });
@@ -74,9 +72,7 @@ class PlatformCommandHelper {
74
72
  errorMessage = err.message;
75
73
  }
76
74
  try {
77
- const platformDir = this.$options.nativeHost
78
- ? this.$options.nativeHost
79
- : path.join(projectData.platformsDir, platform.toLowerCase());
75
+ const platformDir = path.join(projectData.platformsDir, platform.toLowerCase());
80
76
  this.$fs.deleteDirectory(platformDir);
81
77
  yield this.$packageInstallationManager.uninstall(platformData.frameworkPackageName, projectData.projectDir);
82
78
  this.$logger.info(`Platform ${platform} successfully removed.`);
package/lib/options.js CHANGED
@@ -112,6 +112,11 @@ class Options {
112
112
  vue: { type: "boolean", hasSensitiveValue: false },
113
113
  vuejs: { type: "boolean", hasSensitiveValue: false },
114
114
  svelte: { type: "boolean", hasSensitiveValue: false },
115
+ "vision-ng": { type: "boolean", hasSensitiveValue: false },
116
+ "vision-react": { type: "boolean", hasSensitiveValue: false },
117
+ "vision-solid": { type: "boolean", hasSensitiveValue: false },
118
+ "vision-svelte": { type: "boolean", hasSensitiveValue: false },
119
+ "vision-vue": { type: "boolean", hasSensitiveValue: false },
115
120
  tsc: { type: "boolean", hasSensitiveValue: false },
116
121
  ts: { type: "boolean", hasSensitiveValue: false },
117
122
  typescript: { type: "boolean", hasSensitiveValue: false },
@@ -200,7 +205,6 @@ class Options {
200
205
  },
201
206
  gradlePath: { type: "string", hasSensitiveValue: false },
202
207
  gradleArgs: { type: "string", hasSensitiveValue: false },
203
- nativeHost: { type: "string", hasSensitiveValue: false },
204
208
  aab: { type: "boolean", hasSensitiveValue: false },
205
209
  performance: { type: "object", hasSensitiveValue: true },
206
210
  appleApplicationSpecificPassword: {
@@ -49,13 +49,25 @@ class PackageInstallationManager {
49
49
  });
50
50
  }
51
51
  getMaxSatisfyingVersion(packageName, versionRange) {
52
- var _a, _b;
52
+ var _a;
53
53
  return __awaiter(this, void 0, void 0, function* () {
54
54
  const data = yield this.$packageManager.view(packageName, {
55
55
  versions: true,
56
56
  });
57
- return (_b = semver
58
- .maxSatisfying((_a = data === null || data === void 0 ? void 0 : data.versions) !== null && _a !== void 0 ? _a : data, versionRange)) === null || _b === void 0 ? void 0 : _b.toString();
57
+ let versions;
58
+ if (typeof data === "string") {
59
+ versions = [data];
60
+ }
61
+ else if (data === null || data === void 0 ? void 0 : data.versions) {
62
+ versions = data.versions;
63
+ }
64
+ else {
65
+ versions = data;
66
+ }
67
+ if (!versions || !Array.isArray(versions)) {
68
+ return null;
69
+ }
70
+ return (_a = semver.maxSatisfying(versions, versionRange)) === null || _a === void 0 ? void 0 : _a.toString();
59
71
  });
60
72
  }
61
73
  getMaxSatisfyingVersionSafe(packageName, versionIdentifier) {
@@ -23,6 +23,7 @@ class ProjectData {
23
23
  this.warnProjectId();
24
24
  this.projectIdentifiers.ios = identifier;
25
25
  this.projectIdentifiers.android = identifier;
26
+ this.projectIdentifiers.visionos = identifier;
26
27
  }
27
28
  constructor($fs, $errors, $projectHelper, $staticConfig, $options, $logger, $injector, $androidResourcesMigrationService, $devicePlatformsConstants) {
28
29
  this.$fs = $fs;
@@ -156,11 +157,13 @@ class ProjectData {
156
157
  return {
157
158
  ios: "",
158
159
  android: "",
160
+ visionos: "",
159
161
  };
160
162
  }
161
163
  const identifier = {
162
164
  ios: config.id,
163
165
  android: config.id,
166
+ visionos: config.id,
164
167
  };
165
168
  if (config.ios && config.ios.id) {
166
169
  identifier.ios = config.ios.id;
@@ -168,6 +171,9 @@ class ProjectData {
168
171
  if (config.android && config.android.id) {
169
172
  identifier.android = config.android.id;
170
173
  }
174
+ if (config.visionos && config.visionos.id) {
175
+ identifier.visionos = config.visionos.id;
176
+ }
171
177
  return identifier;
172
178
  }
173
179
  getProjectType() {
@@ -9,7 +9,7 @@ class LiveSyncServiceResolver {
9
9
  this.$mobileHelper = $mobileHelper;
10
10
  }
11
11
  resolveLiveSyncService(platform) {
12
- if (this.$mobileHelper.isiOSPlatform(platform)) {
12
+ if (this.$mobileHelper.isApplePlatfrom(platform)) {
13
13
  return this.$injector.resolve("iOSLiveSyncService");
14
14
  }
15
15
  else if (this.$mobileHelper.isAndroidPlatform(platform)) {
@@ -69,9 +69,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
69
69
  throw new Error("First call of getPlatformData without providing projectData.");
70
70
  }
71
71
  if (projectData && projectData.platformsDir) {
72
- const projectRoot = this.$options.nativeHost
73
- ? this.$options.nativeHost
74
- : path.join(projectData.platformsDir, AndroidProjectService.ANDROID_PLATFORM_NAME);
72
+ const projectRoot = path.join(projectData.platformsDir, AndroidProjectService.ANDROID_PLATFORM_NAME);
75
73
  const appDestinationDirectoryArr = [
76
74
  projectRoot,
77
75
  constants.APP_FOLDER_NAME,
@@ -249,7 +247,8 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
249
247
  });
250
248
  }
251
249
  interpolateConfigurationFile(projectData) {
252
- const manifestPath = this.getPlatformData(projectData).configurationFilePath;
250
+ const manifestPath = this.getPlatformData(projectData)
251
+ .configurationFilePath;
253
252
  shell.sed("-i", /__PACKAGE__/, projectData.projectIdentifiers.android, manifestPath);
254
253
  }
255
254
  getProjectNameFromId(projectData) {
@@ -392,9 +391,7 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
392
391
  return _.values(depsDictionary);
393
392
  }
394
393
  provideDependenciesJson(projectData, dependencies) {
395
- const platformDir = this.$options.nativeHost
396
- ? this.$options.nativeHost
397
- : path.join(projectData.platformsDir, AndroidProjectService.ANDROID_PLATFORM_NAME);
394
+ const platformDir = path.join(projectData.platformsDir, AndroidProjectService.ANDROID_PLATFORM_NAME);
398
395
  const dependenciesJsonPath = path.join(platformDir, constants.DEPENDENCIES_JSON_NAME);
399
396
  let nativeDependencyData = dependencies.filter(AndroidProjectService.isNativeAndroidDependency);
400
397
  let nativeDependencies = nativeDependencyData.map(({ name, directory, dependencies }) => {
@@ -30,17 +30,13 @@ class AssetsGenerationService {
30
30
  splash: ["splashBackgrounds", "splashCenterImages", "splashImages"],
31
31
  };
32
32
  }
33
- constructor($logger, $projectDataService, $fs, $options) {
33
+ constructor($logger, $projectDataService, $fs) {
34
34
  this.$logger = $logger;
35
35
  this.$projectDataService = $projectDataService;
36
36
  this.$fs = $fs;
37
- this.$options = $options;
38
37
  }
39
38
  generateIcons(resourceGenerationData) {
40
39
  return __awaiter(this, void 0, void 0, function* () {
41
- if (this.$options.nativeHost) {
42
- return;
43
- }
44
40
  this.$logger.info("Generating icons ...");
45
41
  yield this.generateImagesForDefinitions(resourceGenerationData, this.propertiesToEnumerate.icon);
46
42
  this.$logger.info("Icons generation completed.");
@@ -48,9 +44,6 @@ class AssetsGenerationService {
48
44
  }
49
45
  generateSplashScreens(splashesGenerationData) {
50
46
  return __awaiter(this, void 0, void 0, function* () {
51
- if (this.$options.nativeHost) {
52
- return;
53
- }
54
47
  this.$logger.info("Generating splash screens ...");
55
48
  yield this.generateImagesForDefinitions(splashesGenerationData, this.propertiesToEnumerate.splash);
56
49
  this.$logger.info("Splash screens generation completed.");
@@ -8,7 +8,7 @@ class BuildDataService {
8
8
  this.$mobileHelper = $mobileHelper;
9
9
  }
10
10
  getBuildData(projectDir, platform, data) {
11
- if (this.$mobileHelper.isiOSPlatform(platform)) {
11
+ if (this.$mobileHelper.isApplePlatfrom(platform)) {
12
12
  return new build_data_1.IOSBuildData(projectDir, platform, data);
13
13
  }
14
14
  else if (this.$mobileHelper.isAndroidPlatform(platform)) {
@@ -20,17 +20,14 @@ class SPMService {
20
20
  this.$xcodebuildCommandService = $xcodebuildCommandService;
21
21
  this.$xcodebuildArgsService = $xcodebuildArgsService;
22
22
  }
23
- getSPMPackages(projectData) {
24
- const spmPackages = this.$projectConfigService.getValue("ios.SPMPackages", []);
23
+ getSPMPackages(projectData, platform) {
24
+ const spmPackages = this.$projectConfigService.getValue(`${platform}.SPMPackages`, []);
25
25
  return spmPackages;
26
26
  }
27
- hasSPMPackages(projectData) {
28
- return this.getSPMPackages(projectData).length > 0;
29
- }
30
27
  applySPMPackages(platformData, projectData) {
31
28
  return __awaiter(this, void 0, void 0, function* () {
32
29
  try {
33
- const spmPackages = this.getSPMPackages(projectData);
30
+ const spmPackages = this.getSPMPackages(projectData, platformData.platformNameLowerCase);
34
31
  if (!spmPackages.length) {
35
32
  this.$logger.trace("SPM: no SPM packages to apply.");
36
33
  return;
@@ -39,10 +36,13 @@ class SPMService {
39
36
  ios: {
40
37
  path: ".",
41
38
  },
39
+ visionos: {
40
+ path: ".",
41
+ },
42
42
  enableAndroid: false,
43
43
  });
44
44
  yield project.load();
45
- if (!project.ios) {
45
+ if (platformData.platformNameLowerCase === "ios" && !project.ios) {
46
46
  this.$logger.trace("SPM: no iOS project found via trapeze.");
47
47
  return;
48
48
  }
@@ -15,8 +15,7 @@ const constants = require("../../constants");
15
15
  const constants_1 = require("../../common/constants");
16
16
  const yok_1 = require("../../common/yok");
17
17
  const _ = require("lodash");
18
- const DevicePlatformSdkName = "iphoneos";
19
- const SimulatorPlatformSdkName = "iphonesimulator";
18
+ const ios_project_service_1 = require("../ios-project-service");
20
19
  class XcodebuildArgsService {
21
20
  constructor($devicePlatformsConstants, $devicesService, $fs, $iOSWatchAppService, $logger) {
22
21
  this.$devicePlatformsConstants = $devicePlatformsConstants;
@@ -34,15 +33,23 @@ class XcodebuildArgsService {
34
33
  else {
35
34
  args = args.concat(["CODE_SIGN_IDENTITY="]);
36
35
  }
36
+ let destination = "generic/platform=iOS Simulator";
37
+ let isvisionOS = this.$devicePlatformsConstants.isvisionOS(buildConfig.platform);
38
+ if (isvisionOS) {
39
+ destination = "platform=visionOS Simulator";
40
+ if (buildConfig._device) {
41
+ destination += `,id=${buildConfig._device.deviceInfo.identifier}`;
42
+ }
43
+ }
37
44
  args = args
38
45
  .concat([
39
46
  "-destination",
40
- "generic/platform=iOS Simulator",
47
+ destination,
41
48
  "build",
42
49
  "-configuration",
43
50
  buildConfig.release ? constants_1.Configurations.Release : constants_1.Configurations.Debug,
44
51
  ])
45
- .concat(this.getBuildCommonArgs(platformData, projectData, SimulatorPlatformSdkName))
52
+ .concat(this.getBuildCommonArgs(platformData, projectData, isvisionOS ? ios_project_service_1.VisionSimulatorPlatformSdkName : ios_project_service_1.SimulatorPlatformSdkName))
46
53
  .concat(this.getBuildLoggingArgs())
47
54
  .concat(this.getXcodeProjectArgs(platformData.projectRoot, projectData));
48
55
  return args;
@@ -64,7 +71,7 @@ class XcodebuildArgsService {
64
71
  ]
65
72
  .concat(this.getXcodeProjectArgs(platformData.projectRoot, projectData))
66
73
  .concat(architectures)
67
- .concat(this.getBuildCommonArgs(platformData, projectData, DevicePlatformSdkName))
74
+ .concat(this.getBuildCommonArgs(platformData, projectData, ios_project_service_1.DevicePlatformSdkName))
68
75
  .concat(this.getBuildLoggingArgs());
69
76
  return args;
70
77
  });
@@ -72,6 +79,10 @@ class XcodebuildArgsService {
72
79
  getArchitecturesArgs(buildConfig) {
73
80
  return __awaiter(this, void 0, void 0, function* () {
74
81
  const args = [];
82
+ if (this.$devicePlatformsConstants.isvisionOS(buildConfig.platform)) {
83
+ args.push("ONLY_ACTIVE_ARCH=YES");
84
+ return args;
85
+ }
75
86
  const devicesArchitectures = buildConfig.buildForDevice
76
87
  ? yield this.getArchitecturesFromConnectedDevices(buildConfig)
77
88
  : [];
@@ -15,7 +15,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
15
15
  });
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.IOSProjectService = void 0;
18
+ exports.IOSProjectService = exports.VisionSimulatorPlatformSdkName = exports.SimulatorPlatformSdkName = exports.DevicePlatformSdkName = void 0;
19
19
  const path = require("path");
20
20
  const shell = require("shelljs");
21
21
  const _ = require("lodash");
@@ -30,20 +30,35 @@ const plist = require("plist");
30
30
  const constants_2 = require("../constants");
31
31
  const helpers_2 = require("../common/helpers");
32
32
  const yok_1 = require("../common/yok");
33
- const DevicePlatformSdkName = "iphoneos";
34
- const SimulatorPlatformSdkName = "iphonesimulator";
33
+ exports.DevicePlatformSdkName = "iphoneos";
34
+ exports.SimulatorPlatformSdkName = "iphonesimulator";
35
+ exports.VisionSimulatorPlatformSdkName = "xrsimulator";
35
36
  const FRAMEWORK_EXTENSIONS = [".framework", ".xcframework"];
36
- const getPlatformSdkName = (forDevice) => forDevice ? DevicePlatformSdkName : SimulatorPlatformSdkName;
37
- const getConfigurationName = (release) => release ? constants_1.Configurations.Release : constants_1.Configurations.Debug;
37
+ const getPlatformSdkName = (buildData) => {
38
+ const forDevice = !buildData || buildData.buildForDevice || buildData.buildForAppStore;
39
+ const isvisionOS = yok_1.injector
40
+ .resolve("devicePlatformsConstants")
41
+ .isvisionOS(buildData.platform);
42
+ if (forDevice) {
43
+ return exports.DevicePlatformSdkName;
44
+ }
45
+ if (isvisionOS) {
46
+ return exports.VisionSimulatorPlatformSdkName;
47
+ }
48
+ return exports.SimulatorPlatformSdkName;
49
+ };
50
+ const getConfigurationName = (release) => {
51
+ return release ? constants_1.Configurations.Release : constants_1.Configurations.Debug;
52
+ };
38
53
  class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase {
39
- constructor($fs, $childProcess, $cocoapodsService, $errors, $logger, $injector, $projectDataService, $options, $devicePlatformsConstants, $hostInfo, $xcprojService, $iOSProvisionService, $iOSSigningService, $pbxprojDomXcode, $xcode, $iOSEntitlementsService, $platformEnvironmentRequirements, $plistParser, $xcconfigService, $xcodebuildService, $iOSExtensionsService, $iOSWatchAppService, $iOSNativeTargetService, $sysInfo, $tempService, $spmService) {
54
+ constructor($fs, $options, $childProcess, $cocoapodsService, $errors, $logger, $injector, $projectDataService, $devicePlatformsConstants, $hostInfo, $xcprojService, $iOSProvisionService, $iOSSigningService, $pbxprojDomXcode, $xcode, $iOSEntitlementsService, $platformEnvironmentRequirements, $plistParser, $xcconfigService, $xcodebuildService, $iOSExtensionsService, $iOSWatchAppService, $iOSNativeTargetService, $sysInfo, $tempService, $spmService, $mobileHelper) {
40
55
  super($fs, $projectDataService);
56
+ this.$options = $options;
41
57
  this.$childProcess = $childProcess;
42
58
  this.$cocoapodsService = $cocoapodsService;
43
59
  this.$errors = $errors;
44
60
  this.$logger = $logger;
45
61
  this.$injector = $injector;
46
- this.$options = $options;
47
62
  this.$devicePlatformsConstants = $devicePlatformsConstants;
48
63
  this.$hostInfo = $hostInfo;
49
64
  this.$xcprojService = $xcprojService;
@@ -62,30 +77,31 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
62
77
  this.$sysInfo = $sysInfo;
63
78
  this.$tempService = $tempService;
64
79
  this.$spmService = $spmService;
80
+ this.$mobileHelper = $mobileHelper;
65
81
  this._platformsDirCache = null;
66
82
  this._platformData = null;
67
83
  }
68
84
  getPlatformData(projectData) {
85
+ var _a;
69
86
  if (!projectData && !this._platformData) {
70
87
  throw new Error("First call of getPlatformData without providing projectData.");
71
88
  }
72
89
  if (projectData &&
73
90
  projectData.platformsDir &&
74
91
  this._platformsDirCache !== projectData.platformsDir) {
75
- const projectRoot = this.$options.nativeHost
76
- ? this.$options.nativeHost
77
- : path.join(projectData.platformsDir, this.$devicePlatformsConstants.iOS.toLowerCase());
78
- const runtimePackage = this.$projectDataService.getRuntimePackage(projectData.projectDir, "ios");
92
+ const platform = this.$mobileHelper.normalizePlatformName((_a = this.$options.platformOverride) !== null && _a !== void 0 ? _a : this.$devicePlatformsConstants.iOS);
93
+ const projectRoot = path.join(projectData.platformsDir, platform.toLowerCase());
94
+ const runtimePackage = this.$projectDataService.getRuntimePackage(projectData.projectDir, platform.toLowerCase());
79
95
  this._platformData = {
80
96
  frameworkPackageName: runtimePackage.name,
81
- normalizedPlatformName: "iOS",
82
- platformNameLowerCase: "ios",
97
+ normalizedPlatformName: platform,
98
+ platformNameLowerCase: platform.toLowerCase(),
83
99
  appDestinationDirectoryPath: path.join(projectRoot, projectData.projectName),
84
100
  platformProjectService: this,
85
101
  projectRoot: projectRoot,
86
102
  getBuildOutputPath: (options) => {
87
103
  const config = getConfigurationName(!options || options.release);
88
- return path.join(projectRoot, constants.BUILD_DIR, `${config}-${getPlatformSdkName(!options || options.buildForDevice || options.buildForAppStore)}`);
104
+ return path.join(projectRoot, constants.BUILD_DIR, `${config}-${getPlatformSdkName(options)}`);
89
105
  },
90
106
  getValidBuildOutputData: (buildOptions) => {
91
107
  const forDevice = !buildOptions ||
@@ -312,9 +328,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
312
328
  }
313
329
  prepareProject(projectData, prepareData) {
314
330
  return __awaiter(this, void 0, void 0, function* () {
315
- const projectRoot = this.$options.nativeHost
316
- ? this.$options.nativeHost
317
- : path.join(projectData.platformsDir, this.$devicePlatformsConstants.iOS.toLowerCase());
331
+ const projectRoot = path.join(projectData.platformsDir, "ios");
318
332
  const platformData = this.getPlatformData(projectData);
319
333
  const pluginsData = this.getAllProductionPlugins(projectData);
320
334
  const pbxProjPath = this.getPbxProjPath(projectData);
@@ -331,16 +345,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
331
345
  }
332
346
  const project = this.createPbxProj(projectData);
333
347
  const resources = project.pbxGroupByName("Resources");
334
- if (this.$options.nativeHost) {
335
- try {
336
- project.addResourceFile(path.join(this.$options.nativeHost, projectData.projectName));
337
- this.savePbxProj(project, projectData);
338
- }
339
- catch (err) {
340
- console.log(err);
341
- }
342
- }
343
- if (resources && !this.$options.nativeHost) {
348
+ if (resources) {
344
349
  const references = project.pbxFileReferenceSection();
345
350
  const xcodeProjectImages = _.map(resources.children, (resource) => this.replace(references[resource.value].name));
346
351
  this.$logger.trace("Images from Xcode project");
@@ -355,7 +360,10 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
355
360
  this.$logger.trace(`Images to remove from xcode project: ${imagesToRemove.join(", ")}`);
356
361
  _.each(imagesToRemove, (image) => project.removeResourceFile(path.join(this.getAppResourcesDestinationDirectoryPath(projectData), image)));
357
362
  this.savePbxProj(project, projectData);
358
- const resourcesNativeCodePath = path.join(resourcesDirectoryPath, platformData.normalizedPlatformName, constants.NATIVE_SOURCE_FOLDER);
363
+ let resourcesNativeCodePath = path.join(resourcesDirectoryPath, platformData.normalizedPlatformName, constants.NATIVE_SOURCE_FOLDER);
364
+ if (!this.$fs.exists(resourcesNativeCodePath)) {
365
+ resourcesNativeCodePath = path.join(resourcesDirectoryPath, this.$devicePlatformsConstants.iOS, constants.NATIVE_SOURCE_FOLDER);
366
+ }
359
367
  yield this.prepareNativeSourceCode(constants.TNS_NATIVE_SOURCE_GROUP_NAME, resourcesNativeCodePath, projectData);
360
368
  }
361
369
  this.$iOSWatchAppService.removeWatchApp({ pbxProjPath });
@@ -376,7 +384,13 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
376
384
  const platformsAppResourcesPath = this.getAppResourcesDestinationDirectoryPath(projectData);
377
385
  this.$fs.deleteDirectory(platformsAppResourcesPath);
378
386
  this.$fs.ensureDirectoryExists(platformsAppResourcesPath);
379
- this.$fs.copyFile(path.join(projectAppResourcesPath, platformData.normalizedPlatformName, "*"), platformsAppResourcesPath);
387
+ const platformAppResourcesPath = path.join(projectAppResourcesPath, platformData.normalizedPlatformName);
388
+ if (this.$fs.exists(platformAppResourcesPath)) {
389
+ this.$fs.copyFile(path.join(platformAppResourcesPath, "*"), platformsAppResourcesPath);
390
+ }
391
+ else {
392
+ this.$fs.copyFile(path.join(projectAppResourcesPath, this.$devicePlatformsConstants.iOS, "*"), platformsAppResourcesPath);
393
+ }
380
394
  this.$fs.deleteFile(path.join(platformsAppResourcesPath, platformData.configurationFileName));
381
395
  this.$fs.deleteFile(path.join(platformsAppResourcesPath, constants.PODFILE_NAME));
382
396
  this.$fs.deleteDirectory(path.join(platformsAppResourcesPath, constants.NATIVE_SOURCE_FOLDER));
@@ -479,13 +493,6 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
479
493
  return frameworkPath;
480
494
  }
481
495
  getPbxProjPath(projectData) {
482
- if (this.$options.nativeHost) {
483
- let xcodeProjectPath = this.$xcprojService.findXcodeProject(this.$options.nativeHost);
484
- if (!xcodeProjectPath) {
485
- this.$errors.fail("Xcode project not found at the specified directory");
486
- }
487
- return path.join(xcodeProjectPath, "project.pbxproj");
488
- }
489
496
  return path.join(this.$xcprojService.getXcodeprojPath(projectData, this.getPlatformData(projectData).projectRoot), "project.pbxproj");
490
497
  }
491
498
  createPbxProj(projectData) {
@@ -21,17 +21,13 @@ const constants_1 = require("../../constants");
21
21
  const decorators_1 = require("../../common/decorators");
22
22
  const yok_1 = require("../../common/yok");
23
23
  class AddPlatformService {
24
- constructor($fs, $logger, $options, $packageManager, $terminalSpinnerService, $analyticsService) {
24
+ constructor($fs, $logger, $packageManager, $terminalSpinnerService, $analyticsService) {
25
25
  this.$fs = $fs;
26
26
  this.$logger = $logger;
27
- this.$options = $options;
28
27
  this.$packageManager = $packageManager;
29
28
  this.$terminalSpinnerService = $terminalSpinnerService;
30
29
  this.$analyticsService = $analyticsService;
31
30
  }
32
- addProjectHost() {
33
- return __awaiter(this, void 0, void 0, function* () { });
34
- }
35
31
  addPlatformSafe(projectData, platformData, packageToInstall, addPlatformData) {
36
32
  return __awaiter(this, void 0, void 0, function* () {
37
33
  const spinner = this.$terminalSpinnerService.createSpinner();
@@ -99,9 +95,7 @@ class AddPlatformService {
99
95
  }
100
96
  addNativePlatform(platformData, projectData, frameworkDirPath, frameworkVersion) {
101
97
  return __awaiter(this, void 0, void 0, function* () {
102
- const platformDir = this.$options.nativeHost
103
- ? this.$options.nativeHost
104
- : path.join(projectData.platformsDir, platformData.normalizedPlatformName.toLowerCase());
98
+ const platformDir = path.join(projectData.platformsDir, platformData.normalizedPlatformName.toLowerCase());
105
99
  this.$fs.deleteDirectory(platformDir);
106
100
  yield platformData.platformProjectService.createProject(path.resolve(frameworkDirPath), frameworkVersion, projectData);
107
101
  platformData.platformProjectService.ensureConfigurationFileInAppResources(projectData);
@@ -20,12 +20,11 @@ const helpers_1 = require("../../common/helpers");
20
20
  const decorators_1 = require("../../common/decorators");
21
21
  const yok_1 = require("../../common/yok");
22
22
  class PrepareNativePlatformService {
23
- constructor($hooksService, $nodeModulesBuilder, $projectChangesService, $metadataFilteringService, $options) {
23
+ constructor($hooksService, $nodeModulesBuilder, $projectChangesService, $metadataFilteringService) {
24
24
  this.$hooksService = $hooksService;
25
25
  this.$nodeModulesBuilder = $nodeModulesBuilder;
26
26
  this.$projectChangesService = $projectChangesService;
27
27
  this.$metadataFilteringService = $metadataFilteringService;
28
- this.$options = $options;
29
28
  }
30
29
  prepareNativePlatform(platformData, projectData, prepareData) {
31
30
  return __awaiter(this, void 0, void 0, function* () {
@@ -41,10 +40,8 @@ class PrepareNativePlatformService {
41
40
  if (changesInfo.hasChanges) {
42
41
  yield this.cleanProject(platformData, { release });
43
42
  }
44
- if (!this.$options.nativeHost) {
45
- platformData.platformProjectService.prepareAppResources(projectData);
46
- }
47
- if (hasChangesRequirePrepare || this.$options.nativeHost) {
43
+ platformData.platformProjectService.prepareAppResources(projectData);
44
+ if (hasChangesRequirePrepare) {
48
45
  yield platformData.platformProjectService.prepareProject(projectData, prepareData);
49
46
  }
50
47
  if (hasNativeModulesChange) {
@@ -4,17 +4,22 @@ exports.PlatformsDataService = void 0;
4
4
  const yok_1 = require("../common/yok");
5
5
  const _ = require("lodash");
6
6
  class PlatformsDataService {
7
- constructor($androidProjectService, $iOSProjectService) {
7
+ constructor($options, $androidProjectService, $iOSProjectService) {
8
+ this.$options = $options;
8
9
  this.platformsDataService = {};
9
10
  this.platformsDataService = {
10
11
  ios: $iOSProjectService,
11
12
  android: $androidProjectService,
13
+ visionos: $iOSProjectService,
12
14
  };
13
15
  }
14
16
  getPlatformData(platform, projectData) {
17
+ var _a;
18
+ var _b;
15
19
  const platformKey = platform && _.first(platform.toLowerCase().split("@"));
16
20
  let platformData;
17
21
  if (platformKey) {
22
+ (_a = (_b = this.$options).platformOverride) !== null && _a !== void 0 ? _a : (_b.platformOverride = platform);
18
23
  platformData =
19
24
  this.platformsDataService[platformKey] &&
20
25
  this.platformsDataService[platformKey].getPlatformData(projectData);
@@ -306,7 +306,12 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
306
306
  cacheData.directory ||
307
307
  path.dirname(this.getPackageJsonFilePathForModule(cacheData.name, projectDir));
308
308
  pluginData.isPlugin = !!cacheData.nativescript;
309
- pluginData.pluginPlatformsFolderPath = (platform) => path.join(pluginData.fullPath, "platforms", platform.toLowerCase());
309
+ pluginData.pluginPlatformsFolderPath = (platform) => {
310
+ if (this.$mobileHelper.isvisionOSPlatform(platform)) {
311
+ platform = "ios";
312
+ }
313
+ return path.join(pluginData.fullPath, "platforms", platform.toLowerCase());
314
+ };
310
315
  const data = cacheData.nativescript;
311
316
  if (pluginData.isPlugin) {
312
317
  pluginData.platformsData = data.platforms;
@@ -9,7 +9,7 @@ class PrepareDataService {
9
9
  }
10
10
  getPrepareData(projectDir, platform, data) {
11
11
  const platformLowerCase = platform.toLowerCase();
12
- if (this.$mobileHelper.isiOSPlatform(platform)) {
12
+ if (this.$mobileHelper.isApplePlatfrom(platform)) {
13
13
  return new prepare_data_1.IOSPrepareData(projectDir, platformLowerCase, data);
14
14
  }
15
15
  else if (this.$mobileHelper.isAndroidPlatform(platform)) {
@@ -52,7 +52,12 @@ class ProjectChangesService {
52
52
  this._changesInfo = new ProjectChangesInfo();
53
53
  const isNewPrepareInfo = yield this.ensurePrepareInfo(platformData, projectData, prepareData);
54
54
  if (!isNewPrepareInfo) {
55
- const platformResourcesDir = path.join(projectData.appResourcesDirectoryPath, platformData.normalizedPlatformName);
55
+ let platformResourcesDir = path.join(projectData.appResourcesDirectoryPath, platformData.normalizedPlatformName);
56
+ if (!this.$fs.exists(platformResourcesDir) &&
57
+ platformData.platformNameLowerCase ===
58
+ this.$devicePlatformsConstants.visionOS.toLowerCase()) {
59
+ platformResourcesDir = path.join(projectData.appResourcesDirectoryPath, this.$devicePlatformsConstants.iOS);
60
+ }
56
61
  this._changesInfo.appResourcesChanged = this.containsNewerFiles(platformResourcesDir, projectData);
57
62
  this.$nodeModulesDependenciesBuilder
58
63
  .getProductionDependencies(projectData.projectDir, projectData.ignoredDependencies)