nativescript 9.1.0-alpha.0 → 9.1.0-alpha.2

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 (33) 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/run.js +1 -39
  7. package/lib/commands/widget.js +1 -2
  8. package/lib/common/definitions/mobile.d.ts +0 -3
  9. package/lib/common/file-system.js +11 -15
  10. package/lib/common/mobile/device-platforms-constants.js +0 -4
  11. package/lib/common/mobile/mobile-helper.js +1 -12
  12. package/lib/constants.js +7 -2
  13. package/lib/controllers/prepare-controller.js +0 -28
  14. package/lib/definitions/nativescript-dev-xcode.d.ts +25 -1
  15. package/lib/definitions/project.d.ts +35 -6
  16. package/lib/key-commands/bootstrap.js +0 -1
  17. package/lib/key-commands/index.js +1 -53
  18. package/lib/project-data.js +0 -6
  19. package/lib/services/bundler/bundler-compiler-service.js +27 -13
  20. package/lib/services/debug-service-base.js +1 -1
  21. package/lib/services/ios/ios-signing-service.js +10 -3
  22. package/lib/services/ios/spm-service.js +1 -8
  23. package/lib/services/ios/xcodebuild-args-service.js +10 -29
  24. package/lib/services/ios-entitlements-service.js +3 -1
  25. package/lib/services/ios-project-service.js +27 -74
  26. package/lib/services/ios-watch-app-service.js +663 -16
  27. package/lib/services/platforms-data-service.js +0 -1
  28. package/lib/services/plugins-service.js +4 -24
  29. package/lib/services/project-changes-service.js +4 -15
  30. package/lib/services/project-data-service.js +2 -20
  31. package/lib/services/versions-service.js +0 -4
  32. package/lib/tools/config-manipulation/config-transformer.js +55 -3
  33. package/package.json +23 -12
@@ -25,7 +25,6 @@ class ProjectData {
25
25
  this.projectIdentifiers.ios = identifier;
26
26
  this.projectIdentifiers.android = identifier;
27
27
  this.projectIdentifiers.visionos = identifier;
28
- this.projectIdentifiers.macos = identifier;
29
28
  }
30
29
  constructor($fs, $errors, $projectHelper, $staticConfig, $options, $logger, $injector, $androidResourcesMigrationService, $devicePlatformsConstants) {
31
30
  this.$fs = $fs;
@@ -176,14 +175,12 @@ class ProjectData {
176
175
  ios: "",
177
176
  android: "",
178
177
  visionos: "",
179
- macos: "",
180
178
  };
181
179
  }
182
180
  const identifier = {
183
181
  ios: config.id,
184
182
  android: config.id,
185
183
  visionos: config.id,
186
- macos: config.id,
187
184
  };
188
185
  if (config.ios && config.ios.id) {
189
186
  identifier.ios = config.ios.id;
@@ -194,9 +191,6 @@ class ProjectData {
194
191
  if (config.visionos && config.visionos.id) {
195
192
  identifier.visionos = config.visionos.id;
196
193
  }
197
- if (config.macos && config.macos.id) {
198
- identifier.macos = config.macos.id;
199
- }
200
194
  return identifier;
201
195
  }
202
196
  getProjectType() {
@@ -36,6 +36,9 @@ class BundlerCompilerService extends events_1.EventEmitter {
36
36
  this.bundlerProcesses = {};
37
37
  this.expectedHashes = {};
38
38
  }
39
+ getViteDistOutputPath(projectDir) {
40
+ return path.join(projectDir, process.env.NS_VITE_DIST_DIR || constants_1.VITE_DIST_FOLDER_NAME);
41
+ }
39
42
  async compileWithWatch(platformData, projectData, prepareData) {
40
43
  return new Promise(async (resolve, reject) => {
41
44
  if (this.bundlerProcesses[platformData.platformNameLowerCase]) {
@@ -67,7 +70,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
67
70
  console.log("Received Vite IPC message:", message);
68
71
  }
69
72
  // Copy Vite output files directly to platform destination
70
- const distOutput = path.join(projectData.projectDir, ".ns-vite-build");
73
+ const distOutput = this.getViteDistOutputPath(projectData.projectDir);
71
74
  const destDir = path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName);
72
75
  if (debugLog) {
73
76
  console.log(`Copying from ${distOutput} to ${destDir}.`);
@@ -96,6 +99,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
96
99
  console.log("Vite first build completed, resolving compileWithWatch");
97
100
  }
98
101
  resolve(childProcess);
102
+ return;
99
103
  }
100
104
  // Transform Vite message to match webpack format
101
105
  const files = message.emittedFiles.map((file) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, file));
@@ -214,11 +218,31 @@ class BundlerCompilerService extends events_1.EventEmitter {
214
218
  delete this.bundlerProcesses[platformData.platformNameLowerCase];
215
219
  reject(err);
216
220
  });
221
+ const isVite = this.getBundler() === "vite";
217
222
  childProcess.on("close", async (arg) => {
218
223
  await this.$cleanupService.removeKillProcess(childProcess.pid.toString());
219
224
  delete this.bundlerProcesses[platformData.platformNameLowerCase];
220
225
  const exitCode = typeof arg === "number" ? arg : arg && arg.code;
221
226
  if (exitCode === 0) {
227
+ // Non-watch Vite builds spawn the child with stdio:"inherit"
228
+ // (no IPC channel), so the emittedFiles message handler in
229
+ // compileWithWatch never fires and the Vite output is never
230
+ // copied to the platforms app folder. Mirror that copy step
231
+ // here so release/CI prepare and build flows actually deploy
232
+ // the freshly built bundle. Without this, the deploy folder
233
+ // is left empty (or worse, runs stale dev/HMR artifacts from
234
+ // a previous `ns debug` run) and the runtime crashes on
235
+ // launch with `Check failed: has_pending_exception()`.
236
+ if (isVite) {
237
+ try {
238
+ const distOutput = this.getViteDistOutputPath(projectData.projectDir);
239
+ const destDir = path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName);
240
+ this.copyViteBundleToNative(distOutput, destDir);
241
+ }
242
+ catch (copyErr) {
243
+ this.$logger.warn(`Failed to copy Vite output to platform destination: ${copyErr.message}`);
244
+ }
245
+ }
222
246
  resolve();
223
247
  }
224
248
  else {
@@ -244,13 +268,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
244
268
  }
245
269
  }
246
270
  }
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
- }
271
+ async shouldUsePreserveSymlinksOption() {
254
272
  // pnpm does not require symlink (https://github.com/nodejs/node-eps/issues/46#issuecomment-277373566)
255
273
  // and it also does not work in some cases.
256
274
  // Check https://github.com/NativeScript/nativescript-cli/issues/5259 for more information
@@ -282,7 +300,7 @@ class BundlerCompilerService extends events_1.EventEmitter {
282
300
  ]
283
301
  : cliArgs;
284
302
  const additionalNodeArgs = semver.major(process.version) <= 8 ? ["--harmony"] : [];
285
- if (await this.shouldUsePreserveSymlinksOption(projectData)) {
303
+ if (await this.shouldUsePreserveSymlinksOption()) {
286
304
  additionalNodeArgs.push("--preserve-symlinks");
287
305
  }
288
306
  if (process.arch === "x64") {
@@ -318,7 +336,6 @@ class BundlerCompilerService extends events_1.EventEmitter {
318
336
  USER_PROJECT_PLATFORMS_ANDROID: this.$options.hostProjectPath,
319
337
  USER_PROJECT_PLATFORMS_ANDROID_MODULE: this.$options.hostProjectModuleName,
320
338
  USER_PROJECT_PLATFORMS_IOS: this.$options.hostProjectPath,
321
- USER_PROJECT_PLATFORMS_MACOS: this.$options.hostProjectPath,
322
339
  });
323
340
  }
324
341
  if (debugLog) {
@@ -333,9 +350,6 @@ class BundlerCompilerService extends events_1.EventEmitter {
333
350
  var _a, _b, _c;
334
351
  const { env } = prepareData;
335
352
  const envData = Object.assign({}, env, { [platform.toLowerCase()]: true });
336
- if (platform.toLowerCase() === "macos") {
337
- envData.platform = "macos";
338
- }
339
353
  const appId = projectData.projectIdentifiers[platform];
340
354
  const appPath = projectData.getAppDirectoryRelativePath();
341
355
  const appResourcesPath = projectData.getAppResourcesRelativeDirectoryPath();
@@ -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
  : [];
@@ -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");
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.IOSProjectService = exports.MacOSPlatformSdkName = exports.VisionSimulatorPlatformSdkName = exports.VisionDevicePlatformSdkName = exports.SimulatorPlatformSdkName = exports.DevicePlatformSdkName = void 0;
9
+ exports.IOSProjectService = exports.VisionSimulatorPlatformSdkName = exports.VisionDevicePlatformSdkName = exports.SimulatorPlatformSdkName = exports.DevicePlatformSdkName = void 0;
10
10
  const path = require("path");
11
11
  const shell = require("shelljs");
12
12
  const _ = require("lodash");
@@ -26,24 +26,17 @@ exports.DevicePlatformSdkName = "iphoneos";
26
26
  exports.SimulatorPlatformSdkName = "iphonesimulator";
27
27
  exports.VisionDevicePlatformSdkName = "xros";
28
28
  exports.VisionSimulatorPlatformSdkName = "xrsimulator";
29
- exports.MacOSPlatformSdkName = "macosx";
30
29
  const FRAMEWORK_EXTENSIONS = [".framework", ".xcframework"];
31
30
  const getPlatformSdkName = (buildData) => {
32
31
  const forDevice = !buildData || buildData.buildForDevice || buildData.buildForAppStore;
33
32
  const isvisionOS = yok_1.injector
34
33
  .resolve("devicePlatformsConstants")
35
34
  .isvisionOS(buildData.platform);
36
- const ismacOS = yok_1.injector
37
- .resolve("devicePlatformsConstants")
38
- .ismacOS(buildData.platform);
39
35
  if (isvisionOS) {
40
36
  return forDevice
41
37
  ? exports.VisionDevicePlatformSdkName
42
38
  : exports.VisionSimulatorPlatformSdkName;
43
39
  }
44
- if (ismacOS) {
45
- return exports.MacOSPlatformSdkName;
46
- }
47
40
  return forDevice ? exports.DevicePlatformSdkName : exports.SimulatorPlatformSdkName;
48
41
  };
49
42
  const getConfigurationName = (release) => {
@@ -79,6 +72,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
79
72
  this.$mobileHelper = $mobileHelper;
80
73
  this.$projectConfigService = $projectConfigService;
81
74
  this._platformsDirCache = null;
75
+ this._platformOverrideCache = null;
82
76
  this._platformData = null;
83
77
  // Track added frameworks by name to prevent duplicates in monorepo/workspace setups
84
78
  // where the same plugin may exist in multiple node_modules paths
@@ -87,19 +81,20 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
87
81
  this._addedStaticLibs = new Set();
88
82
  }
89
83
  getPlatformData(projectData) {
90
- var _a;
84
+ var _a, _b;
91
85
  if (!projectData && !this._platformData) {
92
86
  throw new Error("First call of getPlatformData without providing projectData.");
93
87
  }
88
+ const currentOverride = (_a = this.$options.platformOverride) !== null && _a !== void 0 ? _a : null;
94
89
  if (projectData &&
95
90
  projectData.platformsDir &&
96
- this._platformsDirCache !== projectData.platformsDir) {
97
- const platform = this.$mobileHelper.normalizePlatformName((_a = this.$options.platformOverride) !== null && _a !== void 0 ? _a : this.$devicePlatformsConstants.iOS);
91
+ (this._platformsDirCache !== projectData.platformsDir ||
92
+ this._platformOverrideCache !== currentOverride)) {
93
+ const platform = this.$mobileHelper.normalizePlatformName((_b = this.$options.platformOverride) !== null && _b !== void 0 ? _b : this.$devicePlatformsConstants.iOS);
98
94
  const projectRoot = this.$options.hostProjectPath
99
95
  ? this.$options.hostProjectPath
100
96
  : path.join(projectData.platformsDir, platform.toLowerCase());
101
97
  const runtimePackage = this.$projectDataService.getRuntimePackage(projectData.projectDir, platform.toLowerCase());
102
- const isMacOSPlatform = this.$devicePlatformsConstants.ismacOS(platform);
103
98
  this._platformData = {
104
99
  frameworkPackageName: runtimePackage.name,
105
100
  normalizedPlatformName: platform,
@@ -109,22 +104,9 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
109
104
  projectRoot: projectRoot,
110
105
  getBuildOutputPath: (options) => {
111
106
  const config = getConfigurationName(!options || options.release);
112
- if (isMacOSPlatform) {
113
- return path.join(projectRoot, constants.BUILD_DIR, config);
114
- }
115
107
  return path.join(projectRoot, constants.BUILD_DIR, `${config}-${getPlatformSdkName(options)}`);
116
108
  },
117
109
  getValidBuildOutputData: (buildOptions) => {
118
- const isMacOS = !!buildOptions &&
119
- this.$devicePlatformsConstants.ismacOS(buildOptions.platform);
120
- if (isMacOS) {
121
- return {
122
- packageNames: [
123
- `${projectData.projectName}.app`,
124
- `${projectData.projectName}.zip`,
125
- ],
126
- };
127
- }
128
110
  const forDevice = !buildOptions ||
129
111
  !!buildOptions.buildForDevice ||
130
112
  !!buildOptions.buildForAppStore;
@@ -166,15 +148,11 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
166
148
  ".xbm",
167
149
  ], // https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImage_Class/
168
150
  };
151
+ this._platformsDirCache = projectData.platformsDir;
152
+ this._platformOverrideCache = currentOverride;
169
153
  }
170
154
  return this._platformData;
171
155
  }
172
- getPluginPlatform(projectData) {
173
- var _a;
174
- const platformData = this.getPlatformData(projectData);
175
- return (((_a = platformData.normalizedPlatformName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) ||
176
- platformData.platformNameLowerCase);
177
- }
178
156
  async validateOptions(projectId, provision, teamId) {
179
157
  if (provision && teamId) {
180
158
  this.$errors.fail("The options --provision and --teamId are mutually exclusive.");
@@ -379,10 +357,10 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
379
357
  this.savePbxProj(project, projectData);
380
358
  }
381
359
  async prepareProject(projectData, prepareData) {
360
+ const platformData = this.getPlatformData(projectData);
382
361
  const projectRoot = this.$options.hostProjectPath
383
362
  ? this.$options.hostProjectPath
384
- : path.join(projectData.platformsDir, this.$devicePlatformsConstants.iOS.toLowerCase());
385
- const platformData = this.getPlatformData(projectData);
363
+ : platformData.projectRoot;
386
364
  const pluginsData = this.getAllProductionPlugins(projectData);
387
365
  const pbxProjPath = this.getPbxProjPath(projectData);
388
366
  this.$iOSExtensionsService.removeExtensions({ pbxProjPath });
@@ -490,7 +468,6 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
490
468
  }
491
469
  }
492
470
  }
493
- this.$iOSWatchAppService.removeWatchApp({ pbxProjPath });
494
471
  const addedWatchApp = await this.$iOSWatchAppService.addWatchAppFromPath({
495
472
  watchAppFolderPath: path.join(resourcesDirectoryPath, platformData.normalizedPlatformName),
496
473
  projectData,
@@ -522,13 +499,6 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
522
499
  this.$fs.deleteDirectory(path.join(platformsAppResourcesPath, constants.NATIVE_EXTENSION_FOLDER));
523
500
  this.$fs.deleteDirectory(path.join(platformsAppResourcesPath, "watchapp"));
524
501
  this.$fs.deleteDirectory(path.join(platformsAppResourcesPath, "watchextension"));
525
- const macOSPlatformName = this.$devicePlatformsConstants.macOS &&
526
- this.$devicePlatformsConstants.macOS.toLowerCase();
527
- if (macOSPlatformName &&
528
- platformData.platformNameLowerCase === macOSPlatformName) {
529
- // macOS apps do not use iOS launch storyboards.
530
- this.$fs.deleteFile(path.join(platformsAppResourcesPath, "LaunchScreen.storyboard"));
531
- }
532
502
  }
533
503
  async processConfigurationFilesFromAppResources(projectData, opts) {
534
504
  await this.mergeInfoPlists(projectData, opts);
@@ -560,9 +530,8 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
560
530
  });
561
531
  };
562
532
  const allPlugins = this.getAllProductionPlugins(projectData);
563
- const pluginPlatform = this.getPluginPlatform(projectData);
564
533
  for (const plugin of allPlugins) {
565
- const pluginInfoPlistPath = path.join(plugin.pluginPlatformsFolderPath(pluginPlatform), this.getPlatformData(projectData).configurationFileName);
534
+ const pluginInfoPlistPath = path.join(plugin.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME), this.getPlatformData(projectData).configurationFileName);
566
535
  makePatch(pluginInfoPlistPath);
567
536
  }
568
537
  makePatch(infoPlistPath);
@@ -647,17 +616,16 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
647
616
  return this.$fs.writeFile(this.getPbxProjPath(projectData), project.writeSync({ omitEmptyValues }));
648
617
  }
649
618
  async preparePluginNativeCode(pluginData, projectData, opts) {
650
- const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(this.getPluginPlatform(projectData));
651
- const sourcePath = this.getPluginNativeSourcePath(pluginData, projectData, pluginPlatformsFolderPath);
619
+ const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
620
+ const sourcePath = path.join(pluginPlatformsFolderPath, "src");
652
621
  await this.prepareNativeSourceCode(pluginData.name, sourcePath, projectData);
653
622
  await this.prepareResources(pluginPlatformsFolderPath, pluginData, projectData);
654
623
  await this.prepareFrameworks(pluginPlatformsFolderPath, pluginData, projectData);
655
624
  await this.prepareStaticLibs(pluginPlatformsFolderPath, pluginData, projectData);
656
625
  }
657
626
  async removePluginNativeCode(pluginData, projectData) {
658
- const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(this.getPluginPlatform(projectData));
659
- const sourcePath = this.getPluginNativeSourcePath(pluginData, projectData, pluginPlatformsFolderPath);
660
- this.removeNativeSourceCode(sourcePath, pluginData, projectData);
627
+ const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
628
+ this.removeNativeSourceCode(pluginPlatformsFolderPath, pluginData, projectData);
661
629
  this.removeFrameworks(pluginPlatformsFolderPath, pluginData, projectData);
662
630
  this.removeStaticLibs(pluginPlatformsFolderPath, pluginData, projectData);
663
631
  const projectRoot = this.getPlatformData(projectData).projectRoot;
@@ -762,12 +730,12 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
762
730
  ], projectData.projectName, project);
763
731
  this.savePbxProj(project, projectData);
764
732
  }
765
- getAllLibsForPluginWithFileExtension(pluginData, fileExtension, projectData) {
733
+ getAllLibsForPluginWithFileExtension(pluginData, fileExtension) {
766
734
  const fileExtensions = _.isArray(fileExtension)
767
735
  ? fileExtension
768
736
  : [fileExtension];
769
737
  const filterCallback = (fileName, pluginPlatformsFolderPath) => fileExtensions.indexOf(path.extname(fileName)) !== -1;
770
- return this.getAllNativeLibrariesForPlugin(pluginData, this.getPluginPlatform(projectData), filterCallback);
738
+ return this.getAllNativeLibrariesForPlugin(pluginData, IOSProjectService.IOS_PLATFORM_NAME, filterCallback);
771
739
  }
772
740
  validateFramework(libraryPath) {
773
741
  const infoPlistPath = path.join(libraryPath, constants.INFO_PLIST_FILE_NAME);
@@ -807,21 +775,6 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
807
775
  }
808
776
  this.savePbxProj(project, projectData);
809
777
  }
810
- getPluginNativeSourcePath(pluginData, projectData, pluginPlatformsFolderPath) {
811
- const sourcePath = path.join(pluginPlatformsFolderPath, "src");
812
- if (this.$fs.exists(sourcePath)) {
813
- return sourcePath;
814
- }
815
- // For macOS only, allow reusing plugin native source code from iOS.
816
- // Framework/static library discovery remains strict to `platforms/macos`.
817
- if (this.$devicePlatformsConstants.ismacOS(this.getPlatformData(projectData).normalizedPlatformName)) {
818
- const iosSourcePath = path.join(pluginData.pluginPlatformsFolderPath("ios" /* constants.PlatformTypes.ios */), "src");
819
- if (this.$fs.exists(iosSourcePath)) {
820
- return iosSourcePath;
821
- }
822
- }
823
- return sourcePath;
824
- }
825
778
  async addExtensions(projectData, pluginsData) {
826
779
  const resorcesExtensionsPath = path.join(projectData.getAppResourcesDirectoryPath(), this.getPlatformData(projectData).normalizedPlatformName, constants.NATIVE_EXTENSION_FOLDER);
827
780
  const platformData = this.getPlatformData(projectData);
@@ -835,7 +788,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
835
788
  let addedExtensionsFromPlugins = false;
836
789
  for (const pluginIndex in pluginsData) {
837
790
  const pluginData = pluginsData[pluginIndex];
838
- const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(this.getPluginPlatform(projectData));
791
+ const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
839
792
  const extensionPath = path.join(pluginPlatformsFolderPath, constants.NATIVE_EXTENSION_FOLDER);
840
793
  const addedExtensionFromPlugin = await this.$iOSExtensionsService.addExtensionsFromPath({
841
794
  extensionsFolderPath: extensionPath,
@@ -890,25 +843,25 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
890
843
  this.savePbxProj(project, projectData);
891
844
  }
892
845
  async prepareFrameworks(pluginPlatformsFolderPath, pluginData, projectData) {
893
- for (const fileName of this.getAllLibsForPluginWithFileExtension(pluginData, FRAMEWORK_EXTENSIONS, projectData)) {
846
+ for (const fileName of this.getAllLibsForPluginWithFileExtension(pluginData, FRAMEWORK_EXTENSIONS)) {
894
847
  await this.addFramework(path.join(pluginPlatformsFolderPath, fileName), projectData);
895
848
  }
896
849
  }
897
850
  async prepareStaticLibs(pluginPlatformsFolderPath, pluginData, projectData) {
898
- for (const fileName of this.getAllLibsForPluginWithFileExtension(pluginData, ".a", projectData)) {
851
+ for (const fileName of this.getAllLibsForPluginWithFileExtension(pluginData, ".a")) {
899
852
  await this.addStaticLibrary(path.join(pluginPlatformsFolderPath, fileName), projectData);
900
853
  }
901
854
  }
902
- async removeNativeSourceCode(sourceFolderPath, pluginData, projectData) {
855
+ async removeNativeSourceCode(pluginPlatformsFolderPath, pluginData, projectData) {
903
856
  const project = this.createPbxProj(projectData);
904
- const group = await this.getRootGroup(pluginData.name, sourceFolderPath);
857
+ const group = await this.getRootGroup(pluginData.name, pluginPlatformsFolderPath);
905
858
  project.removePbxGroup(group.name, group.path);
906
859
  project.removeFromHeaderSearchPaths(group.path);
907
860
  this.savePbxProj(project, projectData);
908
861
  }
909
862
  removeFrameworks(pluginPlatformsFolderPath, pluginData, projectData) {
910
863
  const project = this.createPbxProj(projectData);
911
- _.each(this.getAllLibsForPluginWithFileExtension(pluginData, FRAMEWORK_EXTENSIONS, projectData), (fileName) => {
864
+ _.each(this.getAllLibsForPluginWithFileExtension(pluginData, FRAMEWORK_EXTENSIONS), (fileName) => {
912
865
  const relativeFrameworkPath = this.getLibSubpathRelativeToProjectPath(fileName, projectData);
913
866
  project.removeFramework(relativeFrameworkPath, {
914
867
  customFramework: true,
@@ -919,7 +872,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
919
872
  }
920
873
  removeStaticLibs(pluginPlatformsFolderPath, pluginData, projectData) {
921
874
  const project = this.createPbxProj(projectData);
922
- _.each(this.getAllLibsForPluginWithFileExtension(pluginData, ".a", projectData), (fileName) => {
875
+ _.each(this.getAllLibsForPluginWithFileExtension(pluginData, ".a"), (fileName) => {
923
876
  const staticLibPath = path.join(pluginPlatformsFolderPath, fileName);
924
877
  const relativeStaticLibPath = this.getLibSubpathRelativeToProjectPath(path.basename(staticLibPath), projectData);
925
878
  project.removeFramework(relativeStaticLibPath);
@@ -953,9 +906,8 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
953
906
  this.$fs.deleteFile(pluginsXcconfigFilePath);
954
907
  }
955
908
  const allPlugins = this.getAllProductionPlugins(projectData);
956
- const pluginPlatform = this.getPluginPlatform(projectData);
957
909
  for (const plugin of allPlugins) {
958
- const pluginPlatformsFolderPath = plugin.pluginPlatformsFolderPath(pluginPlatform);
910
+ const pluginPlatformsFolderPath = plugin.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
959
911
  const pluginXcconfigFilePath = path.join(pluginPlatformsFolderPath, constants_2.BUILD_XCCONFIG_FILE_NAME);
960
912
  if (this.$fs.exists(pluginXcconfigFilePath)) {
961
913
  for (const pluginsXcconfigFilePath of pluginsXcconfigFilePaths) {
@@ -1018,6 +970,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
1018
970
  }
1019
971
  exports.IOSProjectService = IOSProjectService;
1020
972
  IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER = "__PROJECT_NAME__";
973
+ IOSProjectService.IOS_PLATFORM_NAME = "ios";
1021
974
  __decorate([
1022
975
  (0, helpers_2.hook)("buildIOS")
1023
976
  ], IOSProjectService.prototype, "buildProject", null);