@choochmeque/tauri-apple-extensions 0.2.0 → 0.2.1

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.
package/dist/cli.js CHANGED
@@ -185,15 +185,25 @@ function addAppGroupToEntitlements(entitlements, appGroupId) {
185
185
  </array>
186
186
  </dict>`);
187
187
  }
188
- function createEntitlementsContent(appGroupId) {
188
+ function createEntitlementsContent(platform, appGroupId) {
189
+ const entries = [];
190
+ // macOS extensions require app-sandbox to be registered
191
+ if (platform === "macos") {
192
+ entries.push(` <key>com.apple.security.app-sandbox</key>
193
+ <true/>`);
194
+ }
195
+ // App groups only if needed
196
+ if (appGroupId) {
197
+ entries.push(` <key>com.apple.security.application-groups</key>
198
+ <array>
199
+ <string>${appGroupId}</string>
200
+ </array>`);
201
+ }
189
202
  return `<?xml version="1.0" encoding="UTF-8"?>
190
203
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
191
204
  <plist version="1.0">
192
205
  <dict>
193
- <key>com.apple.security.application-groups</key>
194
- <array>
195
- <string>${appGroupId}</string>
196
- </array>
206
+ ${entries.join("\n")}
197
207
  </dict>
198
208
  </plist>`;
199
209
  }
@@ -213,8 +223,8 @@ function updateMainAppEntitlements(appleDir, appInfo, platform) {
213
223
  fs.writeFileSync(entitlementsPath, entitlements);
214
224
  console.log(`Updated main app entitlements: ${entitlementsPath}`);
215
225
  }
216
- function createExtensionEntitlements(extensionDir, appGroupId) {
217
- const entitlements = createEntitlementsContent(appGroupId);
226
+ function createExtensionEntitlements(extensionDir, appGroupId, platform) {
227
+ const entitlements = createEntitlementsContent(platform, appGroupId);
218
228
  const entitlementsPath = path.join(extensionDir, `${path.basename(extensionDir)}.entitlements`);
219
229
  fs.writeFileSync(entitlementsPath, entitlements);
220
230
  return entitlementsPath;
@@ -265,7 +275,7 @@ const shareExtension = {
265
275
  extensionName(appInfo) {
266
276
  return `${appInfo.productName}-ShareExtension`;
267
277
  },
268
- createFiles(appleDir, appInfo, templatesDir, _platform) {
278
+ createFiles(appleDir, appInfo, templatesDir, platform) {
269
279
  const extensionDir = path.join(appleDir, "ShareExtension");
270
280
  const appGroupId = `group.${appInfo.identifier}`;
271
281
  const urlScheme = appInfo.productName
@@ -355,7 +365,7 @@ const shareExtension = {
355
365
  fs.writeFileSync(path.join(extensionDir, "Info.plist"), defaultInfoPlist);
356
366
  }
357
367
  // Create entitlements
358
- createExtensionEntitlements(extensionDir, appGroupId);
368
+ createExtensionEntitlements(extensionDir, appGroupId, platform);
359
369
  console.log(`Created ShareExtension files in ${extensionDir}`);
360
370
  },
361
371
  updateProjectYml(projectYml, appInfo, platform) {
@@ -535,7 +545,7 @@ const program = new Command();
535
545
  program
536
546
  .name("tauri-apple-extensions")
537
547
  .description("Add Apple extensions to Tauri apps")
538
- .version("0.2.0");
548
+ .version("0.2.1");
539
549
  function createPlatformCommand(platform) {
540
550
  const cmd = new Command(platform);
541
551
  cmd.description(`Manage ${platform === "ios" ? "iOS" : "macOS"} extensions`);
@@ -1,6 +1,6 @@
1
1
  import type { AppInfo, Platform } from "../types.js";
2
2
  export declare const EMPTY_ENTITLEMENTS = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n</dict>\n</plist>";
3
3
  export declare function addAppGroupToEntitlements(entitlements: string, appGroupId: string): string;
4
- export declare function createEntitlementsContent(appGroupId: string): string;
4
+ export declare function createEntitlementsContent(platform: Platform, appGroupId?: string): string;
5
5
  export declare function updateMainAppEntitlements(appleDir: string, appInfo: AppInfo, platform: Platform): void;
6
- export declare function createExtensionEntitlements(extensionDir: string, appGroupId: string): string;
6
+ export declare function createExtensionEntitlements(extensionDir: string, appGroupId: string, platform: Platform): string;
package/dist/index.js CHANGED
@@ -183,15 +183,25 @@ function addAppGroupToEntitlements(entitlements, appGroupId) {
183
183
  </array>
184
184
  </dict>`);
185
185
  }
186
- function createEntitlementsContent(appGroupId) {
186
+ function createEntitlementsContent(platform, appGroupId) {
187
+ const entries = [];
188
+ // macOS extensions require app-sandbox to be registered
189
+ if (platform === "macos") {
190
+ entries.push(` <key>com.apple.security.app-sandbox</key>
191
+ <true/>`);
192
+ }
193
+ // App groups only if needed
194
+ if (appGroupId) {
195
+ entries.push(` <key>com.apple.security.application-groups</key>
196
+ <array>
197
+ <string>${appGroupId}</string>
198
+ </array>`);
199
+ }
187
200
  return `<?xml version="1.0" encoding="UTF-8"?>
188
201
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
189
202
  <plist version="1.0">
190
203
  <dict>
191
- <key>com.apple.security.application-groups</key>
192
- <array>
193
- <string>${appGroupId}</string>
194
- </array>
204
+ ${entries.join("\n")}
195
205
  </dict>
196
206
  </plist>`;
197
207
  }
@@ -211,8 +221,8 @@ function updateMainAppEntitlements(appleDir, appInfo, platform) {
211
221
  fs.writeFileSync(entitlementsPath, entitlements);
212
222
  console.log(`Updated main app entitlements: ${entitlementsPath}`);
213
223
  }
214
- function createExtensionEntitlements(extensionDir, appGroupId) {
215
- const entitlements = createEntitlementsContent(appGroupId);
224
+ function createExtensionEntitlements(extensionDir, appGroupId, platform) {
225
+ const entitlements = createEntitlementsContent(platform, appGroupId);
216
226
  const entitlementsPath = path.join(extensionDir, `${path.basename(extensionDir)}.entitlements`);
217
227
  fs.writeFileSync(entitlementsPath, entitlements);
218
228
  return entitlementsPath;
@@ -263,7 +273,7 @@ const shareExtension = {
263
273
  extensionName(appInfo) {
264
274
  return `${appInfo.productName}-ShareExtension`;
265
275
  },
266
- createFiles(appleDir, appInfo, templatesDir, _platform) {
276
+ createFiles(appleDir, appInfo, templatesDir, platform) {
267
277
  const extensionDir = path.join(appleDir, "ShareExtension");
268
278
  const appGroupId = `group.${appInfo.identifier}`;
269
279
  const urlScheme = appInfo.productName
@@ -353,7 +363,7 @@ const shareExtension = {
353
363
  fs.writeFileSync(path.join(extensionDir, "Info.plist"), defaultInfoPlist);
354
364
  }
355
365
  // Create entitlements
356
- createExtensionEntitlements(extensionDir, appGroupId);
366
+ createExtensionEntitlements(extensionDir, appGroupId, platform);
357
367
  console.log(`Created ShareExtension files in ${extensionDir}`);
358
368
  },
359
369
  updateProjectYml(projectYml, appInfo, platform) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@choochmeque/tauri-apple-extensions",
3
- "version": "0.2.0",
4
- "description": "Add iOS extensions to Tauri apps with a single command",
3
+ "version": "0.2.1",
4
+ "description": "Add iOS and macOS extensions to Tauri apps with a single command",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "bin": {