@expo/config-plugins 5.0.4 → 6.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/build/Plugin.types.d.ts +7 -7
- package/build/Plugin.types.js +0 -9
- package/build/Plugin.types.js.map +1 -1
- package/build/android/AllowBackup.js +0 -15
- package/build/android/AllowBackup.js.map +1 -1
- package/build/android/BuildProperties.js +2 -16
- package/build/android/BuildProperties.js.map +1 -1
- package/build/android/Colors.js +3 -25
- package/build/android/Colors.js.map +1 -1
- package/build/android/EasBuild.js +2 -22
- package/build/android/EasBuild.js.map +1 -1
- package/build/android/EasBuildGradleScript.js.map +1 -1
- package/build/android/GoogleMapsApiKey.js +0 -12
- package/build/android/GoogleMapsApiKey.js.map +1 -1
- package/build/android/GoogleServices.js +10 -48
- package/build/android/GoogleServices.js.map +1 -1
- package/build/android/IntentFilters.d.ts +1 -1
- package/build/android/IntentFilters.js +8 -24
- package/build/android/IntentFilters.js.map +1 -1
- package/build/android/Manifest.d.ts +19 -19
- package/build/android/Manifest.js +7 -66
- package/build/android/Manifest.js.map +1 -1
- package/build/android/Name.js +6 -27
- package/build/android/Name.js.map +1 -1
- package/build/android/Orientation.js +2 -12
- package/build/android/Orientation.js.map +1 -1
- package/build/android/Package.js +26 -111
- package/build/android/Package.js.map +1 -1
- package/build/android/Paths.d.ts +2 -2
- package/build/android/Paths.js +0 -47
- package/build/android/Paths.js.map +1 -1
- package/build/android/Permissions.js +8 -52
- package/build/android/Permissions.js.map +1 -1
- package/build/android/PrimaryColor.js +0 -18
- package/build/android/PrimaryColor.js.map +1 -1
- package/build/android/Properties.d.ts +1 -1
- package/build/android/Properties.js +0 -9
- package/build/android/Properties.js.map +1 -1
- package/build/android/Resources.d.ts +4 -4
- package/build/android/Resources.js +9 -29
- package/build/android/Resources.js.map +1 -1
- package/build/android/Scheme.d.ts +1 -1
- package/build/android/Scheme.js +13 -66
- package/build/android/Scheme.js.map +1 -1
- package/build/android/StatusBar.js +5 -33
- package/build/android/StatusBar.js.map +1 -1
- package/build/android/Strings.js +0 -14
- package/build/android/Strings.js.map +1 -1
- package/build/android/Styles.js +7 -34
- package/build/android/Styles.js.map +1 -1
- package/build/android/Updates.d.ts +2 -0
- package/build/android/Updates.js +50 -47
- package/build/android/Updates.js.map +1 -1
- package/build/android/Version.js +3 -29
- package/build/android/Version.js.map +1 -1
- package/build/android/WindowSoftInputMode.js +0 -14
- package/build/android/WindowSoftInputMode.js.map +1 -1
- package/build/android/codeMod.js +6 -22
- package/build/android/codeMod.js.map +1 -1
- package/build/android/index.js +0 -94
- package/build/android/index.js.map +1 -1
- package/build/index.js +2 -65
- package/build/index.js.map +1 -1
- package/build/ios/Bitcode.d.ts +1 -1
- package/build/ios/Bitcode.js +8 -28
- package/build/ios/Bitcode.js.map +1 -1
- package/build/ios/BuildProperties.js +2 -14
- package/build/ios/BuildProperties.js.map +1 -1
- package/build/ios/BuildScheme.js +2 -34
- package/build/ios/BuildScheme.js.map +1 -1
- package/build/ios/BundleIdentifier.js +13 -72
- package/build/ios/BundleIdentifier.js.map +1 -1
- package/build/ios/DeviceFamily.js +6 -24
- package/build/ios/DeviceFamily.js.map +1 -1
- package/build/ios/Entitlements.js +4 -45
- package/build/ios/Entitlements.js.map +1 -1
- package/build/ios/Google.d.ts +2 -2
- package/build/ios/Google.js +11 -66
- package/build/ios/Google.js.map +1 -1
- package/build/ios/IosConfig.types.d.ts +6 -11
- package/build/ios/IosConfig.types.js.map +1 -1
- package/build/ios/Locales.d.ts +3 -3
- package/build/ios/Locales.js +12 -43
- package/build/ios/Locales.js.map +1 -1
- package/build/ios/Maps.js +15 -53
- package/build/ios/Maps.js.map +1 -1
- package/build/ios/Name.js +7 -31
- package/build/ios/Name.js.map +1 -1
- package/build/ios/Orientation.js +2 -10
- package/build/ios/Orientation.js.map +1 -1
- package/build/ios/Paths.d.ts +2 -2
- package/build/ios/Paths.js +8 -73
- package/build/ios/Paths.js.map +1 -1
- package/build/ios/Permissions.js +1 -16
- package/build/ios/Permissions.js.map +1 -1
- package/build/ios/ProvisioningProfile.d.ts +1 -1
- package/build/ios/ProvisioningProfile.js +0 -18
- package/build/ios/ProvisioningProfile.js.map +1 -1
- package/build/ios/RequiresFullScreen.js +19 -31
- package/build/ios/RequiresFullScreen.js.map +1 -1
- package/build/ios/Scheme.js +10 -32
- package/build/ios/Scheme.js.map +1 -1
- package/build/ios/Swift.js +16 -50
- package/build/ios/Swift.js.map +1 -1
- package/build/ios/Target.js +0 -30
- package/build/ios/Target.js.map +1 -1
- package/build/ios/Updates.js +10 -49
- package/build/ios/Updates.js.map +1 -1
- package/build/ios/UsesNonExemptEncryption.js +4 -10
- package/build/ios/UsesNonExemptEncryption.js.map +1 -1
- package/build/ios/Version.js +4 -11
- package/build/ios/Version.js.map +1 -1
- package/build/ios/XcodeProjectFile.js +5 -23
- package/build/ios/XcodeProjectFile.js.map +1 -1
- package/build/ios/codeMod.js +19 -60
- package/build/ios/codeMod.js.map +1 -1
- package/build/ios/index.js +0 -97
- package/build/ios/index.js.map +1 -1
- package/build/ios/utils/Xcodeproj.d.ts +6 -6
- package/build/ios/utils/Xcodeproj.js +15 -101
- package/build/ios/utils/Xcodeproj.js.map +1 -1
- package/build/ios/utils/getInfoPlistPath.js +2 -15
- package/build/ios/utils/getInfoPlistPath.js.map +1 -1
- package/build/ios/utils/string.js +0 -1
- package/build/ios/utils/string.js.map +1 -1
- package/build/plugins/android-plugins.d.ts +2 -2
- package/build/plugins/android-plugins.js +11 -42
- package/build/plugins/android-plugins.js.map +1 -1
- package/build/plugins/createBaseMod.d.ts +3 -3
- package/build/plugins/createBaseMod.js +8 -25
- package/build/plugins/createBaseMod.js.map +1 -1
- package/build/plugins/ios-plugins.d.ts +2 -2
- package/build/plugins/ios-plugins.js +8 -48
- package/build/plugins/ios-plugins.js.map +1 -1
- package/build/plugins/mod-compiler.js +21 -72
- package/build/plugins/mod-compiler.js.map +1 -1
- package/build/plugins/withAndroidBaseMods.d.ts +1 -1
- package/build/plugins/withAndroidBaseMods.js +4 -89
- package/build/plugins/withAndroidBaseMods.js.map +1 -1
- package/build/plugins/withDangerousMod.js +0 -5
- package/build/plugins/withDangerousMod.js.map +1 -1
- package/build/plugins/withIosBaseMods.d.ts +1 -1
- package/build/plugins/withIosBaseMods.js +26 -118
- package/build/plugins/withIosBaseMods.js.map +1 -1
- package/build/plugins/withMod.d.ts +1 -1
- package/build/plugins/withMod.js +24 -59
- package/build/plugins/withMod.js.map +1 -1
- package/build/plugins/withPlugins.js +0 -9
- package/build/plugins/withPlugins.js.map +1 -1
- package/build/plugins/withRunOnce.js +3 -9
- package/build/plugins/withRunOnce.js.map +1 -1
- package/build/plugins/withStaticPlugin.js +21 -43
- package/build/plugins/withStaticPlugin.js.map +1 -1
- package/build/utils/BuildProperties.types.d.ts +2 -2
- package/build/utils/BuildProperties.types.js.map +1 -1
- package/build/utils/Updates.d.ts +3 -1
- package/build/utils/Updates.js +18 -77
- package/build/utils/Updates.js.map +1 -1
- package/build/utils/XML.d.ts +1 -1
- package/build/utils/XML.js +7 -44
- package/build/utils/XML.js.map +1 -1
- package/build/utils/commonCodeMod.js +2 -10
- package/build/utils/commonCodeMod.js.map +1 -1
- package/build/utils/errors.d.ts +1 -1
- package/build/utils/errors.js +3 -11
- package/build/utils/errors.js.map +1 -1
- package/build/utils/fs.js +1 -12
- package/build/utils/fs.js.map +1 -1
- package/build/utils/generateCode.d.ts +1 -1
- package/build/utils/generateCode.js +8 -25
- package/build/utils/generateCode.js.map +1 -1
- package/build/utils/history.d.ts +1 -1
- package/build/utils/history.js +0 -6
- package/build/utils/history.js.map +1 -1
- package/build/utils/matchBrackets.d.ts +3 -3
- package/build/utils/matchBrackets.js +2 -17
- package/build/utils/matchBrackets.js.map +1 -1
- package/build/utils/modules.js +0 -10
- package/build/utils/modules.js.map +1 -1
- package/build/utils/obj.js +0 -4
- package/build/utils/obj.js.map +1 -1
- package/build/utils/plugin-resolver.js +25 -69
- package/build/utils/plugin-resolver.js.map +1 -1
- package/build/utils/sortObject.js +4 -10
- package/build/utils/sortObject.js.map +1 -1
- package/build/utils/versions.js +0 -10
- package/build/utils/versions.js.map +1 -1
- package/build/utils/warnings.js +1 -9
- package/build/utils/warnings.js.map +1 -1
- package/package.json +5 -5
|
@@ -23,98 +23,69 @@ exports.isNotTestHost = isNotTestHost;
|
|
|
23
23
|
exports.resolvePathOrProject = resolvePathOrProject;
|
|
24
24
|
exports.sanitizedName = sanitizedName;
|
|
25
25
|
exports.unquote = unquote;
|
|
26
|
-
|
|
27
26
|
function _assert() {
|
|
28
27
|
const data = _interopRequireDefault(require("assert"));
|
|
29
|
-
|
|
30
28
|
_assert = function () {
|
|
31
29
|
return data;
|
|
32
30
|
};
|
|
33
|
-
|
|
34
31
|
return data;
|
|
35
32
|
}
|
|
36
|
-
|
|
37
33
|
function _path() {
|
|
38
34
|
const data = _interopRequireDefault(require("path"));
|
|
39
|
-
|
|
40
35
|
_path = function () {
|
|
41
36
|
return data;
|
|
42
37
|
};
|
|
43
|
-
|
|
44
38
|
return data;
|
|
45
39
|
}
|
|
46
|
-
|
|
47
40
|
function _slugify() {
|
|
48
41
|
const data = _interopRequireDefault(require("slugify"));
|
|
49
|
-
|
|
50
42
|
_slugify = function () {
|
|
51
43
|
return data;
|
|
52
44
|
};
|
|
53
|
-
|
|
54
45
|
return data;
|
|
55
46
|
}
|
|
56
|
-
|
|
57
47
|
function _xcode() {
|
|
58
48
|
const data = _interopRequireDefault(require("xcode"));
|
|
59
|
-
|
|
60
49
|
_xcode = function () {
|
|
61
50
|
return data;
|
|
62
51
|
};
|
|
63
|
-
|
|
64
52
|
return data;
|
|
65
53
|
}
|
|
66
|
-
|
|
67
54
|
function _pbxFile() {
|
|
68
55
|
const data = _interopRequireDefault(require("xcode/lib/pbxFile"));
|
|
69
|
-
|
|
70
56
|
_pbxFile = function () {
|
|
71
57
|
return data;
|
|
72
58
|
};
|
|
73
|
-
|
|
74
59
|
return data;
|
|
75
60
|
}
|
|
76
|
-
|
|
77
61
|
function _warnings() {
|
|
78
62
|
const data = require("../../utils/warnings");
|
|
79
|
-
|
|
80
63
|
_warnings = function () {
|
|
81
64
|
return data;
|
|
82
65
|
};
|
|
83
|
-
|
|
84
66
|
return data;
|
|
85
67
|
}
|
|
86
|
-
|
|
87
68
|
function Paths() {
|
|
88
69
|
const data = _interopRequireWildcard(require("../Paths"));
|
|
89
|
-
|
|
90
70
|
Paths = function () {
|
|
91
71
|
return data;
|
|
92
72
|
};
|
|
93
|
-
|
|
94
73
|
return data;
|
|
95
74
|
}
|
|
96
|
-
|
|
97
75
|
function _string() {
|
|
98
76
|
const data = require("./string");
|
|
99
|
-
|
|
100
77
|
_string = function () {
|
|
101
78
|
return data;
|
|
102
79
|
};
|
|
103
|
-
|
|
104
80
|
return data;
|
|
105
81
|
}
|
|
106
|
-
|
|
107
82
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
108
|
-
|
|
109
83
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
110
|
-
|
|
111
84
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
112
|
-
|
|
113
85
|
function getProjectName(projectRoot) {
|
|
114
86
|
const sourceRoot = Paths().getSourceRoot(projectRoot);
|
|
115
87
|
return _path().default.basename(sourceRoot);
|
|
116
88
|
}
|
|
117
|
-
|
|
118
89
|
function resolvePathOrProject(projectRootOrProject) {
|
|
119
90
|
if (typeof projectRootOrProject === 'string') {
|
|
120
91
|
try {
|
|
@@ -123,24 +94,22 @@ function resolvePathOrProject(projectRootOrProject) {
|
|
|
123
94
|
return null;
|
|
124
95
|
}
|
|
125
96
|
}
|
|
126
|
-
|
|
127
97
|
return projectRootOrProject;
|
|
128
|
-
}
|
|
129
|
-
|
|
98
|
+
}
|
|
130
99
|
|
|
100
|
+
// TODO: come up with a better solution for using app.json expo.name in various places
|
|
131
101
|
function sanitizedName(name) {
|
|
132
102
|
// Default to the name `app` when every safe character has been sanitized
|
|
133
103
|
return sanitizedNameForProjects(name) || sanitizedNameForProjects((0, _slugify().default)(name)) || 'app';
|
|
134
104
|
}
|
|
135
|
-
|
|
136
105
|
function sanitizedNameForProjects(name) {
|
|
137
106
|
return name.replace(/[\W_]+/g, '').normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
138
|
-
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// TODO: it's silly and kind of fragile that we look at app config to determine
|
|
139
110
|
// the ios project paths. Overall this function needs to be revamped, just a
|
|
140
111
|
// placeholder for now! Make this more robust when we support applying config
|
|
141
112
|
// at any time (currently it's only applied on eject).
|
|
142
|
-
|
|
143
|
-
|
|
144
113
|
function getHackyProjectName(projectRoot, config) {
|
|
145
114
|
// Attempt to get the current ios folder name (apply).
|
|
146
115
|
try {
|
|
@@ -152,28 +121,24 @@ function getHackyProjectName(projectRoot, config) {
|
|
|
152
121
|
return sanitizedName(projectName);
|
|
153
122
|
}
|
|
154
123
|
}
|
|
155
|
-
|
|
156
124
|
function createProjectFileForGroup({
|
|
157
125
|
filepath,
|
|
158
126
|
group
|
|
159
127
|
}) {
|
|
160
128
|
const file = new (_pbxFile().default)(filepath);
|
|
161
129
|
const conflictingFile = group.children.find(child => child.comment === file.basename);
|
|
162
|
-
|
|
163
130
|
if (conflictingFile) {
|
|
164
131
|
// This can happen when a file like the GoogleService-Info.plist needs to be added and the eject command is run twice.
|
|
165
132
|
// Not much we can do here since it might be a conflicting file.
|
|
166
133
|
return null;
|
|
167
134
|
}
|
|
168
|
-
|
|
169
135
|
return file;
|
|
170
136
|
}
|
|
137
|
+
|
|
171
138
|
/**
|
|
172
139
|
* Add a resource file (ex: `SplashScreen.storyboard`, `Images.xcassets`) to an Xcode project.
|
|
173
140
|
* This is akin to creating a new code file in Xcode with `⌘+n`.
|
|
174
141
|
*/
|
|
175
|
-
|
|
176
|
-
|
|
177
142
|
function addResourceFileToGroup({
|
|
178
143
|
filepath,
|
|
179
144
|
groupName,
|
|
@@ -189,28 +154,23 @@ function addResourceFileToGroup({
|
|
|
189
154
|
project,
|
|
190
155
|
verbose,
|
|
191
156
|
targetUuid,
|
|
192
|
-
|
|
193
157
|
addFileToProject({
|
|
194
158
|
project,
|
|
195
159
|
file
|
|
196
160
|
}) {
|
|
197
161
|
project.addToPbxFileReferenceSection(file);
|
|
198
|
-
|
|
199
162
|
if (isBuildFile) {
|
|
200
163
|
project.addToPbxBuildFileSection(file);
|
|
201
164
|
}
|
|
202
|
-
|
|
203
165
|
project.addToPbxResourcesBuildPhase(file);
|
|
204
166
|
}
|
|
205
|
-
|
|
206
167
|
});
|
|
207
168
|
}
|
|
169
|
+
|
|
208
170
|
/**
|
|
209
171
|
* Add a build source file (ex: `AppDelegate.m`, `ViewController.swift`) to an Xcode project.
|
|
210
172
|
* This is akin to creating a new code file in Xcode with `⌘+n`.
|
|
211
173
|
*/
|
|
212
|
-
|
|
213
|
-
|
|
214
174
|
function addBuildSourceFileToGroup({
|
|
215
175
|
filepath,
|
|
216
176
|
groupName,
|
|
@@ -224,7 +184,6 @@ function addBuildSourceFileToGroup({
|
|
|
224
184
|
project,
|
|
225
185
|
verbose,
|
|
226
186
|
targetUuid,
|
|
227
|
-
|
|
228
187
|
addFileToProject({
|
|
229
188
|
project,
|
|
230
189
|
file
|
|
@@ -233,13 +192,12 @@ function addBuildSourceFileToGroup({
|
|
|
233
192
|
project.addToPbxBuildFileSection(file);
|
|
234
193
|
project.addToPbxSourcesBuildPhase(file);
|
|
235
194
|
}
|
|
236
|
-
|
|
237
195
|
});
|
|
238
|
-
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// TODO(brentvatne): I couldn't figure out how to do this with an existing
|
|
239
199
|
// higher level function exposed by the xcode library, but we should find out how to do
|
|
240
200
|
// that and replace this with it
|
|
241
|
-
|
|
242
|
-
|
|
243
201
|
function addFileToGroupAndLink({
|
|
244
202
|
filepath,
|
|
245
203
|
groupName,
|
|
@@ -253,24 +211,20 @@ function addFileToGroupAndLink({
|
|
|
253
211
|
filepath,
|
|
254
212
|
group
|
|
255
213
|
});
|
|
256
|
-
|
|
257
214
|
if (!file) {
|
|
258
215
|
if (verbose) {
|
|
259
216
|
// This can happen when a file like the GoogleService-Info.plist needs to be added and the eject command is run twice.
|
|
260
217
|
// Not much we can do here since it might be a conflicting file.
|
|
261
218
|
(0, _warnings().addWarningIOS)('ios-xcode-project', `Skipped adding duplicate file "${filepath}" to PBXGroup named "${groupName}"`);
|
|
262
219
|
}
|
|
263
|
-
|
|
264
220
|
return project;
|
|
265
221
|
}
|
|
266
|
-
|
|
267
222
|
if (targetUuid != null) {
|
|
268
223
|
file.target = targetUuid;
|
|
269
224
|
} else {
|
|
270
225
|
const applicationNativeTarget = project.getTarget('com.apple.product-type.application');
|
|
271
226
|
file.target = applicationNativeTarget === null || applicationNativeTarget === void 0 ? void 0 : applicationNativeTarget.uuid;
|
|
272
227
|
}
|
|
273
|
-
|
|
274
228
|
file.uuid = project.generateUuid();
|
|
275
229
|
file.fileRef = project.generateUuid();
|
|
276
230
|
addFileToProject({
|
|
@@ -283,7 +237,6 @@ function addFileToGroupAndLink({
|
|
|
283
237
|
});
|
|
284
238
|
return project;
|
|
285
239
|
}
|
|
286
|
-
|
|
287
240
|
function getApplicationNativeTarget({
|
|
288
241
|
project,
|
|
289
242
|
projectName
|
|
@@ -293,14 +246,13 @@ function getApplicationNativeTarget({
|
|
|
293
246
|
(0, _assert().default)(String(applicationNativeTarget.target.name) === projectName, `Application native target name mismatch. Expected ${projectName}, but found ${applicationNativeTarget.target.name}.`);
|
|
294
247
|
return applicationNativeTarget;
|
|
295
248
|
}
|
|
249
|
+
|
|
296
250
|
/**
|
|
297
251
|
* Add a framework to the default app native target.
|
|
298
252
|
*
|
|
299
253
|
* @param projectName Name of the PBX project.
|
|
300
254
|
* @param framework String ending in `.framework`, i.e. `StoreKit.framework`
|
|
301
255
|
*/
|
|
302
|
-
|
|
303
|
-
|
|
304
256
|
function addFramework({
|
|
305
257
|
project,
|
|
306
258
|
projectName,
|
|
@@ -314,70 +266,53 @@ function addFramework({
|
|
|
314
266
|
target: target.uuid
|
|
315
267
|
});
|
|
316
268
|
}
|
|
317
|
-
|
|
318
269
|
function splitPath(path) {
|
|
319
270
|
// TODO: Should we account for other platforms that may not use `/`
|
|
320
271
|
return path.split('/');
|
|
321
272
|
}
|
|
322
|
-
|
|
323
273
|
const findGroup = (group, name) => {
|
|
324
274
|
if (!group) {
|
|
325
275
|
return undefined;
|
|
326
276
|
}
|
|
327
|
-
|
|
328
277
|
return group.children.find(group => group.comment === name);
|
|
329
278
|
};
|
|
330
|
-
|
|
331
279
|
function findGroupInsideGroup(project, group, name) {
|
|
332
280
|
const foundGroup = findGroup(group, name);
|
|
333
|
-
|
|
334
281
|
if (foundGroup) {
|
|
335
282
|
var _project$getPBXGroupB;
|
|
336
|
-
|
|
337
283
|
return (_project$getPBXGroupB = project.getPBXGroupByKey(foundGroup.value)) !== null && _project$getPBXGroupB !== void 0 ? _project$getPBXGroupB : null;
|
|
338
284
|
}
|
|
339
|
-
|
|
340
285
|
return null;
|
|
341
286
|
}
|
|
342
|
-
|
|
343
287
|
function pbxGroupByPathOrAssert(project, path) {
|
|
344
288
|
const {
|
|
345
289
|
firstProject
|
|
346
290
|
} = project.getFirstProject();
|
|
347
291
|
let group = project.getPBXGroupByKey(firstProject.mainGroup);
|
|
348
292
|
const components = splitPath(path);
|
|
349
|
-
|
|
350
293
|
for (const name of components) {
|
|
351
294
|
const nextGroup = findGroupInsideGroup(project, group, name);
|
|
352
|
-
|
|
353
295
|
if (nextGroup) {
|
|
354
296
|
group = nextGroup;
|
|
355
297
|
} else {
|
|
356
298
|
break;
|
|
357
299
|
}
|
|
358
300
|
}
|
|
359
|
-
|
|
360
301
|
if (!group) {
|
|
361
302
|
throw Error(`Xcode PBXGroup with name "${path}" could not be found in the Xcode project.`);
|
|
362
303
|
}
|
|
363
|
-
|
|
364
304
|
return group;
|
|
365
305
|
}
|
|
366
|
-
|
|
367
306
|
function ensureGroupRecursively(project, filepath) {
|
|
368
307
|
var _topMostGroup;
|
|
369
|
-
|
|
370
308
|
const components = splitPath(filepath);
|
|
371
|
-
|
|
372
309
|
const hasChild = (group, name) => group.children.find(({
|
|
373
310
|
comment
|
|
374
311
|
}) => comment === name);
|
|
375
|
-
|
|
376
312
|
const {
|
|
377
313
|
firstProject
|
|
378
314
|
} = project.getFirstProject();
|
|
379
315
|
let topMostGroup = project.getPBXGroupByKey(firstProject.mainGroup);
|
|
380
|
-
|
|
381
316
|
for (const pathComponent of components) {
|
|
382
317
|
if (topMostGroup && !hasChild(topMostGroup, pathComponent)) {
|
|
383
318
|
topMostGroup.children.push({
|
|
@@ -385,35 +320,28 @@ function ensureGroupRecursively(project, filepath) {
|
|
|
385
320
|
value: project.pbxCreateGroup(pathComponent, '""')
|
|
386
321
|
});
|
|
387
322
|
}
|
|
388
|
-
|
|
389
323
|
topMostGroup = project.pbxGroupByName(pathComponent);
|
|
390
324
|
}
|
|
391
|
-
|
|
392
325
|
return (_topMostGroup = topMostGroup) !== null && _topMostGroup !== void 0 ? _topMostGroup : null;
|
|
393
326
|
}
|
|
327
|
+
|
|
394
328
|
/**
|
|
395
329
|
* Get the pbxproj for the given path
|
|
396
330
|
*/
|
|
397
|
-
|
|
398
|
-
|
|
399
331
|
function getPbxproj(projectRoot) {
|
|
400
332
|
const projectPath = Paths().getPBXProjectPath(projectRoot);
|
|
401
|
-
|
|
402
333
|
const project = _xcode().default.project(projectPath);
|
|
403
|
-
|
|
404
334
|
project.parseSync();
|
|
405
335
|
return project;
|
|
406
336
|
}
|
|
337
|
+
|
|
407
338
|
/**
|
|
408
339
|
* Get the productName for a project, if the name is using a variable `$(TARGET_NAME)`, then attempt to get the value of that variable.
|
|
409
340
|
*
|
|
410
341
|
* @param project
|
|
411
342
|
*/
|
|
412
|
-
|
|
413
|
-
|
|
414
343
|
function getProductName(project) {
|
|
415
344
|
let productName = '$(TARGET_NAME)';
|
|
416
|
-
|
|
417
345
|
try {
|
|
418
346
|
// If the product name is numeric, this will fail (it's a getter).
|
|
419
347
|
// If the bundle identifier' final component is only numeric values, then the PRODUCT_NAME
|
|
@@ -421,67 +349,53 @@ function getProductName(project) {
|
|
|
421
349
|
// i.e. `com.bacon.001` -> `1` -- in this case, use the first target name.
|
|
422
350
|
productName = project.productName;
|
|
423
351
|
} catch {}
|
|
424
|
-
|
|
425
352
|
if (productName === '$(TARGET_NAME)') {
|
|
426
353
|
var _project$getFirstTarg, _project$getFirstTarg2;
|
|
427
|
-
|
|
428
354
|
const targetName = (_project$getFirstTarg = project.getFirstTarget()) === null || _project$getFirstTarg === void 0 ? void 0 : (_project$getFirstTarg2 = _project$getFirstTarg.firstTarget) === null || _project$getFirstTarg2 === void 0 ? void 0 : _project$getFirstTarg2.productName;
|
|
429
355
|
productName = targetName !== null && targetName !== void 0 ? targetName : productName;
|
|
430
356
|
}
|
|
431
|
-
|
|
432
357
|
return productName;
|
|
433
358
|
}
|
|
434
|
-
|
|
435
359
|
function getProjectSection(project) {
|
|
436
360
|
return project.pbxProjectSection();
|
|
437
361
|
}
|
|
438
|
-
|
|
439
362
|
function getXCConfigurationListEntries(project) {
|
|
440
363
|
const lists = project.pbxXCConfigurationList();
|
|
441
364
|
return Object.entries(lists).filter(isNotComment);
|
|
442
365
|
}
|
|
443
|
-
|
|
444
366
|
function getBuildConfigurationsForListId(project, configurationListId) {
|
|
445
367
|
const configurationListEntries = getXCConfigurationListEntries(project);
|
|
446
368
|
const [, configurationList] = configurationListEntries.find(([key]) => key === configurationListId);
|
|
447
369
|
const buildConfigurations = configurationList.buildConfigurations.map(i => i.value);
|
|
448
370
|
return Object.entries(project.pbxXCBuildConfigurationSection()).filter(isNotComment).filter(isBuildConfig).filter(([key]) => buildConfigurations.includes(key));
|
|
449
371
|
}
|
|
450
|
-
|
|
451
372
|
function getBuildConfigurationForListIdAndName(project, {
|
|
452
373
|
configurationListId,
|
|
453
374
|
buildConfiguration
|
|
454
375
|
}) {
|
|
455
376
|
const xcBuildConfigurationEntry = getBuildConfigurationsForListId(project, configurationListId).find(i => (0, _string().trimQuotes)(i[1].name) === buildConfiguration);
|
|
456
|
-
|
|
457
377
|
if (!xcBuildConfigurationEntry) {
|
|
458
378
|
throw new Error(`Build configuration '${buildConfiguration}' does not exist in list with id '${configurationListId}'`);
|
|
459
379
|
}
|
|
460
|
-
|
|
461
380
|
return xcBuildConfigurationEntry;
|
|
462
381
|
}
|
|
463
|
-
|
|
464
382
|
function isBuildConfig([, sectionItem]) {
|
|
465
383
|
return sectionItem.isa === 'XCBuildConfiguration';
|
|
466
384
|
}
|
|
467
|
-
|
|
468
385
|
function isNotTestHost([, sectionItem]) {
|
|
469
386
|
return !sectionItem.buildSettings.TEST_HOST;
|
|
470
387
|
}
|
|
471
|
-
|
|
472
388
|
function isNotComment([key]) {
|
|
473
389
|
return !key.endsWith(`_comment`);
|
|
474
|
-
}
|
|
475
|
-
|
|
390
|
+
}
|
|
476
391
|
|
|
392
|
+
// Remove surrounding double quotes if they exist.
|
|
477
393
|
function unquote(value) {
|
|
478
394
|
var _value$match$, _value$match;
|
|
479
|
-
|
|
480
395
|
// projects with numeric names will fail due to a bug in the xcode package.
|
|
481
396
|
if (typeof value === 'number') {
|
|
482
397
|
value = String(value);
|
|
483
398
|
}
|
|
484
|
-
|
|
485
399
|
return (_value$match$ = (_value$match = value.match(/^"(.*)"$/)) === null || _value$match === void 0 ? void 0 : _value$match[1]) !== null && _value$match$ !== void 0 ? _value$match$ : value;
|
|
486
400
|
}
|
|
487
401
|
//# sourceMappingURL=Xcodeproj.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Xcodeproj.js","names":["getProjectName","projectRoot","sourceRoot","Paths","getSourceRoot","path","basename","resolvePathOrProject","projectRootOrProject","getPbxproj","sanitizedName","name","sanitizedNameForProjects","slugify","replace","normalize","getHackyProjectName","config","projectName","assert","createProjectFileForGroup","filepath","group","file","pbxFile","conflictingFile","children","find","child","comment","addResourceFileToGroup","groupName","isBuildFile","project","verbose","targetUuid","addFileToGroupAndLink","addFileToProject","addToPbxFileReferenceSection","addToPbxBuildFileSection","addToPbxResourcesBuildPhase","addBuildSourceFileToGroup","addToPbxSourcesBuildPhase","pbxGroupByPathOrAssert","addWarningIOS","target","applicationNativeTarget","getTarget","uuid","generateUuid","fileRef","push","value","getApplicationNativeTarget","String","addFramework","framework","splitPath","split","findGroup","undefined","findGroupInsideGroup","foundGroup","getPBXGroupByKey","firstProject","getFirstProject","mainGroup","components","nextGroup","Error","ensureGroupRecursively","hasChild","topMostGroup","pathComponent","pbxCreateGroup","pbxGroupByName","projectPath","getPBXProjectPath","xcode","parseSync","getProductName","productName","targetName","getFirstTarget","firstTarget","getProjectSection","pbxProjectSection","getXCConfigurationListEntries","lists","pbxXCConfigurationList","Object","entries","filter","isNotComment","getBuildConfigurationsForListId","configurationListId","configurationListEntries","configurationList","key","buildConfigurations","map","i","pbxXCBuildConfigurationSection","isBuildConfig","includes","getBuildConfigurationForListIdAndName","buildConfiguration","xcBuildConfigurationEntry","trimQuotes","sectionItem","isa","isNotTestHost","buildSettings","TEST_HOST","endsWith","unquote","match"],"sources":["../../../src/ios/utils/Xcodeproj.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport assert from 'assert';\nimport path from 'path';\nimport slugify from 'slugify';\nimport xcode, {\n PBXFile,\n PBXGroup,\n PBXNativeTarget,\n PBXProject,\n UUID,\n XCBuildConfiguration,\n XCConfigurationList,\n XcodeProject,\n} from 'xcode';\nimport pbxFile from 'xcode/lib/pbxFile';\n\nimport { addWarningIOS } from '../../utils/warnings';\nimport * as Paths from '../Paths';\nimport { trimQuotes } from './string';\n\nexport type ProjectSectionEntry = [string, PBXProject];\n\nexport type NativeTargetSection = Record<string, PBXNativeTarget>;\n\nexport type NativeTargetSectionEntry = [string, PBXNativeTarget];\n\nexport type ConfigurationLists = Record<string, XCConfigurationList>;\n\nexport type ConfigurationListEntry = [string, XCConfigurationList];\n\nexport type ConfigurationSectionEntry = [string, XCBuildConfiguration];\n\nexport function getProjectName(projectRoot: string) {\n const sourceRoot = Paths.getSourceRoot(projectRoot);\n return path.basename(sourceRoot);\n}\n\nexport function resolvePathOrProject(\n projectRootOrProject: string | XcodeProject\n): XcodeProject | null {\n if (typeof projectRootOrProject === 'string') {\n try {\n return getPbxproj(projectRootOrProject);\n } catch {\n return null;\n }\n }\n return projectRootOrProject;\n}\n\n// TODO: come up with a better solution for using app.json expo.name in various places\nexport function sanitizedName(name: string) {\n // Default to the name `app` when every safe character has been sanitized\n return sanitizedNameForProjects(name) || sanitizedNameForProjects(slugify(name)) || 'app';\n}\n\nfunction sanitizedNameForProjects(name: string) {\n return name\n .replace(/[\\W_]+/g, '')\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '');\n}\n\n// TODO: it's silly and kind of fragile that we look at app config to determine\n// the ios project paths. Overall this function needs to be revamped, just a\n// placeholder for now! Make this more robust when we support applying config\n// at any time (currently it's only applied on eject).\nexport function getHackyProjectName(projectRoot: string, config: ExpoConfig): string {\n // Attempt to get the current ios folder name (apply).\n try {\n return getProjectName(projectRoot);\n } catch {\n // If no iOS project exists then create a new one (eject).\n const projectName = config.name;\n assert(projectName, 'Your project needs a name in app.json/app.config.js.');\n return sanitizedName(projectName);\n }\n}\n\nfunction createProjectFileForGroup({ filepath, group }: { filepath: string; group: PBXGroup }) {\n const file = new pbxFile(filepath);\n\n const conflictingFile = group.children.find((child) => child.comment === file.basename);\n if (conflictingFile) {\n // This can happen when a file like the GoogleService-Info.plist needs to be added and the eject command is run twice.\n // Not much we can do here since it might be a conflicting file.\n return null;\n }\n return file;\n}\n\n/**\n * Add a resource file (ex: `SplashScreen.storyboard`, `Images.xcassets`) to an Xcode project.\n * This is akin to creating a new code file in Xcode with `⌘+n`.\n */\nexport function addResourceFileToGroup({\n filepath,\n groupName,\n // Should add to `PBXBuildFile Section`\n isBuildFile,\n project,\n verbose,\n targetUuid,\n}: {\n filepath: string;\n groupName: string;\n isBuildFile?: boolean;\n project: XcodeProject;\n verbose?: boolean;\n targetUuid?: string;\n}): XcodeProject {\n return addFileToGroupAndLink({\n filepath,\n groupName,\n project,\n verbose,\n targetUuid,\n addFileToProject({ project, file }) {\n project.addToPbxFileReferenceSection(file);\n if (isBuildFile) {\n project.addToPbxBuildFileSection(file);\n }\n project.addToPbxResourcesBuildPhase(file);\n },\n });\n}\n\n/**\n * Add a build source file (ex: `AppDelegate.m`, `ViewController.swift`) to an Xcode project.\n * This is akin to creating a new code file in Xcode with `⌘+n`.\n */\nexport function addBuildSourceFileToGroup({\n filepath,\n groupName,\n project,\n verbose,\n targetUuid,\n}: {\n filepath: string;\n groupName: string;\n project: XcodeProject;\n verbose?: boolean;\n targetUuid?: string;\n}): XcodeProject {\n return addFileToGroupAndLink({\n filepath,\n groupName,\n project,\n verbose,\n targetUuid,\n addFileToProject({ project, file }) {\n project.addToPbxFileReferenceSection(file);\n project.addToPbxBuildFileSection(file);\n project.addToPbxSourcesBuildPhase(file);\n },\n });\n}\n\n// TODO(brentvatne): I couldn't figure out how to do this with an existing\n// higher level function exposed by the xcode library, but we should find out how to do\n// that and replace this with it\nexport function addFileToGroupAndLink({\n filepath,\n groupName,\n project,\n verbose,\n addFileToProject,\n targetUuid,\n}: {\n filepath: string;\n groupName: string;\n project: XcodeProject;\n verbose?: boolean;\n targetUuid?: string;\n addFileToProject: (props: { file: PBXFile; project: XcodeProject }) => void;\n}): XcodeProject {\n const group = pbxGroupByPathOrAssert(project, groupName);\n\n const file = createProjectFileForGroup({ filepath, group });\n\n if (!file) {\n if (verbose) {\n // This can happen when a file like the GoogleService-Info.plist needs to be added and the eject command is run twice.\n // Not much we can do here since it might be a conflicting file.\n addWarningIOS(\n 'ios-xcode-project',\n `Skipped adding duplicate file \"${filepath}\" to PBXGroup named \"${groupName}\"`\n );\n }\n return project;\n }\n\n if (targetUuid != null) {\n file.target = targetUuid;\n } else {\n const applicationNativeTarget = project.getTarget('com.apple.product-type.application');\n file.target = applicationNativeTarget?.uuid;\n }\n\n file.uuid = project.generateUuid();\n file.fileRef = project.generateUuid();\n\n addFileToProject({ project, file });\n\n group.children.push({\n value: file.fileRef,\n comment: file.basename,\n });\n return project;\n}\n\nexport function getApplicationNativeTarget({\n project,\n projectName,\n}: {\n project: XcodeProject;\n projectName: string;\n}) {\n const applicationNativeTarget = project.getTarget('com.apple.product-type.application');\n assert(\n applicationNativeTarget,\n `Couldn't locate application PBXNativeTarget in '.xcodeproj' file.`\n );\n assert(\n String(applicationNativeTarget.target.name) === projectName,\n `Application native target name mismatch. Expected ${projectName}, but found ${applicationNativeTarget.target.name}.`\n );\n return applicationNativeTarget;\n}\n\n/**\n * Add a framework to the default app native target.\n *\n * @param projectName Name of the PBX project.\n * @param framework String ending in `.framework`, i.e. `StoreKit.framework`\n */\nexport function addFramework({\n project,\n projectName,\n framework,\n}: {\n project: XcodeProject;\n projectName: string;\n framework: string;\n}) {\n const target = getApplicationNativeTarget({ project, projectName });\n return project.addFramework(framework, { target: target.uuid });\n}\n\nfunction splitPath(path: string): string[] {\n // TODO: Should we account for other platforms that may not use `/`\n return path.split('/');\n}\n\nconst findGroup = (\n group: PBXGroup | undefined,\n name: string\n):\n | {\n value: UUID;\n comment?: string;\n }\n | undefined => {\n if (!group) {\n return undefined;\n }\n\n return group.children.find((group) => group.comment === name);\n};\n\nfunction findGroupInsideGroup(\n project: XcodeProject,\n group: PBXGroup | undefined,\n name: string\n): null | PBXGroup {\n const foundGroup = findGroup(group, name);\n if (foundGroup) {\n return project.getPBXGroupByKey(foundGroup.value) ?? null;\n }\n return null;\n}\n\nfunction pbxGroupByPathOrAssert(project: XcodeProject, path: string): PBXGroup {\n const { firstProject } = project.getFirstProject();\n\n let group = project.getPBXGroupByKey(firstProject.mainGroup);\n\n const components = splitPath(path);\n for (const name of components) {\n const nextGroup = findGroupInsideGroup(project, group, name);\n if (nextGroup) {\n group = nextGroup;\n } else {\n break;\n }\n }\n\n if (!group) {\n throw Error(`Xcode PBXGroup with name \"${path}\" could not be found in the Xcode project.`);\n }\n\n return group;\n}\n\nexport function ensureGroupRecursively(project: XcodeProject, filepath: string): PBXGroup | null {\n const components = splitPath(filepath);\n const hasChild = (group: PBXGroup, name: string) =>\n group.children.find(({ comment }) => comment === name);\n const { firstProject } = project.getFirstProject();\n\n let topMostGroup = project.getPBXGroupByKey(firstProject.mainGroup);\n\n for (const pathComponent of components) {\n if (topMostGroup && !hasChild(topMostGroup, pathComponent)) {\n topMostGroup.children.push({\n comment: pathComponent,\n value: project.pbxCreateGroup(pathComponent, '\"\"'),\n });\n }\n topMostGroup = project.pbxGroupByName(pathComponent);\n }\n return topMostGroup ?? null;\n}\n\n/**\n * Get the pbxproj for the given path\n */\nexport function getPbxproj(projectRoot: string): XcodeProject {\n const projectPath = Paths.getPBXProjectPath(projectRoot);\n const project = xcode.project(projectPath);\n project.parseSync();\n return project;\n}\n\n/**\n * Get the productName for a project, if the name is using a variable `$(TARGET_NAME)`, then attempt to get the value of that variable.\n *\n * @param project\n */\nexport function getProductName(project: XcodeProject): string {\n let productName = '$(TARGET_NAME)';\n try {\n // If the product name is numeric, this will fail (it's a getter).\n // If the bundle identifier' final component is only numeric values, then the PRODUCT_NAME\n // will be a numeric value, this results in a bug where the product name isn't useful,\n // i.e. `com.bacon.001` -> `1` -- in this case, use the first target name.\n productName = project.productName;\n } catch {}\n\n if (productName === '$(TARGET_NAME)') {\n const targetName = project.getFirstTarget()?.firstTarget?.productName;\n productName = targetName ?? productName;\n }\n\n return productName;\n}\n\nexport function getProjectSection(project: XcodeProject) {\n return project.pbxProjectSection();\n}\n\nexport function getXCConfigurationListEntries(project: XcodeProject): ConfigurationListEntry[] {\n const lists = project.pbxXCConfigurationList();\n return Object.entries(lists).filter(isNotComment);\n}\n\nexport function getBuildConfigurationsForListId(\n project: XcodeProject,\n configurationListId: string\n): ConfigurationSectionEntry[] {\n const configurationListEntries = getXCConfigurationListEntries(project);\n const [, configurationList] = configurationListEntries.find(\n ([key]) => key === configurationListId\n ) as ConfigurationListEntry;\n\n const buildConfigurations = configurationList.buildConfigurations.map((i) => i.value);\n\n return Object.entries(project.pbxXCBuildConfigurationSection())\n .filter(isNotComment)\n .filter(isBuildConfig)\n .filter(([key]: ConfigurationSectionEntry) => buildConfigurations.includes(key));\n}\n\nexport function getBuildConfigurationForListIdAndName(\n project: XcodeProject,\n {\n configurationListId,\n buildConfiguration,\n }: { configurationListId: string; buildConfiguration: string }\n): ConfigurationSectionEntry {\n const xcBuildConfigurationEntry = getBuildConfigurationsForListId(\n project,\n configurationListId\n ).find((i) => trimQuotes(i[1].name) === buildConfiguration);\n if (!xcBuildConfigurationEntry) {\n throw new Error(\n `Build configuration '${buildConfiguration}' does not exist in list with id '${configurationListId}'`\n );\n }\n return xcBuildConfigurationEntry;\n}\n\nexport function isBuildConfig([, sectionItem]: ConfigurationSectionEntry): boolean {\n return sectionItem.isa === 'XCBuildConfiguration';\n}\n\nexport function isNotTestHost([, sectionItem]: ConfigurationSectionEntry): boolean {\n return !sectionItem.buildSettings.TEST_HOST;\n}\n\nexport function isNotComment([key]:\n | ConfigurationSectionEntry\n | ProjectSectionEntry\n | ConfigurationListEntry\n | NativeTargetSectionEntry): boolean {\n return !key.endsWith(`_comment`);\n}\n\n// Remove surrounding double quotes if they exist.\nexport function unquote(value: string): string {\n // projects with numeric names will fail due to a bug in the xcode package.\n if (typeof value === 'number') {\n value = String(value);\n }\n return value.match(/^\"(.*)\"$/)?.[1] ?? value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAUA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;;;AAcO,SAASA,cAAT,CAAwBC,WAAxB,EAA6C;EAClD,MAAMC,UAAU,GAAGC,KAAK,GAACC,aAAN,CAAoBH,WAApB,CAAnB;EACA,OAAOI,eAAA,CAAKC,QAAL,CAAcJ,UAAd,CAAP;AACD;;AAEM,SAASK,oBAAT,CACLC,oBADK,EAEgB;EACrB,IAAI,OAAOA,oBAAP,KAAgC,QAApC,EAA8C;IAC5C,IAAI;MACF,OAAOC,UAAU,CAACD,oBAAD,CAAjB;IACD,CAFD,CAEE,MAAM;MACN,OAAO,IAAP;IACD;EACF;;EACD,OAAOA,oBAAP;AACD,C,CAED;;;AACO,SAASE,aAAT,CAAuBC,IAAvB,EAAqC;EAC1C;EACA,OAAOC,wBAAwB,CAACD,IAAD,CAAxB,IAAkCC,wBAAwB,CAAC,IAAAC,kBAAA,EAAQF,IAAR,CAAD,CAA1D,IAA6E,KAApF;AACD;;AAED,SAASC,wBAAT,CAAkCD,IAAlC,EAAgD;E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AD,CAAD,CAAK1F,IAAhB,MAA0B+F,kBAHN,CAAlC;;EAIA,IAAI,CAACC,yBAAL,EAAgC;IAC9B,MAAM,IAAItC,KAAJ,CACH,wBAAuBqC,kBAAmB,qCAAoCX,mBAAoB,GAD/F,CAAN;EAGD;;EACD,OAAOY,yBAAP;AACD;;AAEM,SAASJ,aAAT,CAAuB,GAAGM,WAAH,CAAvB,EAA4E;EACjF,OAAOA,WAAW,CAACC,GAAZ,KAAoB,sBAA3B;AACD;;AAEM,SAASC,aAAT,CAAuB,GAAGF,WAAH,CAAvB,EAA4E;EACjF,OAAO,CAACA,WAAW,CAACG,aAAZ,CAA0BC,SAAlC;AACD;;AAEM,SAASpB,YAAT,CAAsB,CAACK,GAAD,CAAtB,EAIgC;EACrC,OAAO,CAACA,GAAG,CAACgB,QAAJ,CAAc,UAAd,CAAR;AACD,C,CAED;;;AACO,SAASC,OAAT,CAAiB/D,KAAjB,EAAwC;EAAA;;EAC7C;EACA,IAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;IAC7BA,KAAK,GAAGE,MAAM,CAACF,KAAD,CAAd;EACD;;EACD,wCAAOA,KAAK,CAACgE,KAAN,CAAY,UAAZ,CAAP,iDAAO,aAA0B,CAA1B,CAAP,yDAAuChE,KAAvC;AACD"}
|
|
1
|
+
{"version":3,"file":"Xcodeproj.js","names":["getProjectName","projectRoot","sourceRoot","Paths","getSourceRoot","path","basename","resolvePathOrProject","projectRootOrProject","getPbxproj","sanitizedName","name","sanitizedNameForProjects","slugify","replace","normalize","getHackyProjectName","config","projectName","assert","createProjectFileForGroup","filepath","group","file","pbxFile","conflictingFile","children","find","child","comment","addResourceFileToGroup","groupName","isBuildFile","project","verbose","targetUuid","addFileToGroupAndLink","addFileToProject","addToPbxFileReferenceSection","addToPbxBuildFileSection","addToPbxResourcesBuildPhase","addBuildSourceFileToGroup","addToPbxSourcesBuildPhase","pbxGroupByPathOrAssert","addWarningIOS","target","applicationNativeTarget","getTarget","uuid","generateUuid","fileRef","push","value","getApplicationNativeTarget","String","addFramework","framework","splitPath","split","findGroup","undefined","findGroupInsideGroup","foundGroup","getPBXGroupByKey","firstProject","getFirstProject","mainGroup","components","nextGroup","Error","ensureGroupRecursively","hasChild","topMostGroup","pathComponent","pbxCreateGroup","pbxGroupByName","projectPath","getPBXProjectPath","xcode","parseSync","getProductName","productName","targetName","getFirstTarget","firstTarget","getProjectSection","pbxProjectSection","getXCConfigurationListEntries","lists","pbxXCConfigurationList","Object","entries","filter","isNotComment","getBuildConfigurationsForListId","configurationListId","configurationListEntries","configurationList","key","buildConfigurations","map","i","pbxXCBuildConfigurationSection","isBuildConfig","includes","getBuildConfigurationForListIdAndName","buildConfiguration","xcBuildConfigurationEntry","trimQuotes","sectionItem","isa","isNotTestHost","buildSettings","TEST_HOST","endsWith","unquote","match"],"sources":["../../../src/ios/utils/Xcodeproj.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport assert from 'assert';\nimport path from 'path';\nimport slugify from 'slugify';\nimport xcode, {\n PBXFile,\n PBXGroup,\n PBXNativeTarget,\n PBXProject,\n UUID,\n XCBuildConfiguration,\n XCConfigurationList,\n XcodeProject,\n} from 'xcode';\nimport pbxFile from 'xcode/lib/pbxFile';\n\nimport { addWarningIOS } from '../../utils/warnings';\nimport * as Paths from '../Paths';\nimport { trimQuotes } from './string';\n\nexport type ProjectSectionEntry = [string, PBXProject];\n\nexport type NativeTargetSection = Record<string, PBXNativeTarget>;\n\nexport type NativeTargetSectionEntry = [string, PBXNativeTarget];\n\nexport type ConfigurationLists = Record<string, XCConfigurationList>;\n\nexport type ConfigurationListEntry = [string, XCConfigurationList];\n\nexport type ConfigurationSectionEntry = [string, XCBuildConfiguration];\n\nexport function getProjectName(projectRoot: string) {\n const sourceRoot = Paths.getSourceRoot(projectRoot);\n return path.basename(sourceRoot);\n}\n\nexport function resolvePathOrProject(\n projectRootOrProject: string | XcodeProject\n): XcodeProject | null {\n if (typeof projectRootOrProject === 'string') {\n try {\n return getPbxproj(projectRootOrProject);\n } catch {\n return null;\n }\n }\n return projectRootOrProject;\n}\n\n// TODO: come up with a better solution for using app.json expo.name in various places\nexport function sanitizedName(name: string) {\n // Default to the name `app` when every safe character has been sanitized\n return sanitizedNameForProjects(name) || sanitizedNameForProjects(slugify(name)) || 'app';\n}\n\nfunction sanitizedNameForProjects(name: string) {\n return name\n .replace(/[\\W_]+/g, '')\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '');\n}\n\n// TODO: it's silly and kind of fragile that we look at app config to determine\n// the ios project paths. Overall this function needs to be revamped, just a\n// placeholder for now! Make this more robust when we support applying config\n// at any time (currently it's only applied on eject).\nexport function getHackyProjectName(projectRoot: string, config: ExpoConfig): string {\n // Attempt to get the current ios folder name (apply).\n try {\n return getProjectName(projectRoot);\n } catch {\n // If no iOS project exists then create a new one (eject).\n const projectName = config.name;\n assert(projectName, 'Your project needs a name in app.json/app.config.js.');\n return sanitizedName(projectName);\n }\n}\n\nfunction createProjectFileForGroup({ filepath, group }: { filepath: string; group: PBXGroup }) {\n const file = new pbxFile(filepath);\n\n const conflictingFile = group.children.find((child) => child.comment === file.basename);\n if (conflictingFile) {\n // This can happen when a file like the GoogleService-Info.plist needs to be added and the eject command is run twice.\n // Not much we can do here since it might be a conflicting file.\n return null;\n }\n return file;\n}\n\n/**\n * Add a resource file (ex: `SplashScreen.storyboard`, `Images.xcassets`) to an Xcode project.\n * This is akin to creating a new code file in Xcode with `⌘+n`.\n */\nexport function addResourceFileToGroup({\n filepath,\n groupName,\n // Should add to `PBXBuildFile Section`\n isBuildFile,\n project,\n verbose,\n targetUuid,\n}: {\n filepath: string;\n groupName: string;\n isBuildFile?: boolean;\n project: XcodeProject;\n verbose?: boolean;\n targetUuid?: string;\n}): XcodeProject {\n return addFileToGroupAndLink({\n filepath,\n groupName,\n project,\n verbose,\n targetUuid,\n addFileToProject({ project, file }) {\n project.addToPbxFileReferenceSection(file);\n if (isBuildFile) {\n project.addToPbxBuildFileSection(file);\n }\n project.addToPbxResourcesBuildPhase(file);\n },\n });\n}\n\n/**\n * Add a build source file (ex: `AppDelegate.m`, `ViewController.swift`) to an Xcode project.\n * This is akin to creating a new code file in Xcode with `⌘+n`.\n */\nexport function addBuildSourceFileToGroup({\n filepath,\n groupName,\n project,\n verbose,\n targetUuid,\n}: {\n filepath: string;\n groupName: string;\n project: XcodeProject;\n verbose?: boolean;\n targetUuid?: string;\n}): XcodeProject {\n return addFileToGroupAndLink({\n filepath,\n groupName,\n project,\n verbose,\n targetUuid,\n addFileToProject({ project, file }) {\n project.addToPbxFileReferenceSection(file);\n project.addToPbxBuildFileSection(file);\n project.addToPbxSourcesBuildPhase(file);\n },\n });\n}\n\n// TODO(brentvatne): I couldn't figure out how to do this with an existing\n// higher level function exposed by the xcode library, but we should find out how to do\n// that and replace this with it\nexport function addFileToGroupAndLink({\n filepath,\n groupName,\n project,\n verbose,\n addFileToProject,\n targetUuid,\n}: {\n filepath: string;\n groupName: string;\n project: XcodeProject;\n verbose?: boolean;\n targetUuid?: string;\n addFileToProject: (props: { file: PBXFile; project: XcodeProject }) => void;\n}): XcodeProject {\n const group = pbxGroupByPathOrAssert(project, groupName);\n\n const file = createProjectFileForGroup({ filepath, group });\n\n if (!file) {\n if (verbose) {\n // This can happen when a file like the GoogleService-Info.plist needs to be added and the eject command is run twice.\n // Not much we can do here since it might be a conflicting file.\n addWarningIOS(\n 'ios-xcode-project',\n `Skipped adding duplicate file \"${filepath}\" to PBXGroup named \"${groupName}\"`\n );\n }\n return project;\n }\n\n if (targetUuid != null) {\n file.target = targetUuid;\n } else {\n const applicationNativeTarget = project.getTarget('com.apple.product-type.application');\n file.target = applicationNativeTarget?.uuid;\n }\n\n file.uuid = project.generateUuid();\n file.fileRef = project.generateUuid();\n\n addFileToProject({ project, file });\n\n group.children.push({\n value: file.fileRef,\n comment: file.basename,\n });\n return project;\n}\n\nexport function getApplicationNativeTarget({\n project,\n projectName,\n}: {\n project: XcodeProject;\n projectName: string;\n}) {\n const applicationNativeTarget = project.getTarget('com.apple.product-type.application');\n assert(\n applicationNativeTarget,\n `Couldn't locate application PBXNativeTarget in '.xcodeproj' file.`\n );\n assert(\n String(applicationNativeTarget.target.name) === projectName,\n `Application native target name mismatch. Expected ${projectName}, but found ${applicationNativeTarget.target.name}.`\n );\n return applicationNativeTarget;\n}\n\n/**\n * Add a framework to the default app native target.\n *\n * @param projectName Name of the PBX project.\n * @param framework String ending in `.framework`, i.e. `StoreKit.framework`\n */\nexport function addFramework({\n project,\n projectName,\n framework,\n}: {\n project: XcodeProject;\n projectName: string;\n framework: string;\n}) {\n const target = getApplicationNativeTarget({ project, projectName });\n return project.addFramework(framework, { target: target.uuid });\n}\n\nfunction splitPath(path: string): string[] {\n // TODO: Should we account for other platforms that may not use `/`\n return path.split('/');\n}\n\nconst findGroup = (\n group: PBXGroup | undefined,\n name: string\n):\n | {\n value: UUID;\n comment?: string;\n }\n | undefined => {\n if (!group) {\n return undefined;\n }\n\n return group.children.find((group) => group.comment === name);\n};\n\nfunction findGroupInsideGroup(\n project: XcodeProject,\n group: PBXGroup | undefined,\n name: string\n): null | PBXGroup {\n const foundGroup = findGroup(group, name);\n if (foundGroup) {\n return project.getPBXGroupByKey(foundGroup.value) ?? null;\n }\n return null;\n}\n\nfunction pbxGroupByPathOrAssert(project: XcodeProject, path: string): PBXGroup {\n const { firstProject } = project.getFirstProject();\n\n let group = project.getPBXGroupByKey(firstProject.mainGroup);\n\n const components = splitPath(path);\n for (const name of components) {\n const nextGroup = findGroupInsideGroup(project, group, name);\n if (nextGroup) {\n group = nextGroup;\n } else {\n break;\n }\n }\n\n if (!group) {\n throw Error(`Xcode PBXGroup with name \"${path}\" could not be found in the Xcode project.`);\n }\n\n return group;\n}\n\nexport function ensureGroupRecursively(project: XcodeProject, filepath: string): PBXGroup | null {\n const components = splitPath(filepath);\n const hasChild = (group: PBXGroup, name: string) =>\n group.children.find(({ comment }) => comment === name);\n const { firstProject } = project.getFirstProject();\n\n let topMostGroup = project.getPBXGroupByKey(firstProject.mainGroup);\n\n for (const pathComponent of components) {\n if (topMostGroup && !hasChild(topMostGroup, pathComponent)) {\n topMostGroup.children.push({\n comment: pathComponent,\n value: project.pbxCreateGroup(pathComponent, '\"\"'),\n });\n }\n topMostGroup = project.pbxGroupByName(pathComponent);\n }\n return topMostGroup ?? null;\n}\n\n/**\n * Get the pbxproj for the given path\n */\nexport function getPbxproj(projectRoot: string): XcodeProject {\n const projectPath = Paths.getPBXProjectPath(projectRoot);\n const project = xcode.project(projectPath);\n project.parseSync();\n return project;\n}\n\n/**\n * Get the productName for a project, if the name is using a variable `$(TARGET_NAME)`, then attempt to get the value of that variable.\n *\n * @param project\n */\nexport function getProductName(project: XcodeProject): string {\n let productName = '$(TARGET_NAME)';\n try {\n // If the product name is numeric, this will fail (it's a getter).\n // If the bundle identifier' final component is only numeric values, then the PRODUCT_NAME\n // will be a numeric value, this results in a bug where the product name isn't useful,\n // i.e. `com.bacon.001` -> `1` -- in this case, use the first target name.\n productName = project.productName;\n } catch {}\n\n if (productName === '$(TARGET_NAME)') {\n const targetName = project.getFirstTarget()?.firstTarget?.productName;\n productName = targetName ?? productName;\n }\n\n return productName;\n}\n\nexport function getProjectSection(project: XcodeProject) {\n return project.pbxProjectSection();\n}\n\nexport function getXCConfigurationListEntries(project: XcodeProject): ConfigurationListEntry[] {\n const lists = project.pbxXCConfigurationList();\n return Object.entries(lists).filter(isNotComment);\n}\n\nexport function getBuildConfigurationsForListId(\n project: XcodeProject,\n configurationListId: string\n): ConfigurationSectionEntry[] {\n const configurationListEntries = getXCConfigurationListEntries(project);\n const [, configurationList] = configurationListEntries.find(\n ([key]) => key === configurationListId\n ) as ConfigurationListEntry;\n\n const buildConfigurations = configurationList.buildConfigurations.map((i) => i.value);\n\n return Object.entries(project.pbxXCBuildConfigurationSection())\n .filter(isNotComment)\n .filter(isBuildConfig)\n .filter(([key]: ConfigurationSectionEntry) => buildConfigurations.includes(key));\n}\n\nexport function getBuildConfigurationForListIdAndName(\n project: XcodeProject,\n {\n configurationListId,\n buildConfiguration,\n }: { configurationListId: string; buildConfiguration: string }\n): ConfigurationSectionEntry {\n const xcBuildConfigurationEntry = getBuildConfigurationsForListId(\n project,\n configurationListId\n ).find((i) => trimQuotes(i[1].name) === buildConfiguration);\n if (!xcBuildConfigurationEntry) {\n throw new Error(\n `Build configuration '${buildConfiguration}' does not exist in list with id '${configurationListId}'`\n );\n }\n return xcBuildConfigurationEntry;\n}\n\nexport function isBuildConfig([, sectionItem]: ConfigurationSectionEntry): boolean {\n return sectionItem.isa === 'XCBuildConfiguration';\n}\n\nexport function isNotTestHost([, sectionItem]: ConfigurationSectionEntry): boolean {\n return !sectionItem.buildSettings.TEST_HOST;\n}\n\nexport function isNotComment([key]:\n | ConfigurationSectionEntry\n | ProjectSectionEntry\n | ConfigurationListEntry\n | NativeTargetSectionEntry): boolean {\n return !key.endsWith(`_comment`);\n}\n\n// Remove surrounding double quotes if they exist.\nexport function unquote(value: string): string {\n // projects with numeric names will fail due to a bug in the xcode package.\n if (typeof value === 'number') {\n value = String(value);\n }\n return value.match(/^\"(.*)\"$/)?.[1] ?? value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAUA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAsC;AAAA;AAAA;AAc/B,SAASA,cAAc,CAACC,WAAmB,EAAE;EAClD,MAAMC,UAAU,GAAGC,KAAK,GAACC,aAAa,CAACH,WAAW,CAAC;EACnD,OAAOI,eAAI,CAACC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true
|
|
5
5
|
});
|
|
6
6
|
exports.getInfoPlistPathFromPbxproj = getInfoPlistPathFromPbxproj;
|
|
7
|
-
|
|
8
7
|
function _Target() {
|
|
9
8
|
const data = require("../Target");
|
|
10
|
-
|
|
11
9
|
_Target = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _Xcodeproj() {
|
|
19
15
|
const data = require("./Xcodeproj");
|
|
20
|
-
|
|
21
16
|
_Xcodeproj = function () {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
/**
|
|
29
22
|
* Find the Info.plist path linked to a specific build configuration.
|
|
30
23
|
*
|
|
@@ -37,27 +30,21 @@ function getInfoPlistPathFromPbxproj(projectRootOrProject, {
|
|
|
37
30
|
buildConfiguration = 'Release'
|
|
38
31
|
} = {}) {
|
|
39
32
|
const project = (0, _Xcodeproj().resolvePathOrProject)(projectRootOrProject);
|
|
40
|
-
|
|
41
33
|
if (!project) {
|
|
42
34
|
return null;
|
|
43
35
|
}
|
|
44
|
-
|
|
45
36
|
const xcBuildConfiguration = (0, _Target().getXCBuildConfigurationFromPbxproj)(project, {
|
|
46
37
|
targetName,
|
|
47
38
|
buildConfiguration
|
|
48
39
|
});
|
|
49
|
-
|
|
50
40
|
if (!xcBuildConfiguration) {
|
|
51
41
|
return null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
42
|
+
}
|
|
43
|
+
// The `INFOPLIST_FILE` is relative to the project folder, ex: app/Info.plist.
|
|
55
44
|
return sanitizeInfoPlistBuildProperty(xcBuildConfiguration.buildSettings.INFOPLIST_FILE);
|
|
56
45
|
}
|
|
57
|
-
|
|
58
46
|
function sanitizeInfoPlistBuildProperty(infoPlist) {
|
|
59
47
|
var _infoPlist$replace$re;
|
|
60
|
-
|
|
61
48
|
return (_infoPlist$replace$re = infoPlist === null || infoPlist === void 0 ? void 0 : infoPlist.replace(/"/g, '').replace('$(SRCROOT)', '')) !== null && _infoPlist$replace$re !== void 0 ? _infoPlist$replace$re : null;
|
|
62
49
|
}
|
|
63
50
|
//# sourceMappingURL=getInfoPlistPath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getInfoPlistPath.js","names":["getInfoPlistPathFromPbxproj","projectRootOrProject","targetName","buildConfiguration","project","resolvePathOrProject","xcBuildConfiguration","getXCBuildConfigurationFromPbxproj","sanitizeInfoPlistBuildProperty","buildSettings","INFOPLIST_FILE","infoPlist","replace"],"sources":["../../../src/ios/utils/getInfoPlistPath.ts"],"sourcesContent":["import { XcodeProject } from 'xcode';\n\nimport { getXCBuildConfigurationFromPbxproj } from '../Target';\nimport { resolvePathOrProject } from './Xcodeproj';\n\n/**\n * Find the Info.plist path linked to a specific build configuration.\n *\n * @param projectRoot\n * @param param1\n * @returns\n */\nexport function getInfoPlistPathFromPbxproj(\n projectRootOrProject: string | XcodeProject,\n {\n targetName,\n buildConfiguration = 'Release',\n }: { targetName?: string; buildConfiguration?: string | 'Release' | 'Debug' } = {}\n): string | null {\n const project = resolvePathOrProject(projectRootOrProject);\n if (!project) {\n return null;\n }\n\n const xcBuildConfiguration = getXCBuildConfigurationFromPbxproj(project, {\n targetName,\n buildConfiguration,\n });\n if (!xcBuildConfiguration) {\n return null;\n }\n // The `INFOPLIST_FILE` is relative to the project folder, ex: app/Info.plist.\n return sanitizeInfoPlistBuildProperty(xcBuildConfiguration.buildSettings.INFOPLIST_FILE);\n}\n\nfunction sanitizeInfoPlistBuildProperty(infoPlist?: string): string | null {\n return infoPlist?.replace(/\"/g, '').replace('$(SRCROOT)', '') ?? null;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getInfoPlistPath.js","names":["getInfoPlistPathFromPbxproj","projectRootOrProject","targetName","buildConfiguration","project","resolvePathOrProject","xcBuildConfiguration","getXCBuildConfigurationFromPbxproj","sanitizeInfoPlistBuildProperty","buildSettings","INFOPLIST_FILE","infoPlist","replace"],"sources":["../../../src/ios/utils/getInfoPlistPath.ts"],"sourcesContent":["import { XcodeProject } from 'xcode';\n\nimport { getXCBuildConfigurationFromPbxproj } from '../Target';\nimport { resolvePathOrProject } from './Xcodeproj';\n\n/**\n * Find the Info.plist path linked to a specific build configuration.\n *\n * @param projectRoot\n * @param param1\n * @returns\n */\nexport function getInfoPlistPathFromPbxproj(\n projectRootOrProject: string | XcodeProject,\n {\n targetName,\n buildConfiguration = 'Release',\n }: { targetName?: string; buildConfiguration?: string | 'Release' | 'Debug' } = {}\n): string | null {\n const project = resolvePathOrProject(projectRootOrProject);\n if (!project) {\n return null;\n }\n\n const xcBuildConfiguration = getXCBuildConfigurationFromPbxproj(project, {\n targetName,\n buildConfiguration,\n });\n if (!xcBuildConfiguration) {\n return null;\n }\n // The `INFOPLIST_FILE` is relative to the project folder, ex: app/Info.plist.\n return sanitizeInfoPlistBuildProperty(xcBuildConfiguration.buildSettings.INFOPLIST_FILE);\n}\n\nfunction sanitizeInfoPlistBuildProperty(infoPlist?: string): string | null {\n return infoPlist?.replace(/\"/g, '').replace('$(SRCROOT)', '') ?? null;\n}\n"],"mappings":";;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,2BAA2B,CACzCC,oBAA2C,EAC3C;EACEC,UAAU;EACVC,kBAAkB,GAAG;AACqD,CAAC,GAAG,CAAC,CAAC,EACnE;EACf,MAAMC,OAAO,GAAG,IAAAC,iCAAoB,EAACJ,oBAAoB,CAAC;EAC1D,IAAI,CAACG,OAAO,EAAE;IACZ,OAAO,IAAI;EACb;EAEA,MAAME,oBAAoB,GAAG,IAAAC,4CAAkC,EAACH,OAAO,EAAE;IACvEF,UAAU;IACVC;EACF,CAAC,CAAC;EACF,IAAI,CAACG,oBAAoB,EAAE;IACzB,OAAO,IAAI;EACb;EACA;EACA,OAAOE,8BAA8B,CAACF,oBAAoB,CAACG,aAAa,CAACC,cAAc,CAAC;AAC1F;AAEA,SAASF,8BAA8B,CAACG,SAAkB,EAAiB;EAAA;EACzE,gCAAOA,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAACA,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,yEAAI,IAAI;AACvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","names":["trimQuotes","s","length","slice"],"sources":["../../../src/ios/utils/string.ts"],"sourcesContent":["export function trimQuotes(s: string): string {\n return s && s[0] === '\"' && s[s.length - 1] === '\"' ? s.slice(1, -1) : s;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"string.js","names":["trimQuotes","s","length","slice"],"sources":["../../../src/ios/utils/string.ts"],"sourcesContent":["export function trimQuotes(s: string): string {\n return s && s[0] === '\"' && s[s.length - 1] === '\"' ? s.slice(1, -1) : s;\n}\n"],"mappings":";;;;;;AAAO,SAASA,UAAU,CAACC,CAAS,EAAU;EAC5C,OAAOA,CAAC,IAAIA,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAIA,CAAC,CAACA,CAAC,CAACC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,GAAGD,CAAC,CAACE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAGF,CAAC;AAC1E"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ExpoConfig } from '@expo/config-types';
|
|
2
2
|
import { ConfigPlugin, Mod } from '../Plugin.types';
|
|
3
3
|
import { Manifest, Paths, Properties, Resources } from '../android';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type OptionalPromise<T> = T | Promise<T>;
|
|
5
|
+
type MutateDataAction<T> = (expo: ExpoConfig, data: T) => OptionalPromise<T>;
|
|
6
6
|
/**
|
|
7
7
|
* Helper method for creating mods from existing config functions.
|
|
8
8
|
*
|