@bacons/apple-targets 3.0.5 → 3.0.6

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 (30) hide show
  1. package/README.md +5 -1
  2. package/build/colorset/{withIosColorset.js → with-ios-colorset.js} +2 -2
  3. package/build/config-plugin.js +9 -10
  4. package/build/config.d.ts +0 -2
  5. package/build/{withXcodeChanges.d.ts → configuration-list.d.ts} +2 -2
  6. package/build/configuration-list.js +656 -0
  7. package/build/target.d.ts +473 -2
  8. package/build/target.js +281 -239
  9. package/build/util.d.ts +18 -0
  10. package/build/util.js +48 -0
  11. package/build/{withXcparse.js → with-bacons-xcode.js} +5 -2
  12. package/build/{withEasCredentials.js → with-eas-credentials.js} +2 -2
  13. package/build/{withWidget.js → with-widget.js} +24 -65
  14. package/build/with-xcode-changes.d.ts +3 -0
  15. package/build/with-xcode-changes.js +397 -0
  16. package/package.json +7 -2
  17. package/build/template/XCBuildConfiguration.json +0 -759
  18. package/build/withXcodeChanges.js +0 -1039
  19. /package/build/colorset/{customColorFromCSS.d.ts → custom-color-from-css.d.ts} +0 -0
  20. /package/build/colorset/{customColorFromCSS.js → custom-color-from-css.js} +0 -0
  21. /package/build/colorset/{withIosColorset.d.ts → with-ios-colorset.d.ts} +0 -0
  22. /package/build/icon/{withImageAsset.d.ts → with-image-asset.d.ts} +0 -0
  23. /package/build/icon/{withImageAsset.js → with-image-asset.js} +0 -0
  24. /package/build/icon/{withIosIcon.d.ts → with-ios-icon.d.ts} +0 -0
  25. /package/build/icon/{withIosIcon.js → with-ios-icon.js} +0 -0
  26. /package/build/{withXcparse.d.ts → with-bacons-xcode.d.ts} +0 -0
  27. /package/build/{withEasCredentials.d.ts → with-eas-credentials.d.ts} +0 -0
  28. /package/build/{withPodTargetExtension.d.ts → with-pod-target-extension.d.ts} +0 -0
  29. /package/build/{withPodTargetExtension.js → with-pod-target-extension.js} +0 -0
  30. /package/build/{withWidget.d.ts → with-widget.d.ts} +0 -0
package/build/target.js CHANGED
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.getAuxiliaryTargets = exports.getMainAppTarget = exports.isNativeTargetOfType = exports.getFrameworksForType = exports.needsEmbeddedSwift = exports.productTypeForType = exports.getTargetInfoPlistForType = exports.SHOULD_USE_APP_GROUPS_BY_DEFAULT = exports.KNOWN_EXTENSION_POINT_IDENTIFIERS = void 0;
7
- const plist_1 = __importDefault(require("@expo/plist"));
8
4
  exports.KNOWN_EXTENSION_POINT_IDENTIFIERS = {
9
5
  "com.apple.message-payload-provider": "imessage",
10
6
  "com.apple.widgetkit-extension": "widget",
@@ -25,6 +21,12 @@ exports.KNOWN_EXTENSION_POINT_IDENTIFIERS = {
25
21
  "com.apple.appintents-extension": "app-intent",
26
22
  "com.apple.deviceactivity.monitor-extension": "device-activity-monitor",
27
23
  // "com.apple.intents-service": "intents",
24
+ "com.apple.networkextension.packet-tunnel": "network-packet-tunnel",
25
+ "com.apple.networkextension.app-proxy": "network-app-proxy",
26
+ "com.apple.networkextension.dns-proxy": "network-dns-proxy",
27
+ "com.apple.networkextension.filter-data": "network-filter-data",
28
+ "com.apple.keyboard-service": "keyboard",
29
+ // "com.apple.intents-service": "intents",
28
30
  };
29
31
  // An exhaustive list of extension types that should sync app groups from the main target by default when
30
32
  // no app groups are specified.
@@ -33,6 +35,7 @@ exports.SHOULD_USE_APP_GROUPS_BY_DEFAULT = {
33
35
  "bg-download": true,
34
36
  clip: true,
35
37
  widget: true,
38
+ keyboard: true,
36
39
  "account-auth": false,
37
40
  "credentials-provider": false,
38
41
  "device-activity-monitor": false,
@@ -49,221 +52,253 @@ exports.SHOULD_USE_APP_GROUPS_BY_DEFAULT = {
49
52
  safari: false,
50
53
  spotlight: false,
51
54
  watch: false,
55
+ "network-packet-tunnel": false,
56
+ "network-app-proxy": false,
57
+ "network-dns-proxy": false,
58
+ "network-filter-data": false,
52
59
  };
53
60
  // TODO: Maybe we can replace `NSExtensionPrincipalClass` with the `@main` annotation that newer extensions use?
54
61
  function getTargetInfoPlistForType(type) {
55
62
  // TODO: Use exhaustive switch to ensure external contributors don't forget to add this.
56
- if (type === "watch") {
57
- return plist_1.default.build({});
58
- }
59
- else if (type === "action") {
60
- return plist_1.default.build({
61
- NSExtension: {
62
- NSExtensionAttributes: {
63
- NSExtensionActivationRule: {
64
- NSExtensionActivationSupportsFileWithMaxCount: 0,
65
- NSExtensionActivationSupportsImageWithMaxCount: 0,
66
- NSExtensionActivationSupportsMovieWithMaxCount: 0,
67
- NSExtensionActivationSupportsText: false,
68
- NSExtensionActivationSupportsWebURLWithMaxCount: 1,
63
+ const NSExtensionPointIdentifier = Object.keys(exports.KNOWN_EXTENSION_POINT_IDENTIFIERS).find((key) => exports.KNOWN_EXTENSION_POINT_IDENTIFIERS[key] === type);
64
+ switch (type) {
65
+ case "watch":
66
+ return {};
67
+ case "action":
68
+ return {
69
+ NSExtension: {
70
+ NSExtensionAttributes: {
71
+ NSExtensionActivationRule: {
72
+ NSExtensionActivationSupportsFileWithMaxCount: 0,
73
+ NSExtensionActivationSupportsImageWithMaxCount: 0,
74
+ NSExtensionActivationSupportsMovieWithMaxCount: 0,
75
+ NSExtensionActivationSupportsText: false,
76
+ NSExtensionActivationSupportsWebURLWithMaxCount: 1,
77
+ },
78
+ NSExtensionJavaScriptPreprocessingFile: "assets/index",
79
+ NSExtensionServiceAllowsFinderPreviewItem: true,
80
+ NSExtensionServiceAllowsTouchBarItem: true,
81
+ NSExtensionServiceFinderPreviewIconName: "NSActionTemplate",
82
+ NSExtensionServiceTouchBarBezelColorName: "TouchBarBezel",
83
+ NSExtensionServiceTouchBarIconName: "NSActionTemplate",
69
84
  },
70
- NSExtensionJavaScriptPreprocessingFile: "assets/index",
71
- NSExtensionServiceAllowsFinderPreviewItem: true,
72
- NSExtensionServiceAllowsTouchBarItem: true,
73
- NSExtensionServiceFinderPreviewIconName: "NSActionTemplate",
74
- NSExtensionServiceTouchBarBezelColorName: "TouchBarBezel",
75
- NSExtensionServiceTouchBarIconName: "NSActionTemplate",
85
+ NSExtensionPointIdentifier: "com.apple.services",
86
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).ActionRequestHandler",
76
87
  },
77
- NSExtensionPointIdentifier: "com.apple.services",
78
- NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).ActionRequestHandler",
79
- },
80
- });
81
- }
82
- else if (type === "app-intent") {
83
- return plist_1.default.build({
84
- EXAppExtensionAttributes: {
85
- EXExtensionPointIdentifier: "com.apple.appintents-extension",
86
- },
87
- });
88
- }
89
- else if (type === "clip") {
90
- return plist_1.default.build({
91
- CFBundleName: "$(PRODUCT_NAME)",
92
- CFBundleIdentifier: "$(PRODUCT_BUNDLE_IDENTIFIER)",
93
- CFBundleExecutable: "$(EXECUTABLE_NAME)",
94
- CFBundlePackageType: "$(PRODUCT_BUNDLE_PACKAGE_TYPE)",
95
- CFBundleShortVersionString: "$(MARKETING_VERSION)",
96
- UIApplicationSupportsIndirectInputEvents: true,
97
- NSAppClip: {
98
- NSAppClipRequestEphemeralUserNotification: false,
99
- NSAppClipRequestLocationConfirmation: false,
100
- },
101
- NSAppTransportSecurity: {
102
- NSAllowsArbitraryLoads: false,
103
- NSAllowsLocalNetworking: true,
104
- },
105
- UILaunchStoryboardName: "SplashScreen",
106
- UIUserInterfaceStyle: "Automatic",
107
- UIViewControllerBasedStatusBarAppearance: false,
108
- });
109
- }
110
- const NSExtensionPointIdentifier = Object.keys(exports.KNOWN_EXTENSION_POINT_IDENTIFIERS).find((key) => exports.KNOWN_EXTENSION_POINT_IDENTIFIERS[key] === type);
111
- if (type === "imessage") {
112
- return plist_1.default.build({
113
- NSExtension: {
114
- NSExtensionPointIdentifier,
115
- // This is hardcoded as there is no Swift code in the imessage extension.
116
- NSExtensionPrincipalClass: "StickerBrowserViewController",
117
- },
118
- });
119
- }
120
- else if (type === "account-auth") {
121
- return plist_1.default.build({
122
- NSExtension: {
123
- NSExtensionPointIdentifier,
124
- NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).AccountAuthViewController",
125
- NSExtensionAttributes: {
126
- ASAccountAuthenticationModificationSupportsStrongPasswordChange: true,
127
- ASAccountAuthenticationModificationSupportsUpgradeToSignInWithApple: true,
88
+ };
89
+ case "app-intent":
90
+ return {
91
+ EXAppExtensionAttributes: {
92
+ EXExtensionPointIdentifier: "com.apple.appintents-extension",
128
93
  },
129
- },
130
- });
131
- }
132
- else if (type === "credentials-provider") {
133
- return plist_1.default.build({
134
- NSExtension: {
135
- NSExtensionPointIdentifier,
136
- NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).CredentialProviderViewController",
137
- },
138
- });
139
- }
140
- else if (type === "notification-service") {
141
- return plist_1.default.build({
142
- NSExtension: {
143
- NSExtensionAttributes: {
144
- NSExtensionActivationRule: "TRUEPREDICATE",
94
+ };
95
+ case "clip":
96
+ return {
97
+ CFBundleName: "$(PRODUCT_NAME)",
98
+ CFBundleIdentifier: "$(PRODUCT_BUNDLE_IDENTIFIER)",
99
+ CFBundleVersion: "$(CURRENT_PROJECT_VERSION)",
100
+ CFBundleExecutable: "$(EXECUTABLE_NAME)",
101
+ CFBundlePackageType: "$(PRODUCT_BUNDLE_PACKAGE_TYPE)",
102
+ CFBundleShortVersionString: "$(MARKETING_VERSION)",
103
+ UIApplicationSupportsIndirectInputEvents: true,
104
+ NSAppClip: {
105
+ NSAppClipRequestEphemeralUserNotification: false,
106
+ NSAppClipRequestLocationConfirmation: false,
145
107
  },
146
- // TODO: Update `NotificationService` dynamically
147
- NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).NotificationService",
148
- // NSExtensionMainStoryboard: 'MainInterface',
149
- NSExtensionPointIdentifier,
150
- },
151
- });
152
- }
153
- else if (type === "quicklook-thumbnail") {
154
- return plist_1.default.build({
155
- NSExtension: {
156
- NSExtensionAttributes: {
157
- QLSupportedContentTypes: [],
158
- QLThumbnailMinimumDimension: 0,
108
+ NSAppTransportSecurity: {
109
+ NSAllowsArbitraryLoads: false,
110
+ NSAllowsLocalNetworking: true,
159
111
  },
160
- NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).ThumbnailProvider",
161
- NSExtensionPointIdentifier,
162
- },
163
- });
164
- }
165
- else if (type === "spotlight") {
166
- return plist_1.default.build({
167
- CSExtensionLabel: "myImporter",
168
- NSExtension: {
169
- NSExtensionAttributes: {
170
- CSSupportedContentTypes: ["com.example.plain-text"],
112
+ UILaunchStoryboardName: "SplashScreen",
113
+ UIUserInterfaceStyle: "Automatic",
114
+ UIViewControllerBasedStatusBarAppearance: false,
115
+ };
116
+ case "imessage":
117
+ return {
118
+ NSExtension: {
119
+ NSExtensionPointIdentifier,
120
+ // This is hardcoded as there is no Swift code in the imessage extension.
121
+ NSExtensionPrincipalClass: "StickerBrowserViewController",
171
122
  },
172
- // TODO: Update `ImportExtension` dynamically
173
- NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).ImportExtension",
174
- // NSExtensionMainStoryboard: 'MainInterface',
175
- NSExtensionPointIdentifier,
176
- },
177
- });
178
- }
179
- else if (type === "share") {
180
- return plist_1.default.build({
181
- NSExtension: {
182
- NSExtensionAttributes: {
183
- NSExtensionActivationRule: "TRUEPREDICATE",
123
+ };
124
+ case "account-auth":
125
+ return {
126
+ NSExtension: {
127
+ NSExtensionPointIdentifier,
128
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).AccountAuthViewController",
129
+ NSExtensionAttributes: {
130
+ ASAccountAuthenticationModificationSupportsStrongPasswordChange: true,
131
+ ASAccountAuthenticationModificationSupportsUpgradeToSignInWithApple: true,
132
+ },
184
133
  },
185
- // TODO: Update `ShareViewController` dynamically
186
- NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).ShareViewController",
187
- // NSExtensionMainStoryboard: 'MainInterface',
188
- NSExtensionPointIdentifier,
189
- },
190
- });
191
- }
192
- else if (type === "intent-ui") {
193
- return plist_1.default.build({
194
- NSExtension: {
195
- NSExtensionAttributes: {
196
- IntentsSupported: ["INSendMessageIntent"],
134
+ };
135
+ case "credentials-provider":
136
+ return {
137
+ NSExtension: {
138
+ NSExtensionPointIdentifier,
139
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).CredentialProviderViewController",
197
140
  },
198
- // TODO: Update `IntentViewController` dynamically
199
- NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).IntentViewController",
200
- NSExtensionPointIdentifier,
201
- },
202
- });
203
- }
204
- else if (type === "intent") {
205
- return plist_1.default.build({
206
- NSExtension: {
207
- NSExtensionAttributes: {
208
- IntentsRestrictedWhileLocked: [],
209
- IntentsSupported: [
210
- "INSendMessageIntent",
211
- "INSearchForMessagesIntent",
212
- "INSetMessageAttributeIntent",
213
- ],
141
+ };
142
+ case "keyboard":
143
+ return {
144
+ NSExtension: {
145
+ NSExtensionPointIdentifier,
146
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).KeyboardViewController",
147
+ NSExtensionAttributes: {
148
+ RequestsOpenAccess: false,
149
+ IsASCIICapable: false,
150
+ PrefersRightToLeft: false,
151
+ PrimaryLanguage: "en-US",
152
+ },
214
153
  },
215
- // TODO: Update `IntentHandler` dynamically
216
- NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).IntentHandler",
217
- NSExtensionPointIdentifier,
218
- },
219
- });
220
- }
221
- else if (type === "matter") {
222
- return plist_1.default.build({
223
- NSExtension: {
224
- NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).RequestHandler",
225
- NSExtensionPointIdentifier,
226
- },
227
- });
228
- }
229
- else if (type === "location-push") {
230
- return plist_1.default.build({
231
- NSExtension: {
232
- NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).LocationPushService",
233
- NSExtensionPointIdentifier,
234
- },
235
- });
236
- }
237
- else if (type === "safari") {
238
- return plist_1.default.build({
239
- NSExtension: {
240
- // TODO: Update `SafariWebExtensionHandler` dynamically
241
- NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).SafariWebExtensionHandler",
242
- // NSExtensionMainStoryboard: 'MainInterface',
243
- NSExtensionPointIdentifier,
244
- },
245
- });
246
- }
247
- else if (type === "notification-content") {
248
- return plist_1.default.build({
249
- NSExtension: {
250
- NSExtensionAttributes: {
251
- UNNotificationExtensionCategory: "myNotificationCategory",
252
- UNNotificationExtensionInitialContentSizeRatio: 1,
154
+ };
155
+ case "notification-service":
156
+ return {
157
+ NSExtension: {
158
+ NSExtensionAttributes: {
159
+ NSExtensionActivationRule: "TRUEPREDICATE",
160
+ },
161
+ // TODO: Update `NotificationService` dynamically
162
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).NotificationService",
163
+ // NSExtensionMainStoryboard: 'MainInterface',
164
+ NSExtensionPointIdentifier,
253
165
  },
254
- // TODO: Update `NotificationViewController` dynamically
255
- NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).NotificationViewController",
256
- // NSExtensionMainStoryboard: 'MainInterface',
257
- NSExtensionPointIdentifier,
258
- },
259
- });
166
+ };
167
+ case "quicklook-thumbnail":
168
+ return {
169
+ NSExtension: {
170
+ NSExtensionAttributes: {
171
+ QLSupportedContentTypes: [],
172
+ QLThumbnailMinimumDimension: 0,
173
+ },
174
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).ThumbnailProvider",
175
+ NSExtensionPointIdentifier,
176
+ },
177
+ };
178
+ case "spotlight":
179
+ return {
180
+ CSExtensionLabel: "myImporter",
181
+ NSExtension: {
182
+ NSExtensionAttributes: {
183
+ CSSupportedContentTypes: ["com.example.plain-text"],
184
+ },
185
+ // TODO: Update `ImportExtension` dynamically
186
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).ImportExtension",
187
+ // NSExtensionMainStoryboard: 'MainInterface',
188
+ NSExtensionPointIdentifier,
189
+ },
190
+ };
191
+ case "share":
192
+ return {
193
+ NSExtension: {
194
+ NSExtensionAttributes: {
195
+ NSExtensionActivationRule: "TRUEPREDICATE",
196
+ },
197
+ // TODO: Update `ShareViewController` dynamically
198
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).ShareViewController",
199
+ // NSExtensionMainStoryboard: 'MainInterface',
200
+ NSExtensionPointIdentifier,
201
+ },
202
+ };
203
+ case "intent-ui":
204
+ return {
205
+ NSExtension: {
206
+ NSExtensionAttributes: {
207
+ IntentsSupported: ["INSendMessageIntent"],
208
+ },
209
+ // TODO: Update `IntentViewController` dynamically
210
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).IntentViewController",
211
+ NSExtensionPointIdentifier,
212
+ },
213
+ };
214
+ case "intent":
215
+ return {
216
+ NSExtension: {
217
+ NSExtensionAttributes: {
218
+ IntentsRestrictedWhileLocked: [],
219
+ IntentsSupported: [
220
+ "INSendMessageIntent",
221
+ "INSearchForMessagesIntent",
222
+ "INSetMessageAttributeIntent",
223
+ ],
224
+ },
225
+ // TODO: Update `IntentHandler` dynamically
226
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).IntentHandler",
227
+ NSExtensionPointIdentifier,
228
+ },
229
+ };
230
+ case "matter":
231
+ return {
232
+ NSExtension: {
233
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).RequestHandler",
234
+ NSExtensionPointIdentifier,
235
+ },
236
+ };
237
+ case "location-push":
238
+ return {
239
+ NSExtension: {
240
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).LocationPushService",
241
+ NSExtensionPointIdentifier,
242
+ },
243
+ };
244
+ case "safari":
245
+ return {
246
+ NSExtension: {
247
+ // TODO: Update `SafariWebExtensionHandler` dynamically
248
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).SafariWebExtensionHandler",
249
+ // NSExtensionMainStoryboard: 'MainInterface',
250
+ NSExtensionPointIdentifier,
251
+ },
252
+ };
253
+ case "notification-content":
254
+ return {
255
+ NSExtension: {
256
+ NSExtensionAttributes: {
257
+ UNNotificationExtensionCategory: "myNotificationCategory",
258
+ UNNotificationExtensionInitialContentSizeRatio: 1,
259
+ },
260
+ // TODO: Update `NotificationViewController` dynamically
261
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).NotificationViewController",
262
+ // NSExtensionMainStoryboard: 'MainInterface',
263
+ NSExtensionPointIdentifier,
264
+ },
265
+ };
266
+ case "network-packet-tunnel":
267
+ return {
268
+ NSExtension: {
269
+ NSExtensionPointIdentifier: "com.apple.networkextension.packet-tunnel",
270
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).PacketTunnelProvider",
271
+ },
272
+ };
273
+ case "network-app-proxy":
274
+ return {
275
+ NSExtension: {
276
+ NSExtensionPointIdentifier: "com.apple.networkextension.app-proxy",
277
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).AppProxyProvider",
278
+ },
279
+ };
280
+ case "network-dns-proxy":
281
+ return {
282
+ NSExtension: {
283
+ NSExtensionPointIdentifier: "com.apple.networkextension.dns-proxy",
284
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).DNSProxyProvider",
285
+ },
286
+ };
287
+ case "network-filter-data":
288
+ return {
289
+ NSExtension: {
290
+ NSExtensionPointIdentifier: "com.apple.networkextension.filter-data",
291
+ NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).FilterDataProvider",
292
+ },
293
+ };
294
+ default:
295
+ // Default: used for widget and bg-download
296
+ return {
297
+ NSExtension: {
298
+ NSExtensionPointIdentifier,
299
+ },
300
+ };
260
301
  }
261
- // Default: used for widget and bg-download
262
- return plist_1.default.build({
263
- NSExtension: {
264
- NSExtensionPointIdentifier,
265
- },
266
- });
267
302
  }
268
303
  exports.getTargetInfoPlistForType = getTargetInfoPlistForType;
269
304
  function productTypeForType(type) {
@@ -290,48 +325,53 @@ function needsEmbeddedSwift(type) {
290
325
  "quicklook-thumbnail",
291
326
  "matter",
292
327
  "clip",
328
+ "network-packet-tunnel",
329
+ "network-app-proxy",
330
+ "network-dns-proxy",
331
+ "network-filter-data",
332
+ "keyboard",
293
333
  ].includes(type);
294
334
  }
295
335
  exports.needsEmbeddedSwift = needsEmbeddedSwift;
296
336
  function getFrameworksForType(type) {
297
- if (type === "widget") {
298
- return [
299
- // CD07060B2A2EBE2E009C1192 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
300
- "WidgetKit",
301
- // CD07060D2A2EBE2E009C1192 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
302
- "SwiftUI",
303
- "ActivityKit",
304
- "AppIntents",
305
- ];
306
- }
307
- else if (type === "intent") {
308
- return ["Intents"];
309
- }
310
- else if (type === "intent-ui") {
311
- return ["IntentsUI"];
312
- }
313
- else if (type === "quicklook-thumbnail") {
314
- return ["QuickLookThumbnailing"];
315
- }
316
- else if (type === "notification-content") {
317
- return ["UserNotifications", "UserNotificationsUI"];
318
- }
319
- else if (type === "app-intent") {
320
- return ["AppIntents"];
321
- }
322
- else if (type === "device-activity-monitor") {
323
- return ["DeviceActivity"];
324
- }
325
- else if (type === "action") {
326
- return [
327
- // "UniformTypeIdentifiers"
328
- ];
337
+ switch (type) {
338
+ case "widget":
339
+ return [
340
+ // CD07060B2A2EBE2E009C1192 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
341
+ "WidgetKit",
342
+ // CD07060D2A2EBE2E009C1192 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
343
+ "SwiftUI",
344
+ "ActivityKit",
345
+ "AppIntents",
346
+ ];
347
+ case "intent":
348
+ return ["Intents"];
349
+ case "intent-ui":
350
+ return ["IntentsUI"];
351
+ case "quicklook-thumbnail":
352
+ return ["QuickLookThumbnailing"];
353
+ case "notification-content":
354
+ return ["UserNotifications", "UserNotificationsUI"];
355
+ case "app-intent":
356
+ return ["AppIntents"];
357
+ case "device-activity-monitor":
358
+ return ["DeviceActivity"];
359
+ case "action":
360
+ return [
361
+ // "UniformTypeIdentifiers"
362
+ ];
363
+ case "network-packet-tunnel":
364
+ case "network-app-proxy":
365
+ case "network-dns-proxy":
366
+ case "network-filter-data":
367
+ return ["NetworkExtension"];
368
+ default:
369
+ return [];
329
370
  }
330
- return [];
331
371
  }
332
372
  exports.getFrameworksForType = getFrameworksForType;
333
373
  function isNativeTargetOfType(target, type) {
334
- var _a, _b;
374
+ var _a;
335
375
  if (type === "watch" &&
336
376
  target.props.productType === "com.apple.product-type.application") {
337
377
  return ("WATCHOS_DEPLOYMENT_TARGET" in
@@ -352,7 +392,9 @@ function isNativeTargetOfType(target, type) {
352
392
  target.getDisplayName());
353
393
  return false;
354
394
  }
355
- return (exports.KNOWN_EXTENSION_POINT_IDENTIFIERS[(_b = infoPlist.NSExtension) === null || _b === void 0 ? void 0 : _b.NSExtensionPointIdentifier] === type);
395
+ const identifier = infoPlist.NSExtension.NSExtensionPointIdentifier;
396
+ const mappedType = exports.KNOWN_EXTENSION_POINT_IDENTIFIERS[identifier];
397
+ return mappedType === type;
356
398
  }
357
399
  exports.isNativeTargetOfType = isNativeTargetOfType;
358
400
  function getMainAppTarget(project) {
@@ -0,0 +1,18 @@
1
+ export declare const warnOnce: {
2
+ (...data: any[]): void;
3
+ (message?: any, ...optionalParams: any[]): void;
4
+ };
5
+ export declare const logOnce: {
6
+ (...data: any[]): void;
7
+ (message?: any, ...optionalParams: any[]): void;
8
+ };
9
+ export declare function createLogQueue(): {
10
+ add: (fn: Function) => void;
11
+ flush: () => void;
12
+ };
13
+ export declare const LOG_QUEUE: {
14
+ add: (fn: Function) => void;
15
+ flush: () => void;
16
+ };
17
+ export declare function getSanitizedBundleIdentifier(value: string): string;
18
+ export declare function sanitizeNameForNonDisplayUse(name: string): string;
package/build/util.js ADDED
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sanitizeNameForNonDisplayUse = exports.getSanitizedBundleIdentifier = exports.LOG_QUEUE = exports.createLogQueue = exports.logOnce = exports.warnOnce = void 0;
4
+ function memoize(fn) {
5
+ const cache = new Map();
6
+ return ((...args) => {
7
+ const key = JSON.stringify(args);
8
+ if (cache.has(key)) {
9
+ return cache.get(key);
10
+ }
11
+ const result = fn(...args);
12
+ cache.set(key, result);
13
+ return result;
14
+ });
15
+ }
16
+ exports.warnOnce = memoize(console.warn);
17
+ exports.logOnce = memoize(console.log);
18
+ function createLogQueue() {
19
+ const queue = [];
20
+ const flush = () => {
21
+ queue.forEach((fn) => fn());
22
+ queue.length = 0;
23
+ };
24
+ return {
25
+ flush,
26
+ add: (fn) => {
27
+ queue.push(fn);
28
+ },
29
+ };
30
+ }
31
+ exports.createLogQueue = createLogQueue;
32
+ // Queue up logs so they only run when prebuild is actually running and not during standard config reads.
33
+ exports.LOG_QUEUE = createLogQueue();
34
+ function getSanitizedBundleIdentifier(value) {
35
+ // According to the behavior observed when using the UI in Xcode.
36
+ // Must start with a letter, period, or hyphen (not number).
37
+ // Can only contain alphanumeric characters, periods, and hyphens.
38
+ // Can have empty segments (e.g. com.example..app).
39
+ return value.replace(/(^[^a-zA-Z.-]|[^a-zA-Z0-9-.])/g, "-");
40
+ }
41
+ exports.getSanitizedBundleIdentifier = getSanitizedBundleIdentifier;
42
+ function sanitizeNameForNonDisplayUse(name) {
43
+ return name
44
+ .replace(/[\W_]+/g, "")
45
+ .normalize("NFD")
46
+ .replace(/[\u0300-\u036f]/g, "");
47
+ }
48
+ exports.sanitizeNameForNonDisplayUse = sanitizeNameForNonDisplayUse;