@bacons/apple-targets 0.0.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.
- package/LICENSE +21 -0
- package/README.md +218 -0
- package/app.plugin.js +1 -0
- package/build/colorset/customColorFromCSS.d.ts +10 -0
- package/build/colorset/customColorFromCSS.js +23 -0
- package/build/colorset/withIosColorset.d.ts +11 -0
- package/build/colorset/withIosColorset.js +65 -0
- package/build/config.d.ts +103 -0
- package/build/config.js +2 -0
- package/build/icon/withImageAsset.d.ts +26 -0
- package/build/icon/withImageAsset.js +250 -0
- package/build/icon/withIosIcon.d.ts +19 -0
- package/build/icon/withIosIcon.js +211 -0
- package/build/index.d.ts +8 -0
- package/build/index.js +29 -0
- package/build/target.d.ts +10 -0
- package/build/target.js +322 -0
- package/build/template/XCBuildConfiguration.json +759 -0
- package/build/withEasCredentials.d.ts +17 -0
- package/build/withEasCredentials.js +95 -0
- package/build/withWidget.d.ts +7 -0
- package/build/withWidget.js +158 -0
- package/build/withXcodeChanges.d.ts +17 -0
- package/build/withXcodeChanges.js +975 -0
- package/build/withXcparse.d.ts +4 -0
- package/build/withXcparse.js +77 -0
- package/package.json +41 -0
package/build/target.js
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getAuxiliaryTargets = exports.getMainAppTarget = exports.isNativeTargetOfType = exports.getFrameworksForType = exports.needsEmbeddedSwift = exports.productTypeForType = exports.getTargetInfoPlistForType = exports.KNOWN_EXTENSION_POINT_IDENTIFIERS = void 0;
|
|
7
|
+
const plist_1 = __importDefault(require("@expo/plist"));
|
|
8
|
+
exports.KNOWN_EXTENSION_POINT_IDENTIFIERS = {
|
|
9
|
+
"com.apple.message-payload-provider": "imessage",
|
|
10
|
+
"com.apple.widgetkit-extension": "widget",
|
|
11
|
+
"com.apple.usernotifications.content-extension": "notification-content",
|
|
12
|
+
"com.apple.share-services": "share",
|
|
13
|
+
"com.apple.usernotifications.service": "notification-service",
|
|
14
|
+
"com.apple.spotlight.import": "spotlight",
|
|
15
|
+
"com.apple.intents-service": "intent",
|
|
16
|
+
"com.apple.intents-ui-service": "intent-ui",
|
|
17
|
+
"com.apple.Safari.web-extension": "safari",
|
|
18
|
+
"com.apple.background-asset-downloader-extension": "bg-download",
|
|
19
|
+
"com.apple.matter.support.extension.device-setup": "matter",
|
|
20
|
+
"com.apple.quicklook.thumbnail": "quicklook-thumbnail",
|
|
21
|
+
"com.apple.location.push.service": "location-push",
|
|
22
|
+
"com.apple.authentication-services-credential-provider-ui": "credentials-provider",
|
|
23
|
+
"com.apple.authentication-services-account-authentication-modification-ui": "account-auth",
|
|
24
|
+
"com.apple.services": "action",
|
|
25
|
+
// "com.apple.intents-service": "intents",
|
|
26
|
+
};
|
|
27
|
+
// TODO: Maybe we can replace `NSExtensionPrincipalClass` with the `@main` annotation that newer extensions use?
|
|
28
|
+
function getTargetInfoPlistForType(type) {
|
|
29
|
+
if (type === "watch") {
|
|
30
|
+
return plist_1.default.build({});
|
|
31
|
+
}
|
|
32
|
+
if (type === "action") {
|
|
33
|
+
return plist_1.default.build({
|
|
34
|
+
NSExtension: {
|
|
35
|
+
NSExtensionAttributes: {
|
|
36
|
+
NSExtensionActivationRule: {
|
|
37
|
+
NSExtensionActivationSupportsFileWithMaxCount: 0,
|
|
38
|
+
NSExtensionActivationSupportsImageWithMaxCount: 0,
|
|
39
|
+
NSExtensionActivationSupportsMovieWithMaxCount: 0,
|
|
40
|
+
NSExtensionActivationSupportsText: false,
|
|
41
|
+
NSExtensionActivationSupportsWebURLWithMaxCount: 1,
|
|
42
|
+
},
|
|
43
|
+
NSExtensionJavaScriptPreprocessingFile: "assets/index",
|
|
44
|
+
NSExtensionServiceAllowsFinderPreviewItem: true,
|
|
45
|
+
NSExtensionServiceAllowsTouchBarItem: true,
|
|
46
|
+
NSExtensionServiceFinderPreviewIconName: "NSActionTemplate",
|
|
47
|
+
NSExtensionServiceTouchBarBezelColorName: "TouchBarBezel",
|
|
48
|
+
NSExtensionServiceTouchBarIconName: "NSActionTemplate",
|
|
49
|
+
},
|
|
50
|
+
NSExtensionPointIdentifier: "com.apple.services",
|
|
51
|
+
NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).ActionRequestHandler",
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (type === "clip") {
|
|
56
|
+
return plist_1.default.build({
|
|
57
|
+
CFBundleName: "$(PRODUCT_NAME)",
|
|
58
|
+
CFBundleIdentifier: "$(PRODUCT_BUNDLE_IDENTIFIER)",
|
|
59
|
+
CFBundleVersion: "$(CURRENT_PROJECT_VERSION)",
|
|
60
|
+
CFBundleExecutable: "$(EXECUTABLE_NAME)",
|
|
61
|
+
CFBundlePackageType: "$(PRODUCT_BUNDLE_PACKAGE_TYPE)",
|
|
62
|
+
CFBundleShortVersionString: "$(MARKETING_VERSION)",
|
|
63
|
+
UIApplicationSupportsIndirectInputEvents: true,
|
|
64
|
+
NSAppClip: {
|
|
65
|
+
NSAppClipRequestEphemeralUserNotification: false,
|
|
66
|
+
NSAppClipRequestLocationConfirmation: false,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const NSExtensionPointIdentifier = Object.keys(exports.KNOWN_EXTENSION_POINT_IDENTIFIERS).find((key) => exports.KNOWN_EXTENSION_POINT_IDENTIFIERS[key] === type);
|
|
71
|
+
if (type === "imessage") {
|
|
72
|
+
return plist_1.default.build({
|
|
73
|
+
NSExtension: {
|
|
74
|
+
NSExtensionPointIdentifier,
|
|
75
|
+
// This is hardcoded as there is no Swift code in the imessage extension.
|
|
76
|
+
NSExtensionPrincipalClass: "StickerBrowserViewController",
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (type === "account-auth") {
|
|
81
|
+
return plist_1.default.build({
|
|
82
|
+
NSExtension: {
|
|
83
|
+
NSExtensionPointIdentifier,
|
|
84
|
+
NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).AccountAuthViewController",
|
|
85
|
+
NSExtensionAttributes: {
|
|
86
|
+
ASAccountAuthenticationModificationSupportsStrongPasswordChange: true,
|
|
87
|
+
ASAccountAuthenticationModificationSupportsUpgradeToSignInWithApple: true,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (type === "credentials-provider") {
|
|
93
|
+
return plist_1.default.build({
|
|
94
|
+
NSExtension: {
|
|
95
|
+
NSExtensionPointIdentifier,
|
|
96
|
+
NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).CredentialProviderViewController",
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (type === "notification-service") {
|
|
101
|
+
return plist_1.default.build({
|
|
102
|
+
NSExtension: {
|
|
103
|
+
NSExtensionAttributes: {
|
|
104
|
+
NSExtensionActivationRule: "TRUEPREDICATE",
|
|
105
|
+
},
|
|
106
|
+
// TODO: Update `NotificationService` dynamically
|
|
107
|
+
NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).NotificationService",
|
|
108
|
+
// NSExtensionMainStoryboard: 'MainInterface',
|
|
109
|
+
NSExtensionPointIdentifier,
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
else if (type === "quicklook-thumbnail") {
|
|
114
|
+
return plist_1.default.build({
|
|
115
|
+
NSExtension: {
|
|
116
|
+
NSExtensionAttributes: {
|
|
117
|
+
QLSupportedContentTypes: [],
|
|
118
|
+
QLThumbnailMinimumDimension: 0,
|
|
119
|
+
},
|
|
120
|
+
NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).ThumbnailProvider",
|
|
121
|
+
NSExtensionPointIdentifier,
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
else if (type === "spotlight") {
|
|
126
|
+
return plist_1.default.build({
|
|
127
|
+
CSExtensionLabel: "myImporter",
|
|
128
|
+
NSExtension: {
|
|
129
|
+
NSExtensionAttributes: {
|
|
130
|
+
CSSupportedContentTypes: ["com.example.plain-text"],
|
|
131
|
+
},
|
|
132
|
+
// TODO: Update `ImportExtension` dynamically
|
|
133
|
+
NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).ImportExtension",
|
|
134
|
+
// NSExtensionMainStoryboard: 'MainInterface',
|
|
135
|
+
NSExtensionPointIdentifier,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
else if (type === "share") {
|
|
140
|
+
return plist_1.default.build({
|
|
141
|
+
NSExtension: {
|
|
142
|
+
NSExtensionAttributes: {
|
|
143
|
+
NSExtensionActivationRule: "TRUEPREDICATE",
|
|
144
|
+
},
|
|
145
|
+
// TODO: Update `ShareViewController` dynamically
|
|
146
|
+
NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).ShareViewController",
|
|
147
|
+
// NSExtensionMainStoryboard: 'MainInterface',
|
|
148
|
+
NSExtensionPointIdentifier,
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
else if (type === "intent-ui") {
|
|
153
|
+
return plist_1.default.build({
|
|
154
|
+
NSExtension: {
|
|
155
|
+
NSExtensionAttributes: {
|
|
156
|
+
IntentsSupported: ["INSendMessageIntent"],
|
|
157
|
+
},
|
|
158
|
+
// TODO: Update `IntentViewController` dynamically
|
|
159
|
+
NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).IntentViewController",
|
|
160
|
+
NSExtensionPointIdentifier,
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
else if (type === "intent") {
|
|
165
|
+
return plist_1.default.build({
|
|
166
|
+
NSExtension: {
|
|
167
|
+
NSExtensionAttributes: {
|
|
168
|
+
IntentsRestrictedWhileLocked: [],
|
|
169
|
+
IntentsSupported: [
|
|
170
|
+
"INSendMessageIntent",
|
|
171
|
+
"INSearchForMessagesIntent",
|
|
172
|
+
"INSetMessageAttributeIntent",
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
// TODO: Update `IntentHandler` dynamically
|
|
176
|
+
NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).IntentHandler",
|
|
177
|
+
NSExtensionPointIdentifier,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
else if (type === "matter") {
|
|
182
|
+
return plist_1.default.build({
|
|
183
|
+
NSExtension: {
|
|
184
|
+
NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).RequestHandler",
|
|
185
|
+
NSExtensionPointIdentifier,
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
else if (type === "location-push") {
|
|
190
|
+
return plist_1.default.build({
|
|
191
|
+
NSExtension: {
|
|
192
|
+
NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).LocationPushService",
|
|
193
|
+
NSExtensionPointIdentifier,
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
else if (type === "safari") {
|
|
198
|
+
return plist_1.default.build({
|
|
199
|
+
NSExtension: {
|
|
200
|
+
// TODO: Update `SafariWebExtensionHandler` dynamically
|
|
201
|
+
NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).SafariWebExtensionHandler",
|
|
202
|
+
// NSExtensionMainStoryboard: 'MainInterface',
|
|
203
|
+
NSExtensionPointIdentifier,
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
else if (type === "notification-content") {
|
|
208
|
+
return plist_1.default.build({
|
|
209
|
+
NSExtension: {
|
|
210
|
+
NSExtensionAttributes: {
|
|
211
|
+
UNNotificationExtensionCategory: "myNotificationCategory",
|
|
212
|
+
UNNotificationExtensionInitialContentSizeRatio: 1,
|
|
213
|
+
},
|
|
214
|
+
// TODO: Update `NotificationViewController` dynamically
|
|
215
|
+
NSExtensionPrincipalClass: "$(PRODUCT_MODULE_NAME).NotificationViewController",
|
|
216
|
+
// NSExtensionMainStoryboard: 'MainInterface',
|
|
217
|
+
NSExtensionPointIdentifier,
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
// Default: used for widget and bg-download
|
|
222
|
+
return plist_1.default.build({
|
|
223
|
+
NSExtension: {
|
|
224
|
+
NSExtensionPointIdentifier,
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
exports.getTargetInfoPlistForType = getTargetInfoPlistForType;
|
|
229
|
+
function productTypeForType(type) {
|
|
230
|
+
switch (type) {
|
|
231
|
+
case "clip":
|
|
232
|
+
return "com.apple.product-type.application.on-demand-install-capable";
|
|
233
|
+
case "watch":
|
|
234
|
+
return "com.apple.product-type.application";
|
|
235
|
+
default:
|
|
236
|
+
return "com.apple.product-type.app-extension";
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
exports.productTypeForType = productTypeForType;
|
|
240
|
+
function needsEmbeddedSwift(type) {
|
|
241
|
+
return [
|
|
242
|
+
"watch",
|
|
243
|
+
"spotlight",
|
|
244
|
+
"share",
|
|
245
|
+
"intent",
|
|
246
|
+
"intent-ui",
|
|
247
|
+
"bg-download",
|
|
248
|
+
"quicklook-thumbnail",
|
|
249
|
+
"matter",
|
|
250
|
+
"clip",
|
|
251
|
+
].includes(type);
|
|
252
|
+
}
|
|
253
|
+
exports.needsEmbeddedSwift = needsEmbeddedSwift;
|
|
254
|
+
function getFrameworksForType(type) {
|
|
255
|
+
if (type === "widget") {
|
|
256
|
+
return [
|
|
257
|
+
// CD07060B2A2EBE2E009C1192 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
|
|
258
|
+
"WidgetKit",
|
|
259
|
+
// CD07060D2A2EBE2E009C1192 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
|
|
260
|
+
"SwiftUI",
|
|
261
|
+
];
|
|
262
|
+
}
|
|
263
|
+
else if (type === "intent") {
|
|
264
|
+
return ["Intents"];
|
|
265
|
+
}
|
|
266
|
+
else if (type === "intent-ui") {
|
|
267
|
+
return ["IntentsUI"];
|
|
268
|
+
}
|
|
269
|
+
else if (type === "quicklook-thumbnail") {
|
|
270
|
+
return ["QuickLookThumbnailing"];
|
|
271
|
+
}
|
|
272
|
+
else if (type === "notification-content") {
|
|
273
|
+
return ["UserNotifications", "UserNotificationsUI"];
|
|
274
|
+
}
|
|
275
|
+
else if (type === "action") {
|
|
276
|
+
return [
|
|
277
|
+
// "UniformTypeIdentifiers"
|
|
278
|
+
];
|
|
279
|
+
}
|
|
280
|
+
return [];
|
|
281
|
+
}
|
|
282
|
+
exports.getFrameworksForType = getFrameworksForType;
|
|
283
|
+
function isNativeTargetOfType(target, type) {
|
|
284
|
+
var _a, _b;
|
|
285
|
+
if (type === "watch" &&
|
|
286
|
+
target.props.productType === "com.apple.product-type.application") {
|
|
287
|
+
return ("WATCHOS_DEPLOYMENT_TARGET" in
|
|
288
|
+
target.getDefaultConfiguration().props.buildSettings);
|
|
289
|
+
}
|
|
290
|
+
if (type === "clip" &&
|
|
291
|
+
target.props.productType ===
|
|
292
|
+
"com.apple.product-type.application.on-demand-install-capable") {
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
if (target.props.productType !== "com.apple.product-type.app-extension") {
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
// Could be a Today Extension, Share Extension, etc.
|
|
299
|
+
const infoPlist = target.getDefaultConfiguration().getInfoPlist();
|
|
300
|
+
if (!((_a = infoPlist.NSExtension) === null || _a === void 0 ? void 0 : _a.NSExtensionPointIdentifier)) {
|
|
301
|
+
console.error("No NSExtensionPointIdentifier found in extension Info.plist for target: " +
|
|
302
|
+
target.getDisplayName());
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
305
|
+
return (exports.KNOWN_EXTENSION_POINT_IDENTIFIERS[(_b = infoPlist.NSExtension) === null || _b === void 0 ? void 0 : _b.NSExtensionPointIdentifier] === type);
|
|
306
|
+
}
|
|
307
|
+
exports.isNativeTargetOfType = isNativeTargetOfType;
|
|
308
|
+
function getMainAppTarget(project) {
|
|
309
|
+
const target = project.rootObject.getMainAppTarget("ios");
|
|
310
|
+
if (!target) {
|
|
311
|
+
throw new Error("No main app target found");
|
|
312
|
+
}
|
|
313
|
+
return target;
|
|
314
|
+
}
|
|
315
|
+
exports.getMainAppTarget = getMainAppTarget;
|
|
316
|
+
function getAuxiliaryTargets(project) {
|
|
317
|
+
const mainTarget = project.rootObject.getMainAppTarget("ios");
|
|
318
|
+
return project.rootObject.props.targets.filter((target) => {
|
|
319
|
+
return target.uuid !== (mainTarget === null || mainTarget === void 0 ? void 0 : mainTarget.uuid);
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
exports.getAuxiliaryTargets = getAuxiliaryTargets;
|