expo-targets 0.1.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/.eslintrc.js +2 -0
- package/README.md +244 -0
- package/android/build.gradle +22 -0
- package/android/src/main/java/expo/modules/targets/ExpoTargetsLogger.kt +98 -0
- package/android/src/main/java/expo/modules/targets/ExpoTargetsReceiver.kt +136 -0
- package/android/src/main/java/expo/modules/targets/ExpoTargetsRemoteViewsProvider.kt +72 -0
- package/android/src/main/java/expo/modules/targets/ExpoTargetsWidgetProvider.kt +47 -0
- package/android/src/main/java/expo/modules/targets/ExpoTargetsWidgetSync.kt +78 -0
- package/android/src/main/java/expo/modules/targets/ExpoTargetsWidgetUpdateReceiver.kt +30 -0
- package/android/src/main/java/expo/modules/targets/extension/ExpoTargetsExtensionModule.kt +27 -0
- package/android/src/main/java/expo/modules/targets/messages/ExpoTargetsMessagesModule.kt +40 -0
- package/android/src/main/java/expo/modules/targets/storage/ExpoTargetsStorageModule.kt +119 -0
- package/app.plugin.js +1 -0
- package/build/metro/src/index.d.ts +2 -0
- package/build/metro/src/index.d.ts.map +1 -0
- package/build/metro/src/index.js +6 -0
- package/build/metro/src/index.js.map +1 -0
- package/build/metro/src/withTargetsMetro.d.ts +6 -0
- package/build/metro/src/withTargetsMetro.d.ts.map +1 -0
- package/build/metro/src/withTargetsMetro.js +171 -0
- package/build/metro/src/withTargetsMetro.js.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidColors.d.ts +7 -0
- package/build/plugin/src/android/config-plugins/withAndroidColors.d.ts.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidColors.js +56 -0
- package/build/plugin/src/android/config-plugins/withAndroidColors.js.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidManifest.d.ts +7 -0
- package/build/plugin/src/android/config-plugins/withAndroidManifest.d.ts.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidManifest.js +70 -0
- package/build/plugin/src/android/config-plugins/withAndroidManifest.js.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidModule.d.ts +7 -0
- package/build/plugin/src/android/config-plugins/withAndroidModule.d.ts.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidModule.js +41 -0
- package/build/plugin/src/android/config-plugins/withAndroidModule.js.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidResources.d.ts +7 -0
- package/build/plugin/src/android/config-plugins/withAndroidResources.d.ts.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidResources.js +75 -0
- package/build/plugin/src/android/config-plugins/withAndroidResources.js.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidTarget.d.ts +28 -0
- package/build/plugin/src/android/config-plugins/withAndroidTarget.d.ts.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidTarget.js +28 -0
- package/build/plugin/src/android/config-plugins/withAndroidTarget.js.map +1 -0
- package/build/plugin/src/android/config-plugins/withGradleModule.d.ts +7 -0
- package/build/plugin/src/android/config-plugins/withGradleModule.d.ts.map +1 -0
- package/build/plugin/src/android/config-plugins/withGradleModule.js +86 -0
- package/build/plugin/src/android/config-plugins/withGradleModule.js.map +1 -0
- package/build/plugin/src/android/config-plugins/withGradleSettings.d.ts +7 -0
- package/build/plugin/src/android/config-plugins/withGradleSettings.d.ts.map +1 -0
- package/build/plugin/src/android/config-plugins/withGradleSettings.js +23 -0
- package/build/plugin/src/android/config-plugins/withGradleSettings.js.map +1 -0
- package/build/plugin/src/android/withAndroidAppBuildGradle.d.ts +7 -0
- package/build/plugin/src/android/withAndroidAppBuildGradle.d.ts.map +1 -0
- package/build/plugin/src/android/withAndroidAppBuildGradle.js +31 -0
- package/build/plugin/src/android/withAndroidAppBuildGradle.js.map +1 -0
- package/build/plugin/src/android/withAndroidKotlinGradleProperty.d.ts +3 -0
- package/build/plugin/src/android/withAndroidKotlinGradleProperty.d.ts.map +1 -0
- package/build/plugin/src/android/withAndroidKotlinGradleProperty.js +24 -0
- package/build/plugin/src/android/withAndroidKotlinGradleProperty.js.map +1 -0
- package/build/plugin/src/android/withAndroidProjectKotlinVersion.d.ts +3 -0
- package/build/plugin/src/android/withAndroidProjectKotlinVersion.d.ts.map +1 -0
- package/build/plugin/src/android/withAndroidProjectKotlinVersion.js +27 -0
- package/build/plugin/src/android/withAndroidProjectKotlinVersion.js.map +1 -0
- package/build/plugin/src/android/withAndroidTarget.d.ts +10 -0
- package/build/plugin/src/android/withAndroidTarget.d.ts.map +1 -0
- package/build/plugin/src/android/withAndroidTarget.js +22 -0
- package/build/plugin/src/android/withAndroidTarget.js.map +1 -0
- package/build/plugin/src/android/withAndroidWidget.d.ts +13 -0
- package/build/plugin/src/android/withAndroidWidget.d.ts.map +1 -0
- package/build/plugin/src/android/withAndroidWidget.js +564 -0
- package/build/plugin/src/android/withAndroidWidget.js.map +1 -0
- package/build/plugin/src/config.d.ts +141 -0
- package/build/plugin/src/config.d.ts.map +1 -0
- package/build/plugin/src/config.js +54 -0
- package/build/plugin/src/config.js.map +1 -0
- package/build/plugin/src/index.d.ts +9 -0
- package/build/plugin/src/index.d.ts.map +1 -0
- package/build/plugin/src/index.js +11 -0
- package/build/plugin/src/index.js.map +1 -0
- package/build/plugin/src/ios/config-plugins/withEntitlements.d.ts +11 -0
- package/build/plugin/src/ios/config-plugins/withEntitlements.d.ts.map +1 -0
- package/build/plugin/src/ios/config-plugins/withEntitlements.js +49 -0
- package/build/plugin/src/ios/config-plugins/withEntitlements.js.map +1 -0
- package/build/plugin/src/ios/config-plugins/withIOSTarget.d.ts +17 -0
- package/build/plugin/src/ios/config-plugins/withIOSTarget.d.ts.map +1 -0
- package/build/plugin/src/ios/config-plugins/withIOSTarget.js +152 -0
- package/build/plugin/src/ios/config-plugins/withIOSTarget.js.map +1 -0
- package/build/plugin/src/ios/config-plugins/withIosColorset.d.ts +8 -0
- package/build/plugin/src/ios/config-plugins/withIosColorset.d.ts.map +1 -0
- package/build/plugin/src/ios/config-plugins/withIosColorset.js +25 -0
- package/build/plugin/src/ios/config-plugins/withIosColorset.js.map +1 -0
- package/build/plugin/src/ios/config-plugins/withIosStickerPack.d.ts +8 -0
- package/build/plugin/src/ios/config-plugins/withIosStickerPack.d.ts.map +1 -0
- package/build/plugin/src/ios/config-plugins/withIosStickerPack.js +52 -0
- package/build/plugin/src/ios/config-plugins/withIosStickerPack.js.map +1 -0
- package/build/plugin/src/ios/config-plugins/withPodfile.d.ts +12 -0
- package/build/plugin/src/ios/config-plugins/withPodfile.d.ts.map +1 -0
- package/build/plugin/src/ios/config-plugins/withPodfile.js +162 -0
- package/build/plugin/src/ios/config-plugins/withPodfile.js.map +1 -0
- package/build/plugin/src/ios/config-plugins/withXcodeChanges.d.ts +15 -0
- package/build/plugin/src/ios/config-plugins/withXcodeChanges.d.ts.map +1 -0
- package/build/plugin/src/ios/config-plugins/withXcodeChanges.js +646 -0
- package/build/plugin/src/ios/config-plugins/withXcodeChanges.js.map +1 -0
- package/build/plugin/src/ios/target.d.ts +41 -0
- package/build/plugin/src/ios/target.d.ts.map +1 -0
- package/build/plugin/src/ios/target.js +574 -0
- package/build/plugin/src/ios/target.js.map +1 -0
- package/build/plugin/src/ios/utils/asset.d.ts +60 -0
- package/build/plugin/src/ios/utils/asset.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/asset.js +375 -0
- package/build/plugin/src/ios/utils/asset.js.map +1 -0
- package/build/plugin/src/ios/utils/file.d.ts +33 -0
- package/build/plugin/src/ios/utils/file.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/file.js +88 -0
- package/build/plugin/src/ios/utils/file.js.map +1 -0
- package/build/plugin/src/ios/utils/index.d.ts +12 -0
- package/build/plugin/src/ios/utils/index.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/index.js +38 -0
- package/build/plugin/src/ios/utils/index.js.map +1 -0
- package/build/plugin/src/ios/utils/paths.d.ts +128 -0
- package/build/plugin/src/ios/utils/paths.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/paths.js +141 -0
- package/build/plugin/src/ios/utils/paths.js.map +1 -0
- package/build/plugin/src/ios/utils/plist.d.ts +29 -0
- package/build/plugin/src/ios/utils/plist.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/plist.js +114 -0
- package/build/plugin/src/ios/utils/plist.js.map +1 -0
- package/build/plugin/src/ios/utils/podfile.d.ts +82 -0
- package/build/plugin/src/ios/utils/podfile.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/podfile.js +408 -0
- package/build/plugin/src/ios/utils/podfile.js.map +1 -0
- package/build/plugin/src/ios/utils/reactNativeSwift.d.ts +11 -0
- package/build/plugin/src/ios/utils/reactNativeSwift.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/reactNativeSwift.js +263 -0
- package/build/plugin/src/ios/utils/reactNativeSwift.js.map +1 -0
- package/build/plugin/src/ios/utils/xcode.d.ts +185 -0
- package/build/plugin/src/ios/utils/xcode.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/xcode.js +706 -0
- package/build/plugin/src/ios/utils/xcode.js.map +1 -0
- package/build/plugin/src/logger.d.ts +10 -0
- package/build/plugin/src/logger.d.ts.map +1 -0
- package/build/plugin/src/logger.js +62 -0
- package/build/plugin/src/logger.js.map +1 -0
- package/build/plugin/src/parseTargetConfig.d.ts +3 -0
- package/build/plugin/src/parseTargetConfig.d.ts.map +1 -0
- package/build/plugin/src/parseTargetConfig.js +113 -0
- package/build/plugin/src/parseTargetConfig.js.map +1 -0
- package/build/plugin/src/withTargetsDir.d.ts +6 -0
- package/build/plugin/src/withTargetsDir.d.ts.map +1 -0
- package/build/plugin/src/withTargetsDir.js +90 -0
- package/build/plugin/src/withTargetsDir.js.map +1 -0
- package/build/src/Target.d.ts +43 -0
- package/build/src/Target.d.ts.map +1 -0
- package/build/src/Target.js +128 -0
- package/build/src/Target.js.map +1 -0
- package/build/src/index.d.ts +9 -0
- package/build/src/index.d.ts.map +1 -0
- package/build/src/index.js +27 -0
- package/build/src/index.js.map +1 -0
- package/build/src/modules/extension/index.d.ts +18 -0
- package/build/src/modules/extension/index.d.ts.map +1 -0
- package/build/src/modules/extension/index.js +44 -0
- package/build/src/modules/extension/index.js.map +1 -0
- package/build/src/modules/messages/index.d.ts +40 -0
- package/build/src/modules/messages/index.d.ts.map +1 -0
- package/build/src/modules/messages/index.js +94 -0
- package/build/src/modules/messages/index.js.map +1 -0
- package/build/src/modules/storage/index.d.ts +16 -0
- package/build/src/modules/storage/index.d.ts.map +1 -0
- package/build/src/modules/storage/index.js +122 -0
- package/build/src/modules/storage/index.js.map +1 -0
- package/expo-module.config.json +17 -0
- package/ios/ExpoTargetsExtension.podspec +23 -0
- package/ios/ExpoTargetsExtensionModule.swift +181 -0
- package/ios/ExpoTargetsMessages.podspec +23 -0
- package/ios/ExpoTargetsMessagesModule.swift +267 -0
- package/ios/ExpoTargetsStorage.podspec +23 -0
- package/ios/ExpoTargetsStorageModule.swift +91 -0
- package/ios/Tests/.swiftlint.yml +52 -0
- package/ios/Tests/Helpers/MockExtensionContext.swift +58 -0
- package/ios/Tests/Helpers/MockUserDefaults.swift +70 -0
- package/ios/Tests/Helpers/MockWidgetCenter.swift +71 -0
- package/ios/Tests/Helpers/TestHelpers.swift +90 -0
- package/ios/Tests/Integration/TargetIntegrationTests.swift +478 -0
- package/ios/Tests/Main/AllTests.swift +80 -0
- package/ios/Tests/Package.swift +66 -0
- package/ios/Tests/Performance/StoragePerformanceTests.swift +461 -0
- package/ios/Tests/Unit/Extension/ExpoTargetsExtensionModuleTests.swift +501 -0
- package/ios/Tests/Unit/Storage/ExpoTargetsStorageModuleTests.swift +578 -0
- package/ios/Tests/Unit/Template/ShareExtensionTemplateTests.swift +421 -0
- package/ios/Tests/XCTestPlan.xctestplan +87 -0
- package/metro/src/index.ts +1 -0
- package/metro/src/withTargetsMetro.ts +247 -0
- package/metro/tsconfig.build.json +9 -0
- package/package.json +74 -0
- package/plugin/src/android/withAndroidAppBuildGradle.ts +34 -0
- package/plugin/src/android/withAndroidTarget.ts +26 -0
- package/plugin/src/android/withAndroidWidget.ts +778 -0
- package/plugin/src/config.ts +255 -0
- package/plugin/src/index.ts +19 -0
- package/plugin/src/ios/config-plugins/withEntitlements.ts +69 -0
- package/plugin/src/ios/config-plugins/withIOSTarget.ts +179 -0
- package/plugin/src/ios/config-plugins/withIosColorset.ts +29 -0
- package/plugin/src/ios/config-plugins/withIosStickerPack.ts +65 -0
- package/plugin/src/ios/config-plugins/withPodfile.ts +238 -0
- package/plugin/src/ios/config-plugins/withXcodeChanges.ts +891 -0
- package/plugin/src/ios/target.ts +668 -0
- package/plugin/src/ios/templates/MessagesViewController.swift +120 -0
- package/plugin/src/ios/templates/ReactNativeViewController.swift +240 -0
- package/plugin/src/ios/templates/action-extension-data.swift +106 -0
- package/plugin/src/ios/templates/clip-extension-data.swift +28 -0
- package/plugin/src/ios/templates/messages-extension-data.swift +28 -0
- package/plugin/src/ios/templates/share-extension-data.swift +113 -0
- package/plugin/src/ios/utils/asset.ts +490 -0
- package/plugin/src/ios/utils/file.ts +80 -0
- package/plugin/src/ios/utils/index.ts +12 -0
- package/plugin/src/ios/utils/paths.ts +253 -0
- package/plugin/src/ios/utils/plist.ts +101 -0
- package/plugin/src/ios/utils/podfile.ts +534 -0
- package/plugin/src/ios/utils/reactNativeSwift.ts +283 -0
- package/plugin/src/ios/utils/xcode.ts +989 -0
- package/plugin/src/logger.ts +63 -0
- package/plugin/src/parseTargetConfig.ts +115 -0
- package/plugin/src/types/normalize-colors.d.ts +3 -0
- package/plugin/src/withTargetsDir.ts +120 -0
- package/plugin/tsconfig.build.json +9 -0
- package/plugin/tsconfig.json +9 -0
- package/src/Target.ts +239 -0
- package/src/index.ts +52 -0
- package/src/modules/extension/index.ts +54 -0
- package/src/modules/messages/index.ts +124 -0
- package/src/modules/storage/index.ts +126 -0
- package/tsconfig.json +8 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Path utilities for working with target directories and files.
|
|
5
|
+
* Centralizes path resolution logic used across iOS plugins.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Sanitize target name for use in Xcode (removes non-alphanumeric characters).
|
|
10
|
+
* Appends "Target" suffix to avoid conflicts with main app name.
|
|
11
|
+
*/
|
|
12
|
+
export function sanitizeTargetName(name: string): string {
|
|
13
|
+
return name.replace(/[^a-zA-Z0-9]/g, '') + 'Target';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get the target directory path (where user places their target code).
|
|
18
|
+
*/
|
|
19
|
+
export function getTargetDirectory({
|
|
20
|
+
projectRoot,
|
|
21
|
+
targetDirectory,
|
|
22
|
+
}: {
|
|
23
|
+
projectRoot: string;
|
|
24
|
+
targetDirectory: string;
|
|
25
|
+
}): string {
|
|
26
|
+
return path.join(projectRoot, targetDirectory, 'ios');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get the target group path in Xcode project (where target files live).
|
|
31
|
+
* Adds 'Target' suffix to prevent case-insensitivity collisions with main app on macOS.
|
|
32
|
+
*
|
|
33
|
+
* On case-insensitive filesystems (macOS default), directory names that differ only by case
|
|
34
|
+
* collide. For example, "shareextension" (main app) and "ShareExtension" (target) would resolve
|
|
35
|
+
* to the same directory. Adding "Target" suffix ensures uniqueness.
|
|
36
|
+
*/
|
|
37
|
+
export function getTargetGroupPath({
|
|
38
|
+
platformProjectRoot,
|
|
39
|
+
targetName,
|
|
40
|
+
}: {
|
|
41
|
+
platformProjectRoot: string;
|
|
42
|
+
targetName: string;
|
|
43
|
+
}): string {
|
|
44
|
+
const dirName = sanitizeTargetName(targetName);
|
|
45
|
+
// Note: sanitizeTargetName already includes 'Target' suffix to prevent collision
|
|
46
|
+
// with main app on case-insensitive filesystems (e.g., "ShareExtension" -> "ShareExtensionTarget")
|
|
47
|
+
return path.join(platformProjectRoot, dirName);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Get path to generated entitlements file in Xcode project.
|
|
52
|
+
*/
|
|
53
|
+
export function getGeneratedEntitlementsPath({
|
|
54
|
+
platformProjectRoot,
|
|
55
|
+
targetName,
|
|
56
|
+
}: {
|
|
57
|
+
platformProjectRoot: string;
|
|
58
|
+
targetName: string;
|
|
59
|
+
}): string {
|
|
60
|
+
return path.join(
|
|
61
|
+
getTargetGroupPath({ platformProjectRoot, targetName }),
|
|
62
|
+
'generated.entitlements'
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Get path to Info.plist in Xcode project.
|
|
68
|
+
*/
|
|
69
|
+
export function getInfoPlistPath({
|
|
70
|
+
platformProjectRoot,
|
|
71
|
+
targetName,
|
|
72
|
+
}: {
|
|
73
|
+
platformProjectRoot: string;
|
|
74
|
+
targetName: string;
|
|
75
|
+
}): string {
|
|
76
|
+
return path.join(
|
|
77
|
+
getTargetGroupPath({ platformProjectRoot, targetName }),
|
|
78
|
+
'Info.plist'
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Get path to Assets.xcassets in Xcode project.
|
|
84
|
+
* For sticker targets, returns Stickers.xcassets instead.
|
|
85
|
+
*/
|
|
86
|
+
export function getAssetsXcassetsPath({
|
|
87
|
+
platformProjectRoot,
|
|
88
|
+
targetName,
|
|
89
|
+
isStickers,
|
|
90
|
+
}: {
|
|
91
|
+
platformProjectRoot: string;
|
|
92
|
+
targetName: string;
|
|
93
|
+
isStickers?: boolean;
|
|
94
|
+
}): string {
|
|
95
|
+
const assetsFolderName = isStickers ? 'Stickers.xcassets' : 'Assets.xcassets';
|
|
96
|
+
return path.join(
|
|
97
|
+
getTargetGroupPath({ platformProjectRoot, targetName }),
|
|
98
|
+
assetsFolderName
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Get path to a specific colorset in Xcode project.
|
|
104
|
+
*/
|
|
105
|
+
export function getColorsetPath({
|
|
106
|
+
platformProjectRoot,
|
|
107
|
+
targetName,
|
|
108
|
+
colorName,
|
|
109
|
+
}: {
|
|
110
|
+
platformProjectRoot: string;
|
|
111
|
+
targetName: string;
|
|
112
|
+
colorName: string;
|
|
113
|
+
}): string {
|
|
114
|
+
return path.join(
|
|
115
|
+
getAssetsXcassetsPath({ platformProjectRoot, targetName }),
|
|
116
|
+
`${colorName}.colorset`
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Get path to a specific sticker pack in Xcode project.
|
|
122
|
+
*/
|
|
123
|
+
export function getStickerPackPath({
|
|
124
|
+
platformProjectRoot,
|
|
125
|
+
targetName,
|
|
126
|
+
stickerPackName,
|
|
127
|
+
}: {
|
|
128
|
+
platformProjectRoot: string;
|
|
129
|
+
targetName: string;
|
|
130
|
+
stickerPackName: string;
|
|
131
|
+
}): string {
|
|
132
|
+
return path.join(
|
|
133
|
+
getAssetsXcassetsPath({
|
|
134
|
+
platformProjectRoot,
|
|
135
|
+
targetName,
|
|
136
|
+
isStickers: true,
|
|
137
|
+
}),
|
|
138
|
+
`${stickerPackName}.stickerpack`
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* ============================================================================
|
|
144
|
+
* NEW: Reference-in-Place Path Utilities
|
|
145
|
+
* ============================================================================
|
|
146
|
+
* The following functions return paths within targets/ directory where files
|
|
147
|
+
* are referenced in place rather than copied to ios/. Generated files (Info.plist,
|
|
148
|
+
* Assets.xcassets, entitlements) go in targets/TARGETNAME/ios/build/, while user Swift
|
|
149
|
+
* files remain in targets/TARGETNAME/ios/.
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Get build output directory in targets/ folder.
|
|
154
|
+
* This is where generated files (Info.plist, Assets, entitlements) are placed.
|
|
155
|
+
*/
|
|
156
|
+
export function getTargetBuildPath({
|
|
157
|
+
projectRoot,
|
|
158
|
+
targetDirectory,
|
|
159
|
+
}: {
|
|
160
|
+
projectRoot: string;
|
|
161
|
+
targetDirectory: string;
|
|
162
|
+
}): string {
|
|
163
|
+
return path.join(projectRoot, targetDirectory, 'ios', 'build');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Get path to Info.plist in targets/TARGETNAME/ios/build/.
|
|
168
|
+
* New approach: Info.plist generated in targets/, referenced from Xcode.
|
|
169
|
+
*/
|
|
170
|
+
export function getTargetInfoPlistPath({
|
|
171
|
+
projectRoot,
|
|
172
|
+
targetDirectory,
|
|
173
|
+
}: {
|
|
174
|
+
projectRoot: string;
|
|
175
|
+
targetDirectory: string;
|
|
176
|
+
}): string {
|
|
177
|
+
return path.join(
|
|
178
|
+
getTargetBuildPath({ projectRoot, targetDirectory }),
|
|
179
|
+
'Info.plist'
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Get path to entitlements file in targets/TARGETNAME/ios/build/.
|
|
185
|
+
* New approach: Entitlements generated in targets/, referenced from Xcode.
|
|
186
|
+
*/
|
|
187
|
+
export function getTargetEntitlementsPath({
|
|
188
|
+
projectRoot,
|
|
189
|
+
targetDirectory,
|
|
190
|
+
}: {
|
|
191
|
+
projectRoot: string;
|
|
192
|
+
targetDirectory: string;
|
|
193
|
+
}): string {
|
|
194
|
+
return path.join(
|
|
195
|
+
getTargetBuildPath({ projectRoot, targetDirectory }),
|
|
196
|
+
'generated.entitlements'
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Get path to Assets.xcassets in targets/TARGETNAME/ios/build/.
|
|
202
|
+
* New approach: Assets generated/copied to targets/, referenced from Xcode.
|
|
203
|
+
* For sticker targets, returns Stickers.xcassets instead.
|
|
204
|
+
*/
|
|
205
|
+
export function getTargetAssetsPath({
|
|
206
|
+
projectRoot,
|
|
207
|
+
targetDirectory,
|
|
208
|
+
isStickers,
|
|
209
|
+
}: {
|
|
210
|
+
projectRoot: string;
|
|
211
|
+
targetDirectory: string;
|
|
212
|
+
isStickers?: boolean;
|
|
213
|
+
}): string {
|
|
214
|
+
const assetsFolderName = isStickers ? 'Stickers.xcassets' : 'Assets.xcassets';
|
|
215
|
+
return path.join(
|
|
216
|
+
getTargetBuildPath({ projectRoot, targetDirectory }),
|
|
217
|
+
assetsFolderName
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Get path to a specific colorset in targets/TARGETNAME/ios/build/Assets.xcassets/.
|
|
223
|
+
*/
|
|
224
|
+
export function getTargetColorsetPath({
|
|
225
|
+
projectRoot,
|
|
226
|
+
targetDirectory,
|
|
227
|
+
colorName,
|
|
228
|
+
}: {
|
|
229
|
+
projectRoot: string;
|
|
230
|
+
targetDirectory: string;
|
|
231
|
+
colorName: string;
|
|
232
|
+
}): string {
|
|
233
|
+
return path.join(
|
|
234
|
+
getTargetAssetsPath({ projectRoot, targetDirectory }),
|
|
235
|
+
`${colorName}.colorset`
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Get path to user's Swift source files in targets/TARGETNAME/ios/.
|
|
241
|
+
* These are referenced in place, not copied.
|
|
242
|
+
*/
|
|
243
|
+
export function getTargetSourcePath({
|
|
244
|
+
projectRoot,
|
|
245
|
+
targetDirectory,
|
|
246
|
+
fileName,
|
|
247
|
+
}: {
|
|
248
|
+
projectRoot: string;
|
|
249
|
+
targetDirectory: string;
|
|
250
|
+
fileName: string;
|
|
251
|
+
}): string {
|
|
252
|
+
return path.join(projectRoot, targetDirectory, 'ios', fileName);
|
|
253
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import plist from '@expo/plist';
|
|
2
|
+
|
|
3
|
+
import * as FileUtils from './file';
|
|
4
|
+
import type { ExtensionType } from '../../config';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Plist file manipulation utilities.
|
|
8
|
+
* Provides high-level helpers for working with plist files.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Write a plist file from an object.
|
|
13
|
+
*/
|
|
14
|
+
export function writePlist(filePath: string, data: Record<string, any>): void {
|
|
15
|
+
const plistContent = plist.build(data);
|
|
16
|
+
FileUtils.writeFileSafe(filePath, plistContent);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Read a plist file into an object.
|
|
21
|
+
*/
|
|
22
|
+
export function readPlist(filePath: string): Record<string, any> {
|
|
23
|
+
const content = FileUtils.readFileIfExists(filePath);
|
|
24
|
+
if (!content) {
|
|
25
|
+
throw new Error(`Plist file not found: ${filePath}`);
|
|
26
|
+
}
|
|
27
|
+
return plist.parse(content);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Merge entitlements with App Clip specific requirements.
|
|
32
|
+
*/
|
|
33
|
+
export function mergeAppClipEntitlements(
|
|
34
|
+
entitlements: Record<string, any>,
|
|
35
|
+
mainBundleIdentifier: string
|
|
36
|
+
): Record<string, any> {
|
|
37
|
+
return {
|
|
38
|
+
...entitlements,
|
|
39
|
+
'com.apple.developer.parent-application-identifiers': [
|
|
40
|
+
`$(AppIdentifierPrefix)${mainBundleIdentifier}`,
|
|
41
|
+
],
|
|
42
|
+
'com.apple.developer.on-demand-install-capable': true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Sync App Groups from main app to target entitlements.
|
|
48
|
+
*/
|
|
49
|
+
export function syncAppGroups({
|
|
50
|
+
targetEntitlements,
|
|
51
|
+
mainAppGroups,
|
|
52
|
+
}: {
|
|
53
|
+
targetEntitlements: Record<string, any>;
|
|
54
|
+
mainAppGroups: string[] | undefined;
|
|
55
|
+
}): Record<string, any> {
|
|
56
|
+
const APP_GROUP_KEY = 'com.apple.security.application-groups';
|
|
57
|
+
|
|
58
|
+
if (
|
|
59
|
+
!targetEntitlements[APP_GROUP_KEY] &&
|
|
60
|
+
Array.isArray(mainAppGroups) &&
|
|
61
|
+
mainAppGroups.length > 0
|
|
62
|
+
) {
|
|
63
|
+
return {
|
|
64
|
+
...targetEntitlements,
|
|
65
|
+
[APP_GROUP_KEY]: mainAppGroups,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return targetEntitlements;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Check if a target type should use App Groups by default.
|
|
74
|
+
*/
|
|
75
|
+
export function shouldUseAppGroups(type: ExtensionType): boolean {
|
|
76
|
+
const SHOULD_USE_APP_GROUPS_BY_DEFAULT: Record<ExtensionType, boolean> = {
|
|
77
|
+
widget: true,
|
|
78
|
+
clip: true,
|
|
79
|
+
share: true,
|
|
80
|
+
'bg-download': true,
|
|
81
|
+
stickers: false,
|
|
82
|
+
messages: true,
|
|
83
|
+
action: false,
|
|
84
|
+
safari: false,
|
|
85
|
+
'notification-content': false,
|
|
86
|
+
'notification-service': false,
|
|
87
|
+
intent: false,
|
|
88
|
+
'intent-ui': false,
|
|
89
|
+
spotlight: false,
|
|
90
|
+
'quicklook-thumbnail': false,
|
|
91
|
+
'location-push': false,
|
|
92
|
+
'credentials-provider': false,
|
|
93
|
+
'account-auth': false,
|
|
94
|
+
'app-intent': false,
|
|
95
|
+
'device-activity-monitor': false,
|
|
96
|
+
matter: false,
|
|
97
|
+
watch: false,
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return SHOULD_USE_APP_GROUPS_BY_DEFAULT[type];
|
|
101
|
+
}
|