@capacitor/cli 8.2.1-nightly-20260324T152823.0 → 8.3.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.
Binary file
Binary file
Binary file
@@ -487,11 +487,30 @@ export interface CapacitorConfig {
487
487
  *
488
488
  * This setting may graduate to `ios.spm.swiftToolsVersion` in a future major release.
489
489
  *
490
- * @since 8.2.0
490
+ * @since 8.3.0
491
491
  * @default '5.9'
492
492
  * @example '6.1'
493
493
  */
494
494
  swiftToolsVersion?: string;
495
+ /**
496
+ * Define package traits for SPM plugin dependencies.
497
+ *
498
+ * This requires explicitly setting experimental.ios.spm.swiftToolsVersion
499
+ * to '6.1' or higher.
500
+ *
501
+ * The key is the plugin ID (e.g. `@capacitor-firebase/analytics`)
502
+ * and the value is an array of trait names.
503
+ *
504
+ * Packages can have default traits. If you use this property, and
505
+ * want to preserve the defaults, include ".defaults" in the array.
506
+ *
507
+ * This setting may graduate to `ios.spm.packageTraits` in a future major release.
508
+ *
509
+ * @since 8.3.0
510
+ */
511
+ packageTraits?: {
512
+ [pluginId: string]: string[];
513
+ };
495
514
  };
496
515
  };
497
516
  };
@@ -39,6 +39,7 @@ async function getCommonChecks(config) {
39
39
  if (swiftToolsVersion) {
40
40
  checks.push(() => (0, spm_1.checkSwiftToolsVersion)(config, swiftToolsVersion));
41
41
  }
42
+ checks.push(() => (0, spm_1.checkPackageTraitsRequirements)(config));
42
43
  }
43
44
  return checks;
44
45
  }
package/dist/util/spm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkSwiftToolsVersion = exports.addInfoPlistDebugIfNeeded = exports.runCocoapodsDeintegrate = exports.generatePackageText = exports.removeCocoapodsFiles = exports.extractSPMPackageDirectory = exports.checkPluginsForPackageSwift = exports.generatePackageFile = exports.findPackageSwiftFile = exports.checkPackageManager = void 0;
3
+ exports.checkPackageTraitsRequirements = exports.checkSwiftToolsVersion = exports.addInfoPlistDebugIfNeeded = exports.runCocoapodsDeintegrate = exports.generatePackageText = exports.removeCocoapodsFiles = exports.extractSPMPackageDirectory = exports.checkPluginsForPackageSwift = exports.generatePackageFile = exports.findPackageSwiftFile = exports.checkPackageManager = void 0;
4
4
  const fs_extra_1 = require("fs-extra");
5
5
  const os_1 = require("os");
6
6
  const path_1 = require("path");
@@ -84,10 +84,11 @@ async function removeCocoapodsFiles(config) {
84
84
  }
85
85
  exports.removeCocoapodsFiles = removeCocoapodsFiles;
86
86
  async function generatePackageText(config, plugins) {
87
- var _a, _b, _c, _d, _e, _f, _g;
87
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
88
88
  const iosPlatformVersion = await (0, common_1.getCapacitorPackageVersion)(config, config.ios.name);
89
89
  const iosVersion = (0, common_2.getMajoriOSVersion)(config);
90
- const swiftToolsVersion = (_d = (_c = (_b = (_a = config.app.extConfig.experimental) === null || _a === void 0 ? void 0 : _a.ios) === null || _b === void 0 ? void 0 : _b.spm) === null || _c === void 0 ? void 0 : _c.swiftToolsVersion) !== null && _d !== void 0 ? _d : '5.9';
90
+ const packageTraits = (_d = (_c = (_b = (_a = config.app.extConfig.experimental) === null || _a === void 0 ? void 0 : _a.ios) === null || _b === void 0 ? void 0 : _b.spm) === null || _c === void 0 ? void 0 : _c.packageTraits) !== null && _d !== void 0 ? _d : {};
91
+ const swiftToolsVersion = (_h = (_g = (_f = (_e = config.app.extConfig.experimental) === null || _e === void 0 ? void 0 : _e.ios) === null || _f === void 0 ? void 0 : _f.spm) === null || _g === void 0 ? void 0 : _g.swiftToolsVersion) !== null && _h !== void 0 ? _h : '5.9';
91
92
  let packageSwiftText = `// swift-tools-version: ${swiftToolsVersion}
92
93
  import PackageDescription
93
94
 
@@ -108,7 +109,16 @@ let package = Package(
108
109
  }
109
110
  else {
110
111
  const relPath = (0, path_1.relative)(config.ios.nativeXcodeProjDirAbs, plugin.rootPath);
111
- packageSwiftText += `,\n .package(name: "${(_e = plugin.ios) === null || _e === void 0 ? void 0 : _e.name}", path: "${relPath}")`;
112
+ const traits = packageTraits[plugin.id];
113
+ const traitsSuffix = (traits === null || traits === void 0 ? void 0 : traits.length)
114
+ ? `, traits: [${traits
115
+ .map((t) => {
116
+ // Any trait is written with quotes, with the exception of .defaults
117
+ return /^\.?defaults?$/i.test(t) ? '.defaults' : `"${t}"`;
118
+ })
119
+ .join(', ')}]`
120
+ : '';
121
+ packageSwiftText += `,\n .package(name: "${(_j = plugin.ios) === null || _j === void 0 ? void 0 : _j.name}", path: "${relPath}"${traitsSuffix})`;
112
122
  }
113
123
  }
114
124
  packageSwiftText += `
@@ -120,7 +130,7 @@ let package = Package(
120
130
  .product(name: "Capacitor", package: "capacitor-swift-pm"),
121
131
  .product(name: "Cordova", package: "capacitor-swift-pm")`;
122
132
  for (const plugin of plugins) {
123
- packageSwiftText += `,\n .product(name: "${(_f = plugin.ios) === null || _f === void 0 ? void 0 : _f.name}", package: "${(_g = plugin.ios) === null || _g === void 0 ? void 0 : _g.name}")`;
133
+ packageSwiftText += `,\n .product(name: "${(_k = plugin.ios) === null || _k === void 0 ? void 0 : _k.name}", package: "${(_l = plugin.ios) === null || _l === void 0 ? void 0 : _l.name}")`;
124
134
  }
125
135
  packageSwiftText += `
126
136
  ]
@@ -182,6 +192,28 @@ async function checkSwiftToolsVersion(config, version) {
182
192
  return null;
183
193
  }
184
194
  exports.checkSwiftToolsVersion = checkSwiftToolsVersion;
195
+ async function checkPackageTraitsRequirements(config) {
196
+ var _a, _b, _c, _d, _e, _f;
197
+ const packageTraits = (_c = (_b = (_a = config.app.extConfig.experimental) === null || _a === void 0 ? void 0 : _a.ios) === null || _b === void 0 ? void 0 : _b.spm) === null || _c === void 0 ? void 0 : _c.packageTraits;
198
+ const swiftToolsVersion = (_f = (_e = (_d = config.app.extConfig.experimental) === null || _d === void 0 ? void 0 : _d.ios) === null || _e === void 0 ? void 0 : _e.spm) === null || _f === void 0 ? void 0 : _f.swiftToolsVersion;
199
+ const hasPackageTraits = packageTraits && Object.keys(packageTraits).some((key) => { var _a; return ((_a = packageTraits[key]) === null || _a === void 0 ? void 0 : _a.length) > 0; });
200
+ if (!hasPackageTraits) {
201
+ return null;
202
+ }
203
+ if (!swiftToolsVersion) {
204
+ return (`Package traits require an explicit Swift tools version of 6.1 or higher.\n` +
205
+ `Set experimental.ios.spm.swiftToolsVersion to '6.1' or higher in your Capacitor configuration.`);
206
+ }
207
+ const versionParts = swiftToolsVersion.split('.').map((part) => parseInt(part, 10));
208
+ const major = versionParts[0] || 0;
209
+ const minor = versionParts[1] || 0;
210
+ if (major < 6 || (major === 6 && minor < 1)) {
211
+ return (`Package traits require Swift tools version 6.1 or higher, but "${swiftToolsVersion}" was specified.\n` +
212
+ `Update experimental.ios.spm.swiftToolsVersion to '6.1' or higher in your Capacitor configuration.`);
213
+ }
214
+ return null;
215
+ }
216
+ exports.checkPackageTraitsRequirements = checkPackageTraitsRequirements;
185
217
  // Private Functions
186
218
  async function pluginsWithPackageSwift(plugins) {
187
219
  const pluginList = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/cli",
3
- "version": "8.2.1-nightly-20260324T152823.0",
3
+ "version": "8.3.0",
4
4
  "description": "Capacitor: Cross-platform apps with JavaScript and the web",
5
5
  "homepage": "https://capacitorjs.com",
6
6
  "author": "Ionic Team <hi@ionic.io> (https://ionic.io)",