@capacitor-plus/cli 8.3.2 → 8.3.3

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
@@ -100,6 +100,18 @@ function buildBinaryTargetEntries(p, frameworks) {
100
100
  .join('');
101
101
  return { binaryTargetsText, binaryDepsText };
102
102
  }
103
+ function buildResourcesText(resources) {
104
+ const resourceEntry = [];
105
+ for (const resource of resources) {
106
+ resourceEntry.push(`.copy("resources/${resource.$.src.split('/').pop()}")`);
107
+ }
108
+ return resources.length > 0
109
+ ? `,
110
+ resources: [
111
+ ${resourceEntry.join(',\n ')}
112
+ ]`
113
+ : '';
114
+ }
103
115
  function buildCSettingsText(p, sourceFiles) {
104
116
  var _a;
105
117
  const pluginId = p.id;
@@ -155,8 +167,9 @@ async function writeGeneratedPackageSwift(p, config, iosPlatformVersion) {
155
167
  ? `,
156
168
  publicHeadersPath: "."`
157
169
  : '';
170
+ const resources = (0, plugin_1.getPlatformElement)(p, platform, 'resource-file');
158
171
  const sourceFiles = (0, plugin_1.getPlatformElement)(p, platform, 'source-file');
159
- if (sourceFiles.length === 0 && headerFiles.length === 0) {
172
+ if (sourceFiles.length === 0 && headerFiles.length === 0 && resources.length === 0) {
160
173
  return;
161
174
  }
162
175
  const frameworks = (0, plugin_1.getPlatformElement)(p, platform, 'framework');
@@ -165,6 +178,7 @@ async function writeGeneratedPackageSwift(p, config, iosPlatformVersion) {
165
178
  const systemFrameworks = frameworks.filter((f) => !f.$.custom && f.$.src.endsWith('.framework'));
166
179
  const hasWeakFrameworks = systemFrameworks.some((f) => f.$.weak === 'true');
167
180
  const requiredSystemFrameworks = systemFrameworks.filter((f) => f.$.weak !== 'true');
181
+ const resourcesText = buildResourcesText(resources);
168
182
  const libraryTypeText = hasWeakFrameworks ? `\n type: .dynamic,` : '';
169
183
  const linkerSettingsText = requiredSystemFrameworks.length > 0
170
184
  ? `,
@@ -194,7 +208,7 @@ let package = Package(
194
208
  dependencies: [
195
209
  .product(name: "Cordova", package: "capacitor-swift-pm")${binaryDepsText}
196
210
  ],
197
- path: "."${headersText}${cSettingsText}${linkerSettingsText}
211
+ path: "."${resourcesText}${headersText}${cSettingsText}${linkerSettingsText}
198
212
  )${binaryTargetsText}
199
213
  ]
200
214
  )`;
@@ -505,8 +519,13 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
505
519
  }
506
520
  if (fileContent.includes('[NSBundle bundleForClass:[self class]]') ||
507
521
  fileContent.includes('[NSBundle bundleForClass:[CDVCapture class]]')) {
508
- fileContent = fileContent.replace('[NSBundle bundleForClass:[self class]]', '[NSBundle mainBundle]');
509
- fileContent = fileContent.replace('[NSBundle bundleForClass:[CDVCapture class]]', '[NSBundle mainBundle]');
522
+ const bundleName = isSPM ? 'SWIFTPM_MODULE_BUNDLE' : '[NSBundle mainBundle]';
523
+ fileContent = fileContent.replace('[NSBundle bundleForClass:[self class]]', bundleName);
524
+ fileContent = fileContent.replace('[NSBundle bundleForClass:[CDVCapture class]]', bundleName);
525
+ await (0, fs_extra_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
526
+ }
527
+ if (isSPM && fileContent.includes('[NSBundle mainBundle] URLForResource')) {
528
+ fileContent = fileContent.replace('[NSBundle mainBundle] URLForResource', 'SWIFTPM_MODULE_BUNDLE URLForResource');
510
529
  await (0, fs_extra_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
511
530
  }
512
531
  if (fileContent.includes('[self.webView superview]') || fileContent.includes('self.webView.superview')) {
@@ -520,7 +539,8 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
520
539
  const resourceFiles = (0, plugin_1.getPlatformElement)(p, platform, 'resource-file');
521
540
  for (const resourceFile of resourceFiles) {
522
541
  const fileName = resourceFile.$.src.split('/').pop();
523
- await (0, fs_extra_1.copy)((0, plugin_1.getFilePath)(config, p, resourceFile.$.src), (0, path_1.join)(config.ios.cordovaPluginsDirAbs, 'resources', fileName));
542
+ const rootResFolder = isSPM ? sourcesFolder : config.ios.cordovaPluginsDirAbs;
543
+ await (0, fs_extra_1.copy)((0, plugin_1.getFilePath)(config, p, resourceFile.$.src), (0, path_1.join)(rootResFolder, 'resources', fileName));
524
544
  }
525
545
  for (const framework of frameworks) {
526
546
  if (framework.$.custom && framework.$.custom === 'true') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor-plus/cli",
3
- "version": "8.3.2",
3
+ "version": "8.3.3",
4
4
  "description": "Capacitor+: Enhanced Capacitor with automated upstream sync - Cross-platform apps with JavaScript and the web",
5
5
  "homepage": "https://capgo.app/docs/plugins/capacitor-plus/",
6
6
  "author": "Capgo Team <support@capgo.app> (https://capgo.app)",