@bacons/apple-targets 4.0.0 → 4.0.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/README.md CHANGED
@@ -285,47 +285,51 @@ module.exports = {
285
285
 
286
286
  Ideally, this would be generated automatically based on a fully qualified Xcode project, but for now it's a manual process. The currently supported types are based on static analysis of the most commonly used targets in the iOS App Store. I haven't tested all of these and they may not work.
287
287
 
288
- | Type | Description |
289
- | ----------------------- | ---------------------------------- |
290
- | action | Share Action |
291
- | app-intent | App Intent Extension |
292
- | widget | Widget / Live Activity |
293
- | watch | Watch App (with companion iOS App) |
294
- | clip | App Clip |
295
- | safari | Safari Extension |
296
- | share | Share Extension |
297
- | notification-content | Notification Content Extension |
298
- | notification-service | Notification Service Extension |
299
- | intent | Siri Intent Extension |
300
- | intent-ui | Siri Intent UI Extension |
301
- | spotlight | Spotlight Index Extension |
302
- | bg-download | Background Download Extension |
303
- | quicklook-thumbnail | Quick Look Thumbnail Extension |
304
- | location-push | Location Push Service Extension |
305
- | credentials-provider | Credentials Provider Extension |
306
- | account-auth | Account Authentication Extension |
307
- | network-packet-tunnel | Packet Tunnel Network Extension |
308
- | network-app-proxy | App Proxy Network Extension |
309
- | network-dns-proxy | DNS Proxy Network Extension |
310
- | network-filter-data | Filter Data Network Extension |
311
- | content-blocker | Safari Content Blocker Extension |
312
- | file-provider | File Provider Extension |
313
- | broadcast-upload | Broadcast Upload Extension |
314
- | call-directory | Call Directory Extension |
315
- | message-filter | Message Filter Extension |
316
- | file-provider-ui | File Provider UI Extension |
317
- | broadcast-setup-ui | Broadcast Setup UI Extension |
318
- | classkit-context | ClassKit Context Provider Extension|
319
- | unwanted-communication | Unwanted Communication Reporting |
320
- | photo-editing | Photo Editing Extension |
321
- | quicklook-preview | Quick Look Preview Extension |
322
- | spotlight-delegate | CoreSpotlight Delegate Extension |
323
- | virtual-conference | Virtual Conference Provider |
324
- | shield-action | Shield Action Extension |
325
- | shield-config | Shield Configuration Extension |
326
- | print-service | Print Service Extension |
327
- | smart-card | Smart Card / Persistent Token |
328
- | authentication-services | Authentication Services Extension |
288
+ | Type | Description |
289
+ | ------------------------- | ---------------------------------- |
290
+ | action | Share Action |
291
+ | app-intent | App Intent Extension |
292
+ | widget | Widget / Live Activity |
293
+ | watch | Watch App (with companion iOS App) |
294
+ | watch-widget | Watch Face Complication |
295
+ | clip | App Clip |
296
+ | safari | Safari Extension |
297
+ | share | Share Extension |
298
+ | notification-content | Notification Content Extension |
299
+ | notification-service | Notification Service Extension |
300
+ | intent | Siri Intent Extension |
301
+ | intent-ui | Siri Intent UI Extension |
302
+ | spotlight | Spotlight Index Extension |
303
+ | bg-download | Background Download Extension |
304
+ | quicklook-thumbnail | Quick Look Thumbnail Extension |
305
+ | location-push | Location Push Service Extension |
306
+ | credentials-provider | Credentials Provider Extension |
307
+ | account-auth | Account Authentication Extension |
308
+ | device-activity-monitor | Device Activity Monitor Extension |
309
+ | keyboard | Custom Keyboard Extension |
310
+ | matter | Matter Device Setup Extension |
311
+ | network-packet-tunnel | Packet Tunnel Network Extension |
312
+ | network-app-proxy | App Proxy Network Extension |
313
+ | network-dns-proxy | DNS Proxy Network Extension |
314
+ | network-filter-data | Filter Data Network Extension |
315
+ | content-blocker | Safari Content Blocker Extension |
316
+ | file-provider | File Provider Extension |
317
+ | broadcast-upload | Broadcast Upload Extension |
318
+ | call-directory | Call Directory Extension |
319
+ | message-filter | Message Filter Extension |
320
+ | file-provider-ui | File Provider UI Extension |
321
+ | broadcast-setup-ui | Broadcast Setup UI Extension |
322
+ | classkit-context | ClassKit Context Provider Extension|
323
+ | unwanted-communication | Unwanted Communication Reporting |
324
+ | photo-editing | Photo Editing Extension |
325
+ | quicklook-preview | Quick Look Preview Extension |
326
+ | spotlight-delegate | CoreSpotlight Delegate Extension |
327
+ | virtual-conference | Virtual Conference Provider |
328
+ | shield-action | Shield Action Extension |
329
+ | shield-config | Shield Configuration Extension |
330
+ | print-service | Print Service Extension |
331
+ | smart-card | Smart Card / Persistent Token |
332
+ | authentication-services | Authentication Services Extension |
329
333
 
330
334
 
331
335
  <!-- | imessage | iMessage Extension | -->
@@ -320,6 +320,54 @@ function createWatchAppConfigurationList(project, { name, displayName, cwd, bund
320
320
  },
321
321
  };
322
322
  }
323
+ function createWatchWidgetConfigurationList(project, { name, displayName, cwd, bundleId, deploymentTarget, currentProjectVersion, icon, }) {
324
+ const common = {
325
+ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME: "$accent",
326
+ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME: "$widgetBackground",
327
+ ...(icon && { ASSETCATALOG_COMPILER_APPICON_NAME: "AppIcon" }),
328
+ CLANG_ANALYZER_NONNULL: "YES",
329
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION: "YES_AGGRESSIVE",
330
+ CLANG_CXX_LANGUAGE_STANDARD: "gnu++20",
331
+ CLANG_ENABLE_OBJC_WEAK: "YES",
332
+ CLANG_WARN_DOCUMENTATION_COMMENTS: "YES",
333
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER: "YES",
334
+ CLANG_WARN_UNGUARDED_AVAILABILITY: "YES_AGGRESSIVE",
335
+ CODE_SIGN_STYLE: "Automatic",
336
+ CURRENT_PROJECT_VERSION: currentProjectVersion,
337
+ GCC_C_LANGUAGE_STANDARD: "gnu11",
338
+ GENERATE_INFOPLIST_FILE: "YES",
339
+ INFOPLIST_FILE: cwd + "/Info.plist",
340
+ INFOPLIST_KEY_CFBundleDisplayName: displayName !== null && displayName !== void 0 ? displayName : name,
341
+ INFOPLIST_KEY_NSHumanReadableCopyright: "",
342
+ LD_RUNPATH_SEARCH_PATHS: ["$(inherited)", "@executable_path/Frameworks"],
343
+ MARKETING_VERSION: "1.0",
344
+ MTL_FAST_MATH: "YES",
345
+ PRODUCT_BUNDLE_IDENTIFIER: bundleId,
346
+ PRODUCT_NAME: "$(TARGET_NAME)",
347
+ SDKROOT: "watchos",
348
+ SKIP_INSTALL: "YES",
349
+ SWIFT_EMIT_LOC_STRINGS: "YES",
350
+ SWIFT_VERSION: "5.0",
351
+ TARGETED_DEVICE_FAMILY: "4",
352
+ WATCHOS_DEPLOYMENT_TARGET: deploymentTarget !== null && deploymentTarget !== void 0 ? deploymentTarget : "9.4",
353
+ };
354
+ return {
355
+ debug: {
356
+ ...common,
357
+ DEBUG_INFORMATION_FORMAT: "dwarf",
358
+ MTL_ENABLE_DEBUG_INFO: "INCLUDE_SOURCE",
359
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS: "DEBUG",
360
+ SWIFT_OPTIMIZATION_LEVEL: "-Onone",
361
+ },
362
+ release: {
363
+ ...common,
364
+ COPY_PHASE_STRIP: "NO",
365
+ DEBUG_INFORMATION_FORMAT: "dwarf-with-dsym",
366
+ SWIFT_COMPILATION_MODE: "wholemodule",
367
+ SWIFT_OPTIMIZATION_LEVEL: "-O",
368
+ },
369
+ };
370
+ }
323
371
  function createSafariConfigurationList({ name, displayName, cwd, bundleId, deploymentTarget, currentProjectVersion, }) {
324
372
  const common = {
325
373
  CLANG_ANALYZER_NONNULL: "YES",
@@ -615,6 +663,8 @@ function getConfigurationListBuildSettingsForType(project, props) {
615
663
  return createAppClipConfigurationList(props);
616
664
  case "watch":
617
665
  return createWatchAppConfigurationList(project, props);
666
+ case "watch-widget":
667
+ return createWatchWidgetConfigurationList(project, props);
618
668
  case "app-intent":
619
669
  return createAppIntentConfigurationList(props);
620
670
  case "notification-content":
package/build/target.d.ts CHANGED
@@ -91,6 +91,12 @@ export declare const TARGET_REGISTRY: {
91
91
  readonly needsEmbeddedSwift: true;
92
92
  readonly displayName: "Watch";
93
93
  };
94
+ readonly "watch-widget": {
95
+ readonly frameworks: readonly ["WidgetKit", "SwiftUI"];
96
+ readonly appGroupsByDefault: true;
97
+ readonly displayName: "Watch Widget";
98
+ readonly description: "Watch face complication using WidgetKit";
99
+ };
94
100
  readonly "location-push": {
95
101
  readonly extensionPointIdentifier: "com.apple.location.push.service";
96
102
  readonly displayName: "Location Push";
package/build/target.js CHANGED
@@ -75,6 +75,15 @@ exports.TARGET_REGISTRY = {
75
75
  needsEmbeddedSwift: true,
76
76
  displayName: "Watch",
77
77
  },
78
+ "watch-widget": {
79
+ // extensionPointIdentifier intentionally omitted to avoid collision
80
+ // with "widget" in KNOWN_EXTENSION_POINT_IDENTIFIERS. The Info.plist
81
+ // is handled explicitly in getTargetInfoPlistForType().
82
+ frameworks: ["WidgetKit", "SwiftUI"],
83
+ appGroupsByDefault: true,
84
+ displayName: "Watch Widget",
85
+ description: "Watch face complication using WidgetKit",
86
+ },
78
87
  "location-push": {
79
88
  extensionPointIdentifier: "com.apple.location.push.service",
80
89
  displayName: "Location Push",
@@ -278,6 +287,12 @@ function getTargetInfoPlistForType(type) {
278
287
  switch (type) {
279
288
  case "watch":
280
289
  return {};
290
+ case "watch-widget":
291
+ return {
292
+ NSExtension: {
293
+ NSExtensionPointIdentifier: "com.apple.widgetkit-extension",
294
+ },
295
+ };
281
296
  case "action":
282
297
  return {
283
298
  NSExtension: {
@@ -641,7 +656,7 @@ exports.getTargetInfoPlistForType = getTargetInfoPlistForType;
641
656
  // Target detection & utilities
642
657
  // ---------------------------------------------------------------------------
643
658
  function isNativeTargetOfType(target, type) {
644
- var _a;
659
+ var _a, _b;
645
660
  if (type === "watch" &&
646
661
  target.props.productType === "com.apple.product-type.application") {
647
662
  return ("WATCHOS_DEPLOYMENT_TARGET" in
@@ -652,12 +667,28 @@ function isNativeTargetOfType(target, type) {
652
667
  "com.apple.product-type.application.on-demand-install-capable") {
653
668
  return true;
654
669
  }
670
+ const hasWatchOS = "WATCHOS_DEPLOYMENT_TARGET" in
671
+ target.getDefaultConfiguration().props.buildSettings;
672
+ if (type === "watch-widget" &&
673
+ target.props.productType === "com.apple.product-type.app-extension") {
674
+ if (!hasWatchOS)
675
+ return false;
676
+ const infoPlist = target.getDefaultConfiguration().getInfoPlist();
677
+ return (((_a = infoPlist.NSExtension) === null || _a === void 0 ? void 0 : _a.NSExtensionPointIdentifier) ===
678
+ "com.apple.widgetkit-extension");
679
+ }
680
+ // For iOS widget type, exclude watchOS targets that share the same extension point ID
681
+ if (type === "widget" &&
682
+ target.props.productType === "com.apple.product-type.app-extension" &&
683
+ hasWatchOS) {
684
+ return false;
685
+ }
655
686
  if (target.props.productType !== "com.apple.product-type.app-extension") {
656
687
  return false;
657
688
  }
658
689
  // Could be a Today Extension, Share Extension, etc.
659
690
  const infoPlist = target.getDefaultConfiguration().getInfoPlist();
660
- if (!((_a = infoPlist.NSExtension) === null || _a === void 0 ? void 0 : _a.NSExtensionPointIdentifier)) {
691
+ if (!((_b = infoPlist.NSExtension) === null || _b === void 0 ? void 0 : _b.NSExtensionPointIdentifier)) {
661
692
  console.error("No NSExtensionPointIdentifier found in extension Info.plist for target: " +
662
693
  target.getDisplayName());
663
694
  return false;
@@ -17,6 +17,7 @@ const with_eas_credentials_1 = require("./with-eas-credentials");
17
17
  const with_xcode_changes_1 = require("./with-xcode-changes");
18
18
  const util_1 = require("./util");
19
19
  const DEFAULT_DEPLOYMENT_TARGET = "18.0";
20
+ const DEFAULT_WATCHOS_DEPLOYMENT_TARGET = "11.0";
20
21
  const withWidget = (config, props) => {
21
22
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
22
23
  util_1.LOG_QUEUE.add(() => (0, util_1.warnOnce)((0, chalk_1.default) `\nUsing experimental Config Plugin {bold @bacons/apple-targets} that is subject to breaking changes.`));
@@ -222,7 +223,9 @@ const withWidget = (config, props) => {
222
223
  displayName: props.displayName,
223
224
  cwd: "../" +
224
225
  path_1.default.relative(config._internal.projectRoot, path_1.default.resolve(props.directory)),
225
- deploymentTarget: (_f = props.deploymentTarget) !== null && _f !== void 0 ? _f : DEFAULT_DEPLOYMENT_TARGET,
226
+ deploymentTarget: (_f = props.deploymentTarget) !== null && _f !== void 0 ? _f : (props.type === "watch" || props.type === "watch-widget"
227
+ ? DEFAULT_WATCHOS_DEPLOYMENT_TARGET
228
+ : DEFAULT_DEPLOYMENT_TARGET),
226
229
  bundleId,
227
230
  icon: props.icon,
228
231
  orientation: config.orientation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bacons/apple-targets",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Generate Apple Targets with Expo Prebuild",
5
5
  "main": "build/ExtensionStorage.js",
6
6
  "types": "build/ExtensionStorage.d.ts",