expo-targets 0.2.1 → 0.2.2
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/build/plugin/src/config.d.ts +23 -1
- package/build/plugin/src/config.d.ts.map +1 -1
- package/build/plugin/src/config.js +3 -1
- package/build/plugin/src/config.js.map +1 -1
- package/build/plugin/src/ios/config-plugins/withIOSTarget.d.ts.map +1 -1
- package/build/plugin/src/ios/config-plugins/withIOSTarget.js +17 -5
- package/build/plugin/src/ios/config-plugins/withIOSTarget.js.map +1 -1
- package/build/plugin/src/ios/config-plugins/withPodfile.d.ts.map +1 -1
- package/build/plugin/src/ios/config-plugins/withPodfile.js +3 -5
- package/build/plugin/src/ios/config-plugins/withPodfile.js.map +1 -1
- package/build/plugin/src/ios/config-plugins/withXcodeChanges.d.ts.map +1 -1
- package/build/plugin/src/ios/config-plugins/withXcodeChanges.js +63 -2
- package/build/plugin/src/ios/config-plugins/withXcodeChanges.js.map +1 -1
- package/build/plugin/src/ios/target.d.ts.map +1 -1
- package/build/plugin/src/ios/target.js +71 -11
- package/build/plugin/src/ios/target.js.map +1 -1
- package/build/plugin/src/ios/utils/index.d.ts +1 -0
- package/build/plugin/src/ios/utils/index.d.ts.map +1 -1
- package/build/plugin/src/ios/utils/index.js +2 -1
- package/build/plugin/src/ios/utils/index.js.map +1 -1
- package/build/plugin/src/ios/utils/plist.d.ts.map +1 -1
- package/build/plugin/src/ios/utils/plist.js +1 -0
- package/build/plugin/src/ios/utils/plist.js.map +1 -1
- package/build/plugin/src/ios/utils/podfile.d.ts.map +1 -1
- package/build/plugin/src/ios/utils/podfile.js +55 -22
- package/build/plugin/src/ios/utils/podfile.js.map +1 -1
- package/build/plugin/src/ios/utils/safari.d.ts +69 -0
- package/build/plugin/src/ios/utils/safari.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/safari.js +359 -0
- package/build/plugin/src/ios/utils/safari.js.map +1 -0
- package/build/plugin/src/withTargetsDir.d.ts.map +1 -1
- package/build/plugin/src/withTargetsDir.js +34 -0
- package/build/plugin/src/withTargetsDir.js.map +1 -1
- package/build/src/Target.d.ts +8 -1
- package/build/src/Target.d.ts.map +1 -1
- package/build/src/Target.js +136 -26
- package/build/src/Target.js.map +1 -1
- package/build/src/index.d.ts +3 -1
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +14 -1
- package/build/src/index.js.map +1 -1
- package/build/src/modules/safari/index.d.ts +109 -0
- package/build/src/modules/safari/index.d.ts.map +1 -0
- package/build/src/modules/safari/index.js +288 -0
- package/build/src/modules/safari/index.js.map +1 -0
- package/metro/{src/index.ts → build/index.d.ts} +1 -0
- package/metro/build/index.d.ts.map +1 -0
- package/metro/build/index.js +6 -0
- package/metro/build/index.js.map +1 -0
- package/metro/build/withTargetsMetro.d.ts +5 -0
- package/metro/build/withTargetsMetro.d.ts.map +1 -0
- package/metro/build/withTargetsMetro.js +78 -0
- package/metro/build/withTargetsMetro.js.map +1 -0
- package/package.json +11 -1
- package/plugin/build/android/withAndroidAppBuildGradle.d.ts +7 -0
- package/plugin/build/android/withAndroidAppBuildGradle.d.ts.map +1 -0
- package/plugin/build/android/withAndroidAppBuildGradle.js +31 -0
- package/plugin/build/android/withAndroidAppBuildGradle.js.map +1 -0
- package/plugin/build/android/withAndroidTarget.d.ts +10 -0
- package/plugin/build/android/withAndroidTarget.d.ts.map +1 -0
- package/plugin/build/android/withAndroidTarget.js +22 -0
- package/plugin/build/android/withAndroidTarget.js.map +1 -0
- package/plugin/build/android/withAndroidWidget.d.ts +13 -0
- package/plugin/build/android/withAndroidWidget.d.ts.map +1 -0
- package/plugin/build/android/withAndroidWidget.js +564 -0
- package/plugin/build/android/withAndroidWidget.js.map +1 -0
- package/plugin/build/config.d.ts +163 -0
- package/plugin/build/config.d.ts.map +1 -0
- package/plugin/build/config.js +56 -0
- package/plugin/build/config.js.map +1 -0
- package/plugin/build/index.d.ts +9 -0
- package/plugin/build/index.d.ts.map +1 -0
- package/plugin/build/index.js +11 -0
- package/plugin/build/index.js.map +1 -0
- package/plugin/build/ios/config-plugins/withEntitlements.d.ts +11 -0
- package/plugin/build/ios/config-plugins/withEntitlements.d.ts.map +1 -0
- package/plugin/build/ios/config-plugins/withEntitlements.js +49 -0
- package/plugin/build/ios/config-plugins/withEntitlements.js.map +1 -0
- package/plugin/build/ios/config-plugins/withIOSTarget.d.ts +17 -0
- package/plugin/build/ios/config-plugins/withIOSTarget.d.ts.map +1 -0
- package/plugin/build/ios/config-plugins/withIOSTarget.js +164 -0
- package/plugin/build/ios/config-plugins/withIOSTarget.js.map +1 -0
- package/plugin/build/ios/config-plugins/withIosColorset.d.ts +8 -0
- package/plugin/build/ios/config-plugins/withIosColorset.d.ts.map +1 -0
- package/plugin/build/ios/config-plugins/withIosColorset.js +25 -0
- package/plugin/build/ios/config-plugins/withIosColorset.js.map +1 -0
- package/plugin/build/ios/config-plugins/withIosStickerPack.d.ts +8 -0
- package/plugin/build/ios/config-plugins/withIosStickerPack.d.ts.map +1 -0
- package/plugin/build/ios/config-plugins/withIosStickerPack.js +52 -0
- package/plugin/build/ios/config-plugins/withIosStickerPack.js.map +1 -0
- package/plugin/build/ios/config-plugins/withPodfile.d.ts +12 -0
- package/plugin/build/ios/config-plugins/withPodfile.d.ts.map +1 -0
- package/plugin/build/ios/config-plugins/withPodfile.js +160 -0
- package/plugin/build/ios/config-plugins/withPodfile.js.map +1 -0
- package/plugin/build/ios/config-plugins/withXcodeChanges.d.ts +15 -0
- package/plugin/build/ios/config-plugins/withXcodeChanges.d.ts.map +1 -0
- package/plugin/build/ios/config-plugins/withXcodeChanges.js +707 -0
- package/plugin/build/ios/config-plugins/withXcodeChanges.js.map +1 -0
- package/plugin/build/ios/target.d.ts +41 -0
- package/plugin/build/ios/target.d.ts.map +1 -0
- package/plugin/build/ios/target.js +634 -0
- package/plugin/build/ios/target.js.map +1 -0
- package/plugin/build/ios/utils/asset.d.ts +60 -0
- package/plugin/build/ios/utils/asset.d.ts.map +1 -0
- package/plugin/build/ios/utils/asset.js +375 -0
- package/plugin/build/ios/utils/asset.js.map +1 -0
- package/plugin/build/ios/utils/file.d.ts +33 -0
- package/plugin/build/ios/utils/file.d.ts.map +1 -0
- package/plugin/build/ios/utils/file.js +88 -0
- package/plugin/build/ios/utils/file.js.map +1 -0
- package/plugin/{src/ios/utils/index.ts → build/ios/utils/index.d.ts} +2 -1
- package/plugin/build/ios/utils/index.d.ts.map +1 -0
- package/plugin/build/ios/utils/index.js +39 -0
- package/plugin/build/ios/utils/index.js.map +1 -0
- package/plugin/build/ios/utils/paths.d.ts +128 -0
- package/plugin/build/ios/utils/paths.d.ts.map +1 -0
- package/plugin/build/ios/utils/paths.js +141 -0
- package/plugin/build/ios/utils/paths.js.map +1 -0
- package/plugin/build/ios/utils/plist.d.ts +29 -0
- package/plugin/build/ios/utils/plist.d.ts.map +1 -0
- package/plugin/build/ios/utils/plist.js +115 -0
- package/plugin/build/ios/utils/plist.js.map +1 -0
- package/plugin/build/ios/utils/podfile.d.ts +82 -0
- package/plugin/build/ios/utils/podfile.d.ts.map +1 -0
- package/plugin/build/ios/utils/podfile.js +441 -0
- package/plugin/build/ios/utils/podfile.js.map +1 -0
- package/plugin/build/ios/utils/reactNativeSwift.d.ts +11 -0
- package/plugin/build/ios/utils/reactNativeSwift.d.ts.map +1 -0
- package/plugin/build/ios/utils/reactNativeSwift.js +263 -0
- package/plugin/build/ios/utils/reactNativeSwift.js.map +1 -0
- package/plugin/build/ios/utils/safari.d.ts +69 -0
- package/plugin/build/ios/utils/safari.d.ts.map +1 -0
- package/plugin/build/ios/utils/safari.js +359 -0
- package/plugin/build/ios/utils/safari.js.map +1 -0
- package/plugin/build/ios/utils/xcode.d.ts +185 -0
- package/plugin/build/ios/utils/xcode.d.ts.map +1 -0
- package/plugin/build/ios/utils/xcode.js +706 -0
- package/plugin/build/ios/utils/xcode.js.map +1 -0
- package/plugin/build/logger.d.ts +10 -0
- package/plugin/build/logger.d.ts.map +1 -0
- package/plugin/build/logger.js +62 -0
- package/plugin/build/logger.js.map +1 -0
- package/plugin/build/parseTargetConfig.d.ts +3 -0
- package/plugin/build/parseTargetConfig.d.ts.map +1 -0
- package/plugin/build/parseTargetConfig.js +113 -0
- package/plugin/build/parseTargetConfig.js.map +1 -0
- package/plugin/build/withTargetsDir.d.ts +6 -0
- package/plugin/build/withTargetsDir.d.ts.map +1 -0
- package/plugin/build/withTargetsDir.js +124 -0
- package/plugin/build/withTargetsDir.js.map +1 -0
- package/.eslintrc.js +0 -2
- package/metro/src/withTargetsMetro.ts +0 -72
- package/metro/tsconfig.build.json +0 -9
- package/plugin/src/android/withAndroidAppBuildGradle.ts +0 -34
- package/plugin/src/android/withAndroidTarget.ts +0 -26
- package/plugin/src/android/withAndroidWidget.ts +0 -778
- package/plugin/src/config.ts +0 -255
- package/plugin/src/index.ts +0 -19
- package/plugin/src/ios/config-plugins/withEntitlements.ts +0 -69
- package/plugin/src/ios/config-plugins/withIOSTarget.ts +0 -179
- package/plugin/src/ios/config-plugins/withIosColorset.ts +0 -29
- package/plugin/src/ios/config-plugins/withIosStickerPack.ts +0 -65
- package/plugin/src/ios/config-plugins/withPodfile.ts +0 -238
- package/plugin/src/ios/config-plugins/withXcodeChanges.ts +0 -891
- package/plugin/src/ios/target.ts +0 -668
- package/plugin/src/ios/utils/asset.ts +0 -490
- package/plugin/src/ios/utils/file.ts +0 -80
- package/plugin/src/ios/utils/paths.ts +0 -253
- package/plugin/src/ios/utils/plist.ts +0 -101
- package/plugin/src/ios/utils/podfile.ts +0 -534
- package/plugin/src/ios/utils/reactNativeSwift.ts +0 -283
- package/plugin/src/ios/utils/xcode.ts +0 -989
- package/plugin/src/logger.ts +0 -63
- package/plugin/src/parseTargetConfig.ts +0 -115
- package/plugin/src/types/normalize-colors.d.ts +0 -3
- package/plugin/src/withTargetsDir.ts +0 -120
- package/plugin/tsconfig.build.json +0 -9
- package/plugin/tsconfig.json +0 -9
- package/src/Target.ts +0 -239
- package/src/index.ts +0 -52
- package/src/modules/extension/index.ts +0 -54
- package/src/modules/messages/index.ts +0 -124
- package/src/modules/storage/index.ts +0 -126
- package/tsconfig.json +0 -8
- /package/plugin/{src → build}/ios/templates/MessagesViewController.swift +0 -0
- /package/plugin/{src → build}/ios/templates/ReactNativeViewController.swift +0 -0
- /package/plugin/{src → build}/ios/templates/action-extension-data.swift +0 -0
- /package/plugin/{src → build}/ios/templates/clip-extension-data.swift +0 -0
- /package/plugin/{src → build}/ios/templates/messages-extension-data.swift +0 -0
- /package/plugin/{src → build}/ios/templates/share-extension-data.swift +0 -0
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Safari Web Extension utilities
|
|
4
|
+
*
|
|
5
|
+
* Generates web resources and Swift handler for Safari extensions
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
24
|
+
if (mod && mod.__esModule) return mod;
|
|
25
|
+
var result = {};
|
|
26
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
27
|
+
__setModuleDefault(result, mod);
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.hasCustomSafariResources = exports.generateSafariResources = exports.generatePlaceholderIcons = exports.generatePlaceholderPopupScript = exports.generateBackgroundScript = exports.generateManifest = exports.generatePopupHtml = exports.ensureSafariSwiftHandler = exports.hasUserSafariSwiftHandler = exports.generateSafariSwiftHandler = void 0;
|
|
35
|
+
const fs_1 = __importDefault(require("fs"));
|
|
36
|
+
const path_1 = __importDefault(require("path"));
|
|
37
|
+
const File = __importStar(require("./file"));
|
|
38
|
+
// ============================================================================
|
|
39
|
+
// Swift Handler Generation
|
|
40
|
+
// ============================================================================
|
|
41
|
+
/**
|
|
42
|
+
* Generate SafariWebExtensionHandler.swift
|
|
43
|
+
* This handles native message passing from JavaScript
|
|
44
|
+
*/
|
|
45
|
+
function generateSafariSwiftHandler(targetName) {
|
|
46
|
+
return `import SafariServices
|
|
47
|
+
import os.log
|
|
48
|
+
|
|
49
|
+
/// Native message handler for ${targetName} Safari extension.
|
|
50
|
+
/// Called when JavaScript uses \`browser.runtime.sendNativeMessage()\`
|
|
51
|
+
/// or the \`useSendToNative()\` hook from expo-targets.
|
|
52
|
+
class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
|
|
53
|
+
func beginRequest(with context: NSExtensionContext) {
|
|
54
|
+
let request = context.inputItems.first as? NSExtensionItem
|
|
55
|
+
|
|
56
|
+
// Extract message from JavaScript
|
|
57
|
+
let message: Any?
|
|
58
|
+
if #available(iOS 15.0, *) {
|
|
59
|
+
message = request?.userInfo?[SFExtensionMessageKey]
|
|
60
|
+
} else {
|
|
61
|
+
message = request?.userInfo?["message"]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
os_log(.default, "${targetName} received native message: %@", String(describing: message))
|
|
65
|
+
|
|
66
|
+
// Process message and prepare response
|
|
67
|
+
var responseData: [String: Any] = [
|
|
68
|
+
"status": "ok",
|
|
69
|
+
"extensionName": "${targetName}"
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
if let messageDict = message as? [String: Any] {
|
|
73
|
+
// Echo back received data - customize this for your needs
|
|
74
|
+
responseData["received"] = messageDict
|
|
75
|
+
responseData["timestamp"] = Date().timeIntervalSince1970
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Send response back to JavaScript
|
|
79
|
+
let response = NSExtensionItem()
|
|
80
|
+
if #available(iOS 15.0, *) {
|
|
81
|
+
response.userInfo = [SFExtensionMessageKey: responseData]
|
|
82
|
+
} else {
|
|
83
|
+
response.userInfo = ["message": responseData]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
context.completeRequest(returningItems: [response], completionHandler: nil)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
exports.generateSafariSwiftHandler = generateSafariSwiftHandler;
|
|
92
|
+
/**
|
|
93
|
+
* Check if user has provided a custom Safari Swift handler
|
|
94
|
+
*/
|
|
95
|
+
function hasUserSafariSwiftHandler(targetDirectory) {
|
|
96
|
+
const userSwiftPath = path_1.default.join(targetDirectory, 'ios', 'SafariWebExtensionHandler.swift');
|
|
97
|
+
return fs_1.default.existsSync(userSwiftPath);
|
|
98
|
+
}
|
|
99
|
+
exports.hasUserSafariSwiftHandler = hasUserSafariSwiftHandler;
|
|
100
|
+
/**
|
|
101
|
+
* Write Safari Swift handler to the build directory (if user hasn't provided one)
|
|
102
|
+
* Returns the path to the Swift file (either user's or generated)
|
|
103
|
+
*/
|
|
104
|
+
function ensureSafariSwiftHandler(targetDirectory, targetBuildPath, targetName) {
|
|
105
|
+
// Check if user provided their own handler in ios/
|
|
106
|
+
const userSwiftPath = path_1.default.join(targetDirectory, 'ios', 'SafariWebExtensionHandler.swift');
|
|
107
|
+
if (fs_1.default.existsSync(userSwiftPath)) {
|
|
108
|
+
return { path: userSwiftPath, isGenerated: false };
|
|
109
|
+
}
|
|
110
|
+
// Generate in build directory
|
|
111
|
+
const generatedSwiftPath = path_1.default.join(targetBuildPath, 'SafariWebExtensionHandler.swift');
|
|
112
|
+
const swiftContent = generateSafariSwiftHandler(targetName);
|
|
113
|
+
File.writeFileSafe(generatedSwiftPath, swiftContent);
|
|
114
|
+
return { path: generatedSwiftPath, isGenerated: true };
|
|
115
|
+
}
|
|
116
|
+
exports.ensureSafariSwiftHandler = ensureSafariSwiftHandler;
|
|
117
|
+
/**
|
|
118
|
+
* Generate popup.html for Safari extension
|
|
119
|
+
* This loads the bundled React Native Web code
|
|
120
|
+
*/
|
|
121
|
+
function generatePopupHtml(outputPath, targetName) {
|
|
122
|
+
const html = `<!DOCTYPE html>
|
|
123
|
+
<html>
|
|
124
|
+
<head>
|
|
125
|
+
<meta charset="utf-8">
|
|
126
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
127
|
+
<title>${targetName}</title>
|
|
128
|
+
<style>
|
|
129
|
+
* {
|
|
130
|
+
margin: 0;
|
|
131
|
+
padding: 0;
|
|
132
|
+
box-sizing: border-box;
|
|
133
|
+
}
|
|
134
|
+
html, body, #root {
|
|
135
|
+
width: 100%;
|
|
136
|
+
height: 100%;
|
|
137
|
+
overflow: hidden;
|
|
138
|
+
}
|
|
139
|
+
body {
|
|
140
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
141
|
+
background: #fff;
|
|
142
|
+
}
|
|
143
|
+
@media (prefers-color-scheme: dark) {
|
|
144
|
+
body {
|
|
145
|
+
background: #1c1c1e;
|
|
146
|
+
color: #fff;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
</style>
|
|
150
|
+
</head>
|
|
151
|
+
<body>
|
|
152
|
+
<div id="root"></div>
|
|
153
|
+
<script src="popup.js"></script>
|
|
154
|
+
</body>
|
|
155
|
+
</html>`;
|
|
156
|
+
File.writeFileSafe(outputPath, html);
|
|
157
|
+
}
|
|
158
|
+
exports.generatePopupHtml = generatePopupHtml;
|
|
159
|
+
/**
|
|
160
|
+
* Generate manifest.json for Safari extension
|
|
161
|
+
*/
|
|
162
|
+
function generateManifest(outputPath, config) {
|
|
163
|
+
const manifest = {
|
|
164
|
+
manifest_version: 3,
|
|
165
|
+
name: config.name,
|
|
166
|
+
version: config.version || '1.0.0',
|
|
167
|
+
description: config.description || `${config.name} Safari Extension`,
|
|
168
|
+
// Default permissions for Safari extensions
|
|
169
|
+
permissions: config.permissions || ['storage'],
|
|
170
|
+
// Background script (optional, for handling native messages)
|
|
171
|
+
background: {
|
|
172
|
+
scripts: ['background.js'],
|
|
173
|
+
persistent: false,
|
|
174
|
+
},
|
|
175
|
+
// Popup configuration
|
|
176
|
+
action: {
|
|
177
|
+
default_popup: 'popup.html',
|
|
178
|
+
default_icon: config.icons || {
|
|
179
|
+
'16': 'images/icon-16.png',
|
|
180
|
+
'32': 'images/icon-32.png',
|
|
181
|
+
'48': 'images/icon-48.png',
|
|
182
|
+
'128': 'images/icon-128.png',
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
// Content scripts (if provided)
|
|
186
|
+
...(config.content_scripts && config.content_scripts.length > 0
|
|
187
|
+
? { content_scripts: config.content_scripts }
|
|
188
|
+
: {}),
|
|
189
|
+
// Icons
|
|
190
|
+
icons: config.icons || {
|
|
191
|
+
'16': 'images/icon-16.png',
|
|
192
|
+
'32': 'images/icon-32.png',
|
|
193
|
+
'48': 'images/icon-48.png',
|
|
194
|
+
'128': 'images/icon-128.png',
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
File.writeFileSafe(outputPath, JSON.stringify(manifest, null, 2));
|
|
198
|
+
}
|
|
199
|
+
exports.generateManifest = generateManifest;
|
|
200
|
+
/**
|
|
201
|
+
* Generate a minimal background.js for Safari extension
|
|
202
|
+
*/
|
|
203
|
+
function generateBackgroundScript(outputPath) {
|
|
204
|
+
const script = `// Safari Web Extension Background Script
|
|
205
|
+
// Handles communication between popup and native Swift handler
|
|
206
|
+
|
|
207
|
+
browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
|
208
|
+
// Forward messages to native handler if needed
|
|
209
|
+
if (message.type === 'native') {
|
|
210
|
+
browser.runtime.sendNativeMessage('', message.payload)
|
|
211
|
+
.then(sendResponse)
|
|
212
|
+
.catch(error => sendResponse({ error: error.message }));
|
|
213
|
+
return true; // Keep channel open for async response
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
`;
|
|
217
|
+
File.writeFileSafe(outputPath, script);
|
|
218
|
+
}
|
|
219
|
+
exports.generateBackgroundScript = generateBackgroundScript;
|
|
220
|
+
/**
|
|
221
|
+
* Generate placeholder popup.js
|
|
222
|
+
* This will be replaced by the actual bundle during build
|
|
223
|
+
*/
|
|
224
|
+
function generatePlaceholderPopupScript(outputPath, targetName) {
|
|
225
|
+
const script = `// Placeholder for ${targetName} Safari Extension
|
|
226
|
+
// This file will be replaced by the bundled React Native Web code during build
|
|
227
|
+
|
|
228
|
+
(function() {
|
|
229
|
+
const root = document.getElementById('root');
|
|
230
|
+
if (root) {
|
|
231
|
+
root.innerHTML = '<div style="padding: 16px; text-align: center;">' +
|
|
232
|
+
'<p>Safari Extension: ${targetName}</p>' +
|
|
233
|
+
'<p style="font-size: 12px; color: #888;">Build the extension to see your React Native code</p>' +
|
|
234
|
+
'</div>';
|
|
235
|
+
}
|
|
236
|
+
})();
|
|
237
|
+
`;
|
|
238
|
+
File.writeFileSafe(outputPath, script);
|
|
239
|
+
}
|
|
240
|
+
exports.generatePlaceholderPopupScript = generatePlaceholderPopupScript;
|
|
241
|
+
/**
|
|
242
|
+
* Generate placeholder icons for Safari extension
|
|
243
|
+
*/
|
|
244
|
+
function generatePlaceholderIcons(resourcesPath) {
|
|
245
|
+
const imagesPath = path_1.default.join(resourcesPath, 'images');
|
|
246
|
+
File.ensureDirectoryExists(imagesPath);
|
|
247
|
+
// Generate simple placeholder SVG-based icons at different sizes
|
|
248
|
+
const sizes = [16, 32, 48, 128];
|
|
249
|
+
for (const size of sizes) {
|
|
250
|
+
const iconPath = path_1.default.join(imagesPath, `icon-${size}.png`);
|
|
251
|
+
// Only create if doesn't exist - don't overwrite user icons
|
|
252
|
+
if (!fs_1.default.existsSync(iconPath)) {
|
|
253
|
+
// Create a minimal valid PNG (1x1 transparent pixel as placeholder)
|
|
254
|
+
// This is a minimal valid PNG file
|
|
255
|
+
const minimalPng = Buffer.from([
|
|
256
|
+
0x89,
|
|
257
|
+
0x50,
|
|
258
|
+
0x4e,
|
|
259
|
+
0x47,
|
|
260
|
+
0x0d,
|
|
261
|
+
0x0a,
|
|
262
|
+
0x1a,
|
|
263
|
+
0x0a, // PNG signature
|
|
264
|
+
0x00,
|
|
265
|
+
0x00,
|
|
266
|
+
0x00,
|
|
267
|
+
0x0d, // IHDR length
|
|
268
|
+
0x49,
|
|
269
|
+
0x48,
|
|
270
|
+
0x44,
|
|
271
|
+
0x52, // IHDR
|
|
272
|
+
0x00,
|
|
273
|
+
0x00,
|
|
274
|
+
0x00,
|
|
275
|
+
0x01, // width: 1
|
|
276
|
+
0x00,
|
|
277
|
+
0x00,
|
|
278
|
+
0x00,
|
|
279
|
+
0x01, // height: 1
|
|
280
|
+
0x08,
|
|
281
|
+
0x06, // bit depth: 8, color type: RGBA
|
|
282
|
+
0x00,
|
|
283
|
+
0x00,
|
|
284
|
+
0x00, // compression, filter, interlace
|
|
285
|
+
0x1f,
|
|
286
|
+
0x15,
|
|
287
|
+
0xc4,
|
|
288
|
+
0x89, // IHDR CRC
|
|
289
|
+
0x00,
|
|
290
|
+
0x00,
|
|
291
|
+
0x00,
|
|
292
|
+
0x0a, // IDAT length
|
|
293
|
+
0x49,
|
|
294
|
+
0x44,
|
|
295
|
+
0x41,
|
|
296
|
+
0x54, // IDAT
|
|
297
|
+
0x78,
|
|
298
|
+
0x9c,
|
|
299
|
+
0x63,
|
|
300
|
+
0x00,
|
|
301
|
+
0x01,
|
|
302
|
+
0x00,
|
|
303
|
+
0x00,
|
|
304
|
+
0x05,
|
|
305
|
+
0x00,
|
|
306
|
+
0x01, // compressed data
|
|
307
|
+
0x0d,
|
|
308
|
+
0x0a,
|
|
309
|
+
0x2d,
|
|
310
|
+
0xb4, // IDAT CRC
|
|
311
|
+
0x00,
|
|
312
|
+
0x00,
|
|
313
|
+
0x00,
|
|
314
|
+
0x00, // IEND length
|
|
315
|
+
0x49,
|
|
316
|
+
0x45,
|
|
317
|
+
0x4e,
|
|
318
|
+
0x44, // IEND
|
|
319
|
+
0xae,
|
|
320
|
+
0x42,
|
|
321
|
+
0x60,
|
|
322
|
+
0x82, // IEND CRC
|
|
323
|
+
]);
|
|
324
|
+
fs_1.default.writeFileSync(iconPath, minimalPng);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
exports.generatePlaceholderIcons = generatePlaceholderIcons;
|
|
329
|
+
/**
|
|
330
|
+
* Generate all Safari web extension resources
|
|
331
|
+
*/
|
|
332
|
+
function generateSafariResources(resourcesPath, config) {
|
|
333
|
+
File.ensureDirectoryExists(resourcesPath);
|
|
334
|
+
const targetDisplayName = config.displayName || config.name;
|
|
335
|
+
// Generate popup.html
|
|
336
|
+
generatePopupHtml(path_1.default.join(resourcesPath, 'popup.html'), targetDisplayName);
|
|
337
|
+
// Generate manifest.json with optional overrides
|
|
338
|
+
generateManifest(path_1.default.join(resourcesPath, 'manifest.json'), {
|
|
339
|
+
name: targetDisplayName,
|
|
340
|
+
...config.manifest,
|
|
341
|
+
});
|
|
342
|
+
// Generate background.js
|
|
343
|
+
generateBackgroundScript(path_1.default.join(resourcesPath, 'background.js'));
|
|
344
|
+
// Generate placeholder popup.js (will be replaced by bundle)
|
|
345
|
+
generatePlaceholderPopupScript(path_1.default.join(resourcesPath, 'popup.js'), targetDisplayName);
|
|
346
|
+
// Generate placeholder icons
|
|
347
|
+
generatePlaceholderIcons(resourcesPath);
|
|
348
|
+
}
|
|
349
|
+
exports.generateSafariResources = generateSafariResources;
|
|
350
|
+
/**
|
|
351
|
+
* Check if user has provided custom Safari Resources
|
|
352
|
+
*/
|
|
353
|
+
function hasCustomSafariResources(targetDirectory) {
|
|
354
|
+
const resourcesPath = path_1.default.join(targetDirectory, 'ios', 'Resources');
|
|
355
|
+
const manifestPath = path_1.default.join(resourcesPath, 'manifest.json');
|
|
356
|
+
return fs_1.default.existsSync(manifestPath);
|
|
357
|
+
}
|
|
358
|
+
exports.hasCustomSafariResources = hasCustomSafariResources;
|
|
359
|
+
//# sourceMappingURL=safari.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safari.js","sourceRoot":"","sources":["../../../src/ios/utils/safari.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAAoB;AACpB,gDAAwB;AAExB,6CAA+B;AAE/B,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E;;;GAGG;AACH,SAAgB,0BAA0B,CAAC,UAAkB;IAC3D,OAAO;;;iCAGwB,UAAU;;;;;;;;;;;;;;;4BAef,UAAU;;;;;gCAKN,UAAU;;;;;;;;;;;;;;;;;;;;CAoBzC,CAAC;AACF,CAAC;AA7CD,gEA6CC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,eAAuB;IAC/D,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAC7B,eAAe,EACf,KAAK,EACL,iCAAiC,CAClC,CAAC;IACF,OAAO,YAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACtC,CAAC;AAPD,8DAOC;AAED;;;GAGG;AACH,SAAgB,wBAAwB,CACtC,eAAuB,EACvB,eAAuB,EACvB,UAAkB;IAElB,mDAAmD;IACnD,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAC7B,eAAe,EACf,KAAK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AAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACrE,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;IAE/D,OAAO,YAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC;AALD,4DAKC"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { IOSConfig } from '@expo/config-plugins';
|
|
2
|
+
import type { XcodeProject } from '@expo/config-plugins';
|
|
3
|
+
/**
|
|
4
|
+
* High-level utilities for Xcode project manipulation in expo-targets.
|
|
5
|
+
* Wraps IOSConfig.XcodeUtils for consistency and extends with target-specific operations.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ensureGroupRecursively: typeof IOSConfig.XcodeUtils.ensureGroupRecursively, addResourceFileToGroup: typeof IOSConfig.XcodeUtils.addResourceFileToGroup, addBuildSourceFileToGroup: typeof IOSConfig.XcodeUtils.addBuildSourceFileToGroup, getProjectName: typeof IOSConfig.XcodeUtils.getProjectName, getApplicationNativeTarget: typeof IOSConfig.XcodeUtils.getApplicationNativeTarget;
|
|
8
|
+
/**
|
|
9
|
+
* Target creation result from xcode library
|
|
10
|
+
*/
|
|
11
|
+
interface XcodeTarget {
|
|
12
|
+
uuid: string;
|
|
13
|
+
pbxNativeTarget?: any;
|
|
14
|
+
target?: any;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Check if target already has a specific build phase type
|
|
18
|
+
*/
|
|
19
|
+
export declare function hasBuildPhase({ project, targetUuid, phaseType, }: {
|
|
20
|
+
project: XcodeProject;
|
|
21
|
+
targetUuid: string;
|
|
22
|
+
phaseType: string;
|
|
23
|
+
}): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Remove build phases of a specific type from target
|
|
26
|
+
*/
|
|
27
|
+
export declare function removeBuildPhases({ project, targetUuid, phaseType, }: {
|
|
28
|
+
project: XcodeProject;
|
|
29
|
+
targetUuid: string;
|
|
30
|
+
phaseType: string;
|
|
31
|
+
}): void;
|
|
32
|
+
/**
|
|
33
|
+
* Check if target dependency already exists
|
|
34
|
+
*/
|
|
35
|
+
export declare function hasTargetDependency({ project, mainTargetUuid, dependentTargetUuid, }: {
|
|
36
|
+
project: XcodeProject;
|
|
37
|
+
mainTargetUuid: string;
|
|
38
|
+
dependentTargetUuid: string;
|
|
39
|
+
}): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Add target dependency from main app to extension/clip target.
|
|
42
|
+
* Ensures PBXTargetDependency and PBXContainerItemProxy sections exist.
|
|
43
|
+
*/
|
|
44
|
+
export declare function addTargetDependency({ project, mainTargetUuid, dependentTargetUuid, }: {
|
|
45
|
+
project: XcodeProject;
|
|
46
|
+
mainTargetUuid: string;
|
|
47
|
+
dependentTargetUuid: string;
|
|
48
|
+
}): void;
|
|
49
|
+
/**
|
|
50
|
+
* Configure embed settings for app extension.
|
|
51
|
+
* Consolidates all app extensions into a SINGLE "Embed App Extensions" phase.
|
|
52
|
+
*/
|
|
53
|
+
export declare function configureAppExtensionEmbed({ project, targetProductName, }: {
|
|
54
|
+
project: XcodeProject;
|
|
55
|
+
targetProductName: string;
|
|
56
|
+
}): void;
|
|
57
|
+
/**
|
|
58
|
+
* Configure embed settings for App Clip.
|
|
59
|
+
* Creates "Embed App Clips" phase with proper settings.
|
|
60
|
+
*/
|
|
61
|
+
export declare function configureAppClipEmbed({ project, mainTargetUuid, target, targetProductName, }: {
|
|
62
|
+
project: XcodeProject;
|
|
63
|
+
mainTargetUuid: string;
|
|
64
|
+
target: XcodeTarget;
|
|
65
|
+
targetProductName: string;
|
|
66
|
+
}): void;
|
|
67
|
+
/**
|
|
68
|
+
* Set product type for a native target.
|
|
69
|
+
* Useful for App Clips which need special product type after creation.
|
|
70
|
+
*/
|
|
71
|
+
export declare function setProductType({ target, productType, }: {
|
|
72
|
+
target: XcodeTarget;
|
|
73
|
+
productType: string;
|
|
74
|
+
}): void;
|
|
75
|
+
/**
|
|
76
|
+
* Apply build settings to all configurations of a target.
|
|
77
|
+
*/
|
|
78
|
+
export declare function applyBuildSettings({ project, target, buildSettings, verbose, logger, }: {
|
|
79
|
+
project: XcodeProject;
|
|
80
|
+
target: XcodeTarget;
|
|
81
|
+
buildSettings: Record<string, string | string[]>;
|
|
82
|
+
verbose?: boolean;
|
|
83
|
+
logger?: {
|
|
84
|
+
log: (message: string) => void;
|
|
85
|
+
};
|
|
86
|
+
}): void;
|
|
87
|
+
/**
|
|
88
|
+
* Remove a build setting from all configurations of a target.
|
|
89
|
+
*/
|
|
90
|
+
export declare function removeBuildSetting({ project, target, settingKey, verbose, logger, }: {
|
|
91
|
+
project: XcodeProject;
|
|
92
|
+
target: XcodeTarget;
|
|
93
|
+
settingKey: string;
|
|
94
|
+
verbose?: boolean;
|
|
95
|
+
logger?: {
|
|
96
|
+
log: (message: string) => void;
|
|
97
|
+
};
|
|
98
|
+
}): void;
|
|
99
|
+
/**
|
|
100
|
+
* Get build settings from the main app target.
|
|
101
|
+
*/
|
|
102
|
+
export declare function getMainAppBuildSettings({ project, mainTarget, }: {
|
|
103
|
+
project: XcodeProject;
|
|
104
|
+
mainTarget: {
|
|
105
|
+
uuid: string;
|
|
106
|
+
target: any;
|
|
107
|
+
};
|
|
108
|
+
}): Record<string, any>;
|
|
109
|
+
/**
|
|
110
|
+
* Find a target UUID by its product name.
|
|
111
|
+
*/
|
|
112
|
+
export declare function findTargetByProductName({ project, productName, }: {
|
|
113
|
+
project: XcodeProject;
|
|
114
|
+
productName: string;
|
|
115
|
+
}): string | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Find all target UUIDs with a given product name (detects duplicates)
|
|
118
|
+
*/
|
|
119
|
+
export declare function findAllTargetsByProductName({ project, productName, }: {
|
|
120
|
+
project: XcodeProject;
|
|
121
|
+
productName: string;
|
|
122
|
+
}): string[];
|
|
123
|
+
/**
|
|
124
|
+
* Remove duplicate targets with the same product name, keeping only the first one
|
|
125
|
+
*/
|
|
126
|
+
export declare function removeDuplicateTargets({ project, productName, }: {
|
|
127
|
+
project: XcodeProject;
|
|
128
|
+
productName: string;
|
|
129
|
+
}): number;
|
|
130
|
+
/**
|
|
131
|
+
* Add Assets.xcassets to a target's Resources build phase if it exists.
|
|
132
|
+
*/
|
|
133
|
+
export declare function addTargetAssets({ platformProjectRoot, targetName, targetUuid, xcodeProject, isStickers, }: {
|
|
134
|
+
platformProjectRoot: string;
|
|
135
|
+
targetName: string;
|
|
136
|
+
targetUuid: string;
|
|
137
|
+
xcodeProject: any;
|
|
138
|
+
isStickers?: boolean;
|
|
139
|
+
}): void;
|
|
140
|
+
/**
|
|
141
|
+
* ============================================================================
|
|
142
|
+
* NEW: Virtual Group Helpers for Reference-in-Place
|
|
143
|
+
* ============================================================================
|
|
144
|
+
* These functions create and manage the "expo:targets" virtual group in Xcode,
|
|
145
|
+
* which contains references to files outside the ios/ directory.
|
|
146
|
+
*/
|
|
147
|
+
/**
|
|
148
|
+
* Ensure the virtual "expo:targets" group exists in Xcode.
|
|
149
|
+
* This group contains references to files outside ios/ directory.
|
|
150
|
+
* Returns the UUID of the expo:targets group.
|
|
151
|
+
*/
|
|
152
|
+
export declare function ensureExpoTargetsGroup({ project, }: {
|
|
153
|
+
project: XcodeProject;
|
|
154
|
+
}): string;
|
|
155
|
+
/**
|
|
156
|
+
* Add target subfolder to expo:targets virtual group.
|
|
157
|
+
* Returns the group UUID for the target.
|
|
158
|
+
*/
|
|
159
|
+
export declare function addTargetToVirtualGroup({ project, targetName, virtualGroupUuid, }: {
|
|
160
|
+
project: XcodeProject;
|
|
161
|
+
targetName: string;
|
|
162
|
+
virtualGroupUuid: string;
|
|
163
|
+
}): string;
|
|
164
|
+
/**
|
|
165
|
+
* Add file reference to group, pointing to external path.
|
|
166
|
+
* Returns the file reference UUID.
|
|
167
|
+
*/
|
|
168
|
+
export declare function addExternalFileReference({ project, groupUuid, filePath, fileName, fileType, }: {
|
|
169
|
+
project: XcodeProject;
|
|
170
|
+
groupUuid: string;
|
|
171
|
+
filePath: string;
|
|
172
|
+
fileName: string;
|
|
173
|
+
fileType?: string;
|
|
174
|
+
}): string;
|
|
175
|
+
/**
|
|
176
|
+
* Add file to specific build phase by file reference UUID.
|
|
177
|
+
*/
|
|
178
|
+
export declare function addFileToBuildPhase({ project, targetUuid, fileRefUuid, phaseType, }: {
|
|
179
|
+
project: XcodeProject;
|
|
180
|
+
targetUuid: string;
|
|
181
|
+
fileRefUuid: string;
|
|
182
|
+
phaseType: 'PBXSourcesBuildPhase' | 'PBXResourcesBuildPhase' | 'PBXFrameworksBuildPhase';
|
|
183
|
+
}): void;
|
|
184
|
+
export {};
|
|
185
|
+
//# sourceMappingURL=xcode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xcode.d.ts","sourceRoot":"","sources":["../../../src/ios/utils/xcode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAMzD;;;GAGG;AAGH,eAAO,MACL,sBAAsB,sDACtB,sBAAsB,sDACtB,yBAAyB,yDACzB,cAAc,8CACd,0BAA0B,wDACJ,CAAC;AAEzB;;GAEG;AACH,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,UAAU,EACV,SAAS,GACV,EAAE;IACD,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAiBV;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,UAAU,EACV,SAAS,GACV,EAAE;IACD,OAAO,EAAE,YAAY,CAAC;IACt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