Skip to content

Commit 5abe5d6

Browse files
EvanBaconclaude
andauthored
feat(targets): add print-service, smart-card, authentication-services; rename config list fn (#166)
Add three new Apple extension target types with full registry entries, Info.plist generation, build settings, Swift templates, e2e fixtures, and updated documentation. Also rename createNotificationContentConfigurationList to createDefaultConfigurationList since it's used as the default for most extension types. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0eb61b4 commit 5abe5d6

12 files changed

Lines changed: 104 additions & 6 deletions

File tree

packages/apple-targets/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,19 +323,19 @@ Ideally, this would be generated automatically based on a fully qualified Xcode
323323
| virtual-conference | Virtual Conference Provider |
324324
| shield-action | Shield Action Extension |
325325
| shield-config | Shield Configuration Extension |
326+
| print-service | Print Service Extension |
327+
| smart-card | Smart Card / Persistent Token |
328+
| authentication-services | Authentication Services Extension |
326329

327330

328331
<!-- | imessage | iMessage Extension | -->
329332

330333
### Not yet supported
331334

332-
The following iOS extension types exist in Xcode but aren't supported yet. Contributions welcome! See `docs/xcode-target-discovery.md` for details on how these were discovered.
335+
The following extension types exist in Xcode but aren't supported yet. Contributions welcome! See `docs/xcode-target-discovery.md` for details on how these were discovered.
333336

334337
| Extension Point Identifier | Xcode Template Name |
335338
| --- | --- |
336-
| `com.apple.printing.discovery` | Print Service Extension |
337-
| `com.apple.ctk-tokens` | Smart Card / Persistent Token Extension |
338-
| `com.apple.AppSSO.idp-extension` | Authentication Services Extension |
339339
| `com.apple.tv-top-shelf` | TV Top Shelf Extension (tvOS) |
340340
| `com.apple.FinderSync` | Finder Sync Extension (macOS) |
341341
| `com.apple.email.extension` | Mail Extension (macOS) |

packages/apple-targets/e2e/__tests__/build.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ const TARGET_REGISTRY: TargetEntry[] = [
143143
},
144144
{ type: "shield-action", dir: "shield-action", target: "shieldaction" },
145145
{ type: "shield-config", dir: "shield-config", target: "shieldconfig" },
146+
{ type: "print-service", dir: "print-service", target: "printservice" },
147+
{ type: "smart-card", dir: "smart-card", target: "smartcard" },
148+
{
149+
type: "authentication-services",
150+
dir: "authentication-services",
151+
target: "authenticationservices",
152+
},
146153
];
147154

148155
// Derived from the central TARGET_REGISTRY — no need to maintain by hand.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "type": "authentication-services" }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "type": "print-service" }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "type": "smart-card" }

packages/apple-targets/src/configuration-list.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export type XcodeSettings = {
4646

4747
export type DeviceFamily = "phone" | "tablet";
4848

49-
function createNotificationContentConfigurationList({
49+
function createDefaultConfigurationList({
5050
name,
5151
displayName,
5252
cwd,
@@ -818,7 +818,10 @@ function getConfigurationListBuildSettingsForType(
818818
case "virtual-conference":
819819
case "shield-action":
820820
case "shield-config":
821-
return createNotificationContentConfigurationList(props);
821+
case "print-service":
822+
case "smart-card":
823+
case "authentication-services":
824+
return createDefaultConfigurationList(props);
822825
default:
823826
const exhaustiveCheck: never = props.type;
824827
throw new Error(`Unhandled case: ${exhaustiveCheck}`);

packages/apple-targets/src/target.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,22 @@ export const TARGET_REGISTRY = {
242242
frameworks: ["ManagedSettings", "ManagedSettingsUI"],
243243
displayName: "Shield Configuration",
244244
},
245+
"print-service": {
246+
extensionPointIdentifier: "com.apple.printing.discovery",
247+
displayName: "Print Service",
248+
},
249+
"smart-card": {
250+
extensionPointIdentifier: "com.apple.ctk-tokens",
251+
frameworks: ["CryptoTokenKit"],
252+
displayName: "Smart Card",
253+
description: "Persistent token / smart card extension",
254+
},
255+
"authentication-services": {
256+
extensionPointIdentifier: "com.apple.AppSSO.idp-extension",
257+
frameworks: ["AuthenticationServices"],
258+
displayName: "Authentication Services",
259+
description: "Single sign-on extension",
260+
},
245261
} as const satisfies Record<string, TargetDefinition>;
246262

247263
export type ExtensionType = keyof typeof TARGET_REGISTRY;
@@ -665,6 +681,30 @@ export function getTargetInfoPlistForType(type: ExtensionType) {
665681
"$(PRODUCT_MODULE_NAME).ShieldConfigurationExtension",
666682
},
667683
};
684+
case "print-service":
685+
return {
686+
NSExtension: {
687+
NSExtensionPointIdentifier,
688+
NSExtensionPrincipalClass:
689+
"$(PRODUCT_MODULE_NAME).PrintServiceExtension",
690+
},
691+
};
692+
case "smart-card":
693+
return {
694+
NSExtension: {
695+
NSExtensionPointIdentifier,
696+
NSExtensionPrincipalClass:
697+
"$(PRODUCT_MODULE_NAME).TokenExtension",
698+
},
699+
};
700+
case "authentication-services":
701+
return {
702+
NSExtension: {
703+
NSExtensionPointIdentifier,
704+
NSExtensionPrincipalClass:
705+
"$(PRODUCT_MODULE_NAME).AuthenticationExtension",
706+
},
707+
};
668708
default:
669709
// Default: used for widget and bg-download
670710
return {

packages/create-target/src/__tests__/__snapshots__/createAsync.test.ts.snap

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ module.exports = config => ({
2626
});"
2727
`;
2828

29+
exports[`getTemplateConfig should return a valid template for authentication-services 1`] = `
30+
"/** @type {import('@bacons/apple-targets/app.plugin').ConfigFunction} */
31+
module.exports = config => ({
32+
type: \\"authentication-services\\",
33+
entitlements: { /* Add entitlements */ },
34+
});"
35+
`;
36+
2937
exports[`getTemplateConfig should return a valid template for bg-download 1`] = `
3038
"/** @type {import('@bacons/apple-targets/app.plugin').ConfigFunction} */
3139
module.exports = config => ({
@@ -163,6 +171,14 @@ module.exports = config => ({
163171
});"
164172
`;
165173

174+
exports[`getTemplateConfig should return a valid template for print-service 1`] = `
175+
"/** @type {import('@bacons/apple-targets/app.plugin').ConfigFunction} */
176+
module.exports = config => ({
177+
type: \\"print-service\\",
178+
entitlements: { /* Add entitlements */ },
179+
});"
180+
`;
181+
166182
exports[`getTemplateConfig should return a valid template for quicklook-preview 1`] = `
167183
"/** @type {import('@bacons/apple-targets/app.plugin').ConfigFunction} */
168184
module.exports = config => ({
@@ -214,6 +230,14 @@ module.exports = config => ({
214230
});"
215231
`;
216232

233+
exports[`getTemplateConfig should return a valid template for smart-card 1`] = `
234+
"/** @type {import('@bacons/apple-targets/app.plugin').ConfigFunction} */
235+
module.exports = config => ({
236+
type: \\"smart-card\\",
237+
entitlements: { /* Add entitlements */ },
238+
});"
239+
`;
240+
217241
exports[`getTemplateConfig should return a valid template for spotlight 1`] = `
218242
"/** @type {import('@bacons/apple-targets/app.plugin').ConfigFunction} */
219243
module.exports = config => ({

packages/create-target/src/__tests__/createAsync.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ const ALL_TARGET_TYPES = [
3333
"virtual-conference",
3434
"shield-action",
3535
"shield-config",
36+
"print-service",
37+
"smart-card",
38+
"authentication-services",
3639
];
3740

3841
describe(getTemplateConfig, () => {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import AuthenticationServices
2+
3+
class AuthenticationExtension: NSObject, ASAuthorizationProviderExtensionAuthorizationRequestHandler {
4+
5+
func beginAuthorization(with request: ASAuthorizationProviderExtensionAuthorizationRequest) {
6+
request.doNotHandle()
7+
}
8+
}

0 commit comments

Comments
 (0)