@vxrn/utils 2.0.0-beta.99.1 → 2.6.1
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/dist/cjs/createMessageSocket.native.cjs +1 -1
- package/dist/cjs/createMessageSocket.native.js +1 -1
- package/dist/cjs/createMessageSocket.native.js.map +1 -1
- package/dist/cjs/detectPackageManager.cjs +3 -2
- package/dist/cjs/detectPackageManager.native.cjs +5 -4
- package/dist/cjs/detectPackageManager.native.js +5 -4
- package/dist/cjs/detectPackageManager.native.js.map +1 -1
- package/dist/cjs/exec.native.cjs +3 -3
- package/dist/cjs/exec.native.js +3 -3
- package/dist/cjs/exec.native.js.map +1 -1
- package/dist/cjs/nativeAppManifest.cjs +231 -1
- package/dist/cjs/nativeAppManifest.native.cjs +328 -6
- package/dist/cjs/nativeAppManifest.native.js +328 -6
- package/dist/cjs/nativeAppManifest.native.js.map +1 -1
- package/dist/esm/createMessageSocket.native.js +1 -1
- package/dist/esm/createMessageSocket.native.js.map +1 -1
- package/dist/esm/detectPackageManager.mjs +3 -2
- package/dist/esm/detectPackageManager.mjs.map +1 -1
- package/dist/esm/detectPackageManager.native.js +5 -4
- package/dist/esm/detectPackageManager.native.js.map +1 -1
- package/dist/esm/exec.native.js +3 -3
- package/dist/esm/exec.native.js.map +1 -1
- package/dist/esm/nativeAppManifest.mjs +228 -1
- package/dist/esm/nativeAppManifest.mjs.map +1 -1
- package/dist/esm/nativeAppManifest.native.js +325 -6
- package/dist/esm/nativeAppManifest.native.js.map +1 -1
- package/package.json +5 -4
- package/src/createMessageSocket.ts +1 -1
- package/src/detectPackageManager.ts +3 -2
- package/src/nativeAppManifest.test.ts +180 -1
- package/src/nativeAppManifest.ts +517 -1
- package/types/detectPackageManager.d.ts.map +1 -1
- package/types/nativeAppManifest.d.ts +135 -1
- package/types/nativeAppManifest.d.ts.map +1 -1
|
@@ -21,7 +21,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
21
21
|
};
|
|
22
22
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
23
|
var nativeAppManifest_exports = {};
|
|
24
|
-
__export(nativeAppManifest_exports, {
|
|
24
|
+
__export(nativeAppManifest_exports, {
|
|
25
|
+
expoClientFromNativeApp: () => expoClientFromNativeApp,
|
|
26
|
+
validateNativeApp: () => validateNativeApp
|
|
27
|
+
});
|
|
25
28
|
module.exports = __toCommonJS(nativeAppManifest_exports);
|
|
26
29
|
var TARGET_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;
|
|
27
30
|
var SCHEME = /^[a-z][a-z0-9+.-]*$/i;
|
|
@@ -30,11 +33,22 @@ var BUILD_NUMBER = /^[A-Za-z0-9.]+$/;
|
|
|
30
33
|
var REVERSE_DNS = /^[A-Za-z][A-Za-z0-9-]*(\.[A-Za-z][A-Za-z0-9-]*)+$/;
|
|
31
34
|
var DEPLOYMENT_TARGET = /^\d+\.\d+$/;
|
|
32
35
|
var HEX_COLOR = /^#[\da-f]{6}$/i;
|
|
36
|
+
var FONT_FILE = /\.(ttf|otf)$/i;
|
|
37
|
+
var ORIENTATIONS = [
|
|
38
|
+
"portrait",
|
|
39
|
+
"landscape",
|
|
40
|
+
"default"
|
|
41
|
+
];
|
|
42
|
+
var USER_INTERFACE_STYLES = [
|
|
43
|
+
"light",
|
|
44
|
+
"dark",
|
|
45
|
+
"automatic"
|
|
46
|
+
];
|
|
33
47
|
function fail(message) {
|
|
34
48
|
throw new Error(`[one] invalid native.app: ${message}`);
|
|
35
49
|
}
|
|
36
50
|
function validateNativeApp(manifest, platform) {
|
|
37
|
-
var _manifest_imagePicker;
|
|
51
|
+
var _manifest_ios, _manifest_ios1, _manifest_ios2, _manifest_splash, _manifest_splash_dark, _manifest_splash1, _manifest_splash2, _manifest_imagePicker, _manifest_imagePicker1, _manifest_photoLibrary, _manifest_photoLibrary1, _manifest_location, _manifest_location1, _manifest_ios3, _manifest_speech, _manifest_pedometer, _manifest_ios4;
|
|
38
52
|
if (!manifest || typeof manifest !== "object") fail("manifest must be an object");
|
|
39
53
|
if (!manifest.name || typeof manifest.name !== "string") fail("name is required");
|
|
40
54
|
if (!TARGET_NAME.test(manifest.name)) {
|
|
@@ -63,31 +77,250 @@ function validateNativeApp(manifest, platform) {
|
|
|
63
77
|
}
|
|
64
78
|
}
|
|
65
79
|
}
|
|
80
|
+
if (manifest.orientation !== void 0 && !ORIENTATIONS.includes(manifest.orientation)) {
|
|
81
|
+
fail(`orientation "${manifest.orientation}" must be ${ORIENTATIONS.join(", ")}`);
|
|
82
|
+
}
|
|
83
|
+
if (manifest.userInterfaceStyle !== void 0 && !USER_INTERFACE_STYLES.includes(manifest.userInterfaceStyle)) {
|
|
84
|
+
fail(`userInterfaceStyle "${manifest.userInterfaceStyle}" must be ${USER_INTERFACE_STYLES.join(", ")}`);
|
|
85
|
+
}
|
|
86
|
+
if (manifest.fonts !== void 0) {
|
|
87
|
+
var names = /* @__PURE__ */ new Set();
|
|
88
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
89
|
+
try {
|
|
90
|
+
for (var _iterator1 = manifest.fonts[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
91
|
+
var font = _step1.value;
|
|
92
|
+
var _font_split_pop;
|
|
93
|
+
if (typeof font !== "string" || !FONT_FILE.test(font)) {
|
|
94
|
+
fail(`fonts entry "${font}" must be a .ttf or .otf file path`);
|
|
95
|
+
}
|
|
96
|
+
var name = (_font_split_pop = font.split("/").pop()) !== null && _font_split_pop !== void 0 ? _font_split_pop : font;
|
|
97
|
+
if (names.has(name)) fail(`fonts lists ${name} twice`);
|
|
98
|
+
names.add(name);
|
|
99
|
+
}
|
|
100
|
+
} catch (err) {
|
|
101
|
+
_didIteratorError1 = true;
|
|
102
|
+
_iteratorError1 = err;
|
|
103
|
+
} finally {
|
|
104
|
+
try {
|
|
105
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
106
|
+
_iterator1.return();
|
|
107
|
+
}
|
|
108
|
+
} finally {
|
|
109
|
+
if (_didIteratorError1) {
|
|
110
|
+
throw _iteratorError1;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
66
115
|
if (manifest.version !== void 0 && !VERSION.test(manifest.version)) {
|
|
67
116
|
fail(`version "${manifest.version}" must start with major.minor.patch`);
|
|
68
117
|
}
|
|
69
118
|
if (manifest.icon !== void 0 && (!manifest.icon.source || !HEX_COLOR.test(manifest.icon.backgroundColor))) {
|
|
70
119
|
fail("icon requires source and a six-digit hex backgroundColor");
|
|
71
120
|
}
|
|
121
|
+
if (((_manifest_ios = manifest.ios) === null || _manifest_ios === void 0 ? void 0 : _manifest_ios.alternateIcons) !== void 0) {
|
|
122
|
+
if (!manifest.icon) fail("ios.alternateIcons requires a primary icon");
|
|
123
|
+
var entries = Object.entries(manifest.ios.alternateIcons);
|
|
124
|
+
if (entries.length === 0) fail("ios.alternateIcons requires at least one icon");
|
|
125
|
+
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
|
|
126
|
+
try {
|
|
127
|
+
for (var _iterator2 = entries[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
128
|
+
var [name1, icon] = _step2.value;
|
|
129
|
+
if (name1 === "AppIcon" || !TARGET_NAME.test(name1)) {
|
|
130
|
+
fail(`ios.alternateIcons name "${name1}" must be an identifier other than AppIcon`);
|
|
131
|
+
}
|
|
132
|
+
if (!(icon === null || icon === void 0 ? void 0 : icon.source) || !HEX_COLOR.test(icon.backgroundColor)) {
|
|
133
|
+
fail(`ios.alternateIcons.${name1} requires source and a six-digit hex backgroundColor`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
} catch (err) {
|
|
137
|
+
_didIteratorError2 = true;
|
|
138
|
+
_iteratorError2 = err;
|
|
139
|
+
} finally {
|
|
140
|
+
try {
|
|
141
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
142
|
+
_iterator2.return();
|
|
143
|
+
}
|
|
144
|
+
} finally {
|
|
145
|
+
if (_didIteratorError2) {
|
|
146
|
+
throw _iteratorError2;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (((_manifest_ios1 = manifest.ios) === null || _manifest_ios1 === void 0 ? void 0 : _manifest_ios1.backgroundTasks) !== void 0) {
|
|
152
|
+
var _tasks_refresh, _tasks_processing;
|
|
153
|
+
var tasks = manifest.ios.backgroundTasks;
|
|
154
|
+
if (!tasks || tasks.refresh !== void 0 && !Array.isArray(tasks.refresh) || tasks.processing !== void 0 && !Array.isArray(tasks.processing)) {
|
|
155
|
+
fail("ios.backgroundTasks refresh and processing must be arrays of identifiers");
|
|
156
|
+
}
|
|
157
|
+
var identifiers = [...(_tasks_refresh = tasks.refresh) !== null && _tasks_refresh !== void 0 ? _tasks_refresh : [], ...(_tasks_processing = tasks.processing) !== null && _tasks_processing !== void 0 ? _tasks_processing : []];
|
|
158
|
+
if (!identifiers.length || new Set(identifiers).size !== identifiers.length) {
|
|
159
|
+
fail("ios.backgroundTasks needs distinct refresh or processing identifiers");
|
|
160
|
+
}
|
|
161
|
+
var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = void 0;
|
|
162
|
+
try {
|
|
163
|
+
for (var _iterator3 = identifiers[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
164
|
+
var identifier = _step3.value;
|
|
165
|
+
if (typeof identifier !== "string" || !REVERSE_DNS.test(identifier)) {
|
|
166
|
+
fail(`ios.backgroundTasks identifier "${identifier}" must use reverse DNS notation`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
} catch (err) {
|
|
170
|
+
_didIteratorError3 = true;
|
|
171
|
+
_iteratorError3 = err;
|
|
172
|
+
} finally {
|
|
173
|
+
try {
|
|
174
|
+
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
175
|
+
_iterator3.return();
|
|
176
|
+
}
|
|
177
|
+
} finally {
|
|
178
|
+
if (_didIteratorError3) {
|
|
179
|
+
throw _iteratorError3;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (((_manifest_ios2 = manifest.ios) === null || _manifest_ios2 === void 0 ? void 0 : _manifest_ios2.appIntents) !== void 0) {
|
|
185
|
+
var _manifest_ios_appIntents;
|
|
186
|
+
var actions = (_manifest_ios_appIntents = manifest.ios.appIntents) === null || _manifest_ios_appIntents === void 0 ? void 0 : _manifest_ios_appIntents.actions;
|
|
187
|
+
if (!Array.isArray(actions) || actions.length === 0) {
|
|
188
|
+
fail("ios.appIntents.actions must be a non-empty array");
|
|
189
|
+
}
|
|
190
|
+
var ids = /* @__PURE__ */ new Set();
|
|
191
|
+
var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = void 0;
|
|
192
|
+
try {
|
|
193
|
+
for (var _iterator4 = actions[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
|
194
|
+
var action = _step4.value;
|
|
195
|
+
if (!action || typeof action !== "object" || typeof action.id !== "string" || !action.id.trim() || typeof action.title !== "string" || !action.title.trim() || action.textParameterTitle !== void 0 && (typeof action.textParameterTitle !== "string" || !action.textParameterTitle.trim()) || typeof action.shortcutPhrase !== "string" || action.shortcutPhrase.split("{app}").length !== 2 || !action.shortcutPhrase.replace("{app}", "").trim()) {
|
|
196
|
+
fail("ios.appIntents actions need unique non-empty id/title, optional textParameterTitle, and a shortcutPhrase with one {app}");
|
|
197
|
+
}
|
|
198
|
+
if (ids.has(action.id)) fail(`ios.appIntents action "${action.id}" is duplicated`);
|
|
199
|
+
ids.add(action.id);
|
|
200
|
+
}
|
|
201
|
+
} catch (err) {
|
|
202
|
+
_didIteratorError4 = true;
|
|
203
|
+
_iteratorError4 = err;
|
|
204
|
+
} finally {
|
|
205
|
+
try {
|
|
206
|
+
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
|
|
207
|
+
_iterator4.return();
|
|
208
|
+
}
|
|
209
|
+
} finally {
|
|
210
|
+
if (_didIteratorError4) {
|
|
211
|
+
throw _iteratorError4;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
72
216
|
if (manifest.splash !== void 0 && (!manifest.splash.source || !HEX_COLOR.test(manifest.splash.backgroundColor) || manifest.splash.width !== void 0 && (!Number.isFinite(manifest.splash.width) || manifest.splash.width < 1 || manifest.splash.width > 288))) {
|
|
73
217
|
fail("splash requires source, a six-digit hex backgroundColor, and width from 1 to 288");
|
|
74
218
|
}
|
|
219
|
+
if (((_manifest_splash = manifest.splash) === null || _manifest_splash === void 0 ? void 0 : _manifest_splash.dark) !== void 0 && !HEX_COLOR.test(manifest.splash.dark.backgroundColor)) {
|
|
220
|
+
fail("splash.dark requires a six-digit hex backgroundColor");
|
|
221
|
+
}
|
|
222
|
+
if (((_manifest_splash1 = manifest.splash) === null || _manifest_splash1 === void 0 ? void 0 : (_manifest_splash_dark = _manifest_splash1.dark) === null || _manifest_splash_dark === void 0 ? void 0 : _manifest_splash_dark.backgroundImage) !== void 0 && manifest.splash.backgroundImage === void 0) {
|
|
223
|
+
fail("splash.dark.backgroundImage needs splash.backgroundImage for the light launch");
|
|
224
|
+
}
|
|
225
|
+
if (((_manifest_splash2 = manifest.splash) === null || _manifest_splash2 === void 0 ? void 0 : _manifest_splash2.resizeMode) !== void 0 && manifest.splash.resizeMode !== "contain" && manifest.splash.resizeMode !== "cover") {
|
|
226
|
+
fail(`splash.resizeMode "${manifest.splash.resizeMode}" must be contain or cover`);
|
|
227
|
+
}
|
|
75
228
|
if (((_manifest_imagePicker = manifest.imagePicker) === null || _manifest_imagePicker === void 0 ? void 0 : _manifest_imagePicker.camera) !== void 0 && (typeof manifest.imagePicker.camera !== "string" || manifest.imagePicker.camera.trim() === "")) {
|
|
76
229
|
fail("imagePicker.camera must be a non-empty string");
|
|
77
230
|
}
|
|
231
|
+
if (((_manifest_imagePicker1 = manifest.imagePicker) === null || _manifest_imagePicker1 === void 0 ? void 0 : _manifest_imagePicker1.microphone) !== void 0 && (typeof manifest.imagePicker.microphone !== "string" || manifest.imagePicker.microphone.trim() === "")) {
|
|
232
|
+
fail("imagePicker.microphone must be a non-empty string");
|
|
233
|
+
}
|
|
234
|
+
if (manifest.photoLibrary !== void 0 && (!manifest.photoLibrary || manifest.photoLibrary.addOnly === void 0 && manifest.photoLibrary.readWrite === void 0)) {
|
|
235
|
+
fail("photoLibrary must configure addOnly or readWrite");
|
|
236
|
+
}
|
|
237
|
+
if (((_manifest_photoLibrary = manifest.photoLibrary) === null || _manifest_photoLibrary === void 0 ? void 0 : _manifest_photoLibrary.addOnly) !== void 0 && (typeof manifest.photoLibrary.addOnly !== "string" || manifest.photoLibrary.addOnly.trim() === "")) {
|
|
238
|
+
fail("photoLibrary.addOnly must be a non-empty string");
|
|
239
|
+
}
|
|
240
|
+
if (((_manifest_photoLibrary1 = manifest.photoLibrary) === null || _manifest_photoLibrary1 === void 0 ? void 0 : _manifest_photoLibrary1.readWrite) !== void 0 && (typeof manifest.photoLibrary.readWrite !== "string" || manifest.photoLibrary.readWrite.trim() === "")) {
|
|
241
|
+
fail("photoLibrary.readWrite must be a non-empty string");
|
|
242
|
+
}
|
|
243
|
+
if (manifest.contacts !== void 0 && (!manifest.contacts || typeof manifest.contacts.usage !== "string" || manifest.contacts.usage.trim() === "")) {
|
|
244
|
+
fail("contacts.usage must be a non-empty string");
|
|
245
|
+
}
|
|
246
|
+
if (manifest.calendar !== void 0) {
|
|
247
|
+
if (!manifest.calendar || manifest.calendar.usage === void 0 && manifest.calendar.remindersUsage === void 0) {
|
|
248
|
+
fail("calendar.usage or calendar.remindersUsage must be a non-empty string");
|
|
249
|
+
}
|
|
250
|
+
if (manifest.calendar.usage !== void 0 && (typeof manifest.calendar.usage !== "string" || manifest.calendar.usage.trim() === "")) {
|
|
251
|
+
fail("calendar.usage must be a non-empty string");
|
|
252
|
+
}
|
|
253
|
+
if (manifest.calendar.remindersUsage !== void 0 && (typeof manifest.calendar.remindersUsage !== "string" || manifest.calendar.remindersUsage.trim() === "")) {
|
|
254
|
+
fail("calendar.remindersUsage must be a non-empty string");
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (manifest.location !== void 0 && (!manifest.location || typeof manifest.location.whenInUse !== "string" || manifest.location.whenInUse.trim() === "")) {
|
|
258
|
+
fail("location.whenInUse must be a non-empty string");
|
|
259
|
+
}
|
|
260
|
+
if (((_manifest_location = manifest.location) === null || _manifest_location === void 0 ? void 0 : _manifest_location.background) !== void 0 && typeof manifest.location.background !== "boolean") {
|
|
261
|
+
fail("location.background must be a boolean");
|
|
262
|
+
}
|
|
263
|
+
if (((_manifest_location1 = manifest.location) === null || _manifest_location1 === void 0 ? void 0 : _manifest_location1.alwaysAndWhenInUse) !== void 0 && (typeof manifest.location.alwaysAndWhenInUse !== "string" || manifest.location.alwaysAndWhenInUse.trim() === "")) {
|
|
264
|
+
fail("location.alwaysAndWhenInUse must be a non-empty string");
|
|
265
|
+
}
|
|
266
|
+
if (manifest.audio !== void 0) {
|
|
267
|
+
if (!manifest.audio || typeof manifest.audio !== "object") {
|
|
268
|
+
fail("audio must configure microphone or background playback");
|
|
269
|
+
}
|
|
270
|
+
if (manifest.audio.microphone !== void 0 && (typeof manifest.audio.microphone !== "string" || manifest.audio.microphone.trim() === "")) {
|
|
271
|
+
fail("audio.microphone must be a non-empty string");
|
|
272
|
+
}
|
|
273
|
+
if (manifest.audio.background !== void 0 && typeof manifest.audio.background !== "boolean") {
|
|
274
|
+
fail("audio.background must be a boolean");
|
|
275
|
+
}
|
|
276
|
+
if (manifest.audio.microphone === void 0 && manifest.audio.background !== true) {
|
|
277
|
+
fail("audio must configure microphone or background playback");
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (((_manifest_ios3 = manifest.ios) === null || _manifest_ios3 === void 0 ? void 0 : _manifest_ios3.faceIdUsageDescription) !== void 0 && (typeof manifest.ios.faceIdUsageDescription !== "string" || manifest.ios.faceIdUsageDescription.trim() === "")) {
|
|
281
|
+
fail("ios.faceIdUsageDescription must be a non-empty string");
|
|
282
|
+
}
|
|
283
|
+
if (manifest.speech !== void 0 && (typeof ((_manifest_speech = manifest.speech) === null || _manifest_speech === void 0 ? void 0 : _manifest_speech.recognition) !== "string" || manifest.speech.recognition.trim() === "" || typeof manifest.speech.microphone !== "string" || manifest.speech.microphone.trim() === "")) {
|
|
284
|
+
fail("speech.recognition and speech.microphone must be non-empty strings");
|
|
285
|
+
}
|
|
286
|
+
if (manifest.brightness !== void 0 && typeof manifest.brightness !== "boolean") {
|
|
287
|
+
fail("brightness must be a boolean");
|
|
288
|
+
}
|
|
289
|
+
if (manifest.pedometer !== void 0 && (typeof ((_manifest_pedometer = manifest.pedometer) === null || _manifest_pedometer === void 0 ? void 0 : _manifest_pedometer.usage) !== "string" || manifest.pedometer.usage.trim() === "")) {
|
|
290
|
+
fail("pedometer.usage must be a non-empty string");
|
|
291
|
+
}
|
|
78
292
|
if (manifest.notifications !== void 0) {
|
|
79
293
|
if (typeof manifest.notifications !== "object" || manifest.notifications.push !== void 0 && typeof manifest.notifications.push !== "boolean") {
|
|
80
294
|
fail("notifications.push must be a boolean");
|
|
81
295
|
}
|
|
296
|
+
var aps = manifest.notifications.apsEnvironment;
|
|
297
|
+
if (aps !== void 0 && aps !== "development" && aps !== "production") {
|
|
298
|
+
fail(`notifications.apsEnvironment "${aps}" must be development or production`);
|
|
299
|
+
}
|
|
300
|
+
if (aps !== void 0 && !manifest.notifications.push) {
|
|
301
|
+
fail("notifications.apsEnvironment needs notifications.push");
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
var accent = (_manifest_ios4 = manifest.ios) === null || _manifest_ios4 === void 0 ? void 0 : _manifest_ios4.accentColor;
|
|
305
|
+
if (accent !== void 0 && (!HEX_COLOR.test(accent.light) || accent.dark !== void 0 && !HEX_COLOR.test(accent.dark))) {
|
|
306
|
+
fail("ios.accentColor light and dark must be six-digit hex colors");
|
|
82
307
|
}
|
|
83
308
|
if (manifest.pictureInPicture !== void 0 && typeof manifest.pictureInPicture !== "boolean") {
|
|
84
309
|
fail("pictureInPicture must be a boolean");
|
|
85
310
|
}
|
|
311
|
+
if (manifest.updates !== void 0) {
|
|
312
|
+
if (typeof manifest.updates.runtimeVersion !== "string" || manifest.updates.runtimeVersion.trim() === "") {
|
|
313
|
+
fail("updates.runtimeVersion must be a non-empty string");
|
|
314
|
+
}
|
|
315
|
+
if (manifest.updates.url !== void 0 && (typeof manifest.updates.url !== "string" || manifest.updates.url.trim() === "")) {
|
|
316
|
+
fail("updates.url must be a non-empty string");
|
|
317
|
+
}
|
|
318
|
+
}
|
|
86
319
|
if (!platform || platform === "ios") {
|
|
87
|
-
var
|
|
88
|
-
if (!((
|
|
89
|
-
var
|
|
90
|
-
fail(`ios.bundleId "${(
|
|
320
|
+
var _manifest_ios5;
|
|
321
|
+
if (!((_manifest_ios5 = manifest.ios) === null || _manifest_ios5 === void 0 ? void 0 : _manifest_ios5.bundleId) || !REVERSE_DNS.test(manifest.ios.bundleId)) {
|
|
322
|
+
var _manifest_ios6;
|
|
323
|
+
fail(`ios.bundleId "${(_manifest_ios6 = manifest.ios) === null || _manifest_ios6 === void 0 ? void 0 : _manifest_ios6.bundleId}" must be reverse-dns`);
|
|
91
324
|
}
|
|
92
325
|
if (manifest.ios.deploymentTarget !== void 0 && !DEPLOYMENT_TARGET.test(manifest.ios.deploymentTarget)) {
|
|
93
326
|
fail(`ios.deploymentTarget "${manifest.ios.deploymentTarget}" must look like "17.0"`);
|
|
@@ -116,6 +349,7 @@ function validateNativeApp(manifest, platform) {
|
|
|
116
349
|
}
|
|
117
350
|
}
|
|
118
351
|
if (!platform || platform === "android") {
|
|
352
|
+
var _manifest_android_appLinks;
|
|
119
353
|
var _manifest_android;
|
|
120
354
|
if (!((_manifest_android = manifest.android) === null || _manifest_android === void 0 ? void 0 : _manifest_android.applicationId) || !REVERSE_DNS.test(manifest.android.applicationId)) {
|
|
121
355
|
var _manifest_android1;
|
|
@@ -127,9 +361,97 @@ function validateNativeApp(manifest, platform) {
|
|
|
127
361
|
if (manifest.android.versionCode !== void 0 && (!Number.isInteger(manifest.android.versionCode) || manifest.android.versionCode < 1)) {
|
|
128
362
|
fail(`android.versionCode "${manifest.android.versionCode}" must be a positive integer`);
|
|
129
363
|
}
|
|
364
|
+
for (var _i = 0, _iter = ["targetSdk", "compileSdk"]; _i < _iter.length; _i++) {
|
|
365
|
+
var key = _iter[_i];
|
|
366
|
+
var value = manifest.android[key];
|
|
367
|
+
if (value !== void 0 && (!Number.isInteger(value) || value < 21)) {
|
|
368
|
+
fail(`android.${key} "${value}" must be an api level integer`);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if (manifest.android.shrinkResources && !manifest.android.minify) {
|
|
372
|
+
fail("android.shrinkResources needs android.minify");
|
|
373
|
+
}
|
|
374
|
+
var _iteratorNormalCompletion5 = true, _didIteratorError5 = false, _iteratorError5 = void 0;
|
|
375
|
+
try {
|
|
376
|
+
for (var _iterator5 = ((_manifest_android_appLinks = manifest.android.appLinks) !== null && _manifest_android_appLinks !== void 0 ? _manifest_android_appLinks : [])[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
|
377
|
+
var link = _step5.value;
|
|
378
|
+
if (!link.host || !REVERSE_DNS.test(link.host)) {
|
|
379
|
+
fail(`android.appLinks host "${link.host}" must be a domain`);
|
|
380
|
+
}
|
|
381
|
+
if (link.pathPrefix !== void 0 && !link.pathPrefix.startsWith("/")) {
|
|
382
|
+
fail(`android.appLinks pathPrefix "${link.pathPrefix}" must start with /`);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
} catch (err) {
|
|
386
|
+
_didIteratorError5 = true;
|
|
387
|
+
_iteratorError5 = err;
|
|
388
|
+
} finally {
|
|
389
|
+
try {
|
|
390
|
+
if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
|
|
391
|
+
_iterator5.return();
|
|
392
|
+
}
|
|
393
|
+
} finally {
|
|
394
|
+
if (_didIteratorError5) {
|
|
395
|
+
throw _iteratorError5;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
var adaptiveIcon = manifest.android.adaptiveIcon;
|
|
400
|
+
if (adaptiveIcon !== void 0 && (!adaptiveIcon.foreground || adaptiveIcon.backgroundColor !== void 0 && !HEX_COLOR.test(adaptiveIcon.backgroundColor))) {
|
|
401
|
+
fail("android.adaptiveIcon requires foreground, and backgroundColor must be six-digit hex");
|
|
402
|
+
}
|
|
130
403
|
if (manifest.android.googleMapsApiKey !== void 0 && (typeof manifest.android.googleMapsApiKey !== "string" || manifest.android.googleMapsApiKey.trim() === "")) {
|
|
131
404
|
fail("android.googleMapsApiKey must be a non-empty string");
|
|
132
405
|
}
|
|
133
406
|
}
|
|
134
407
|
return manifest;
|
|
135
408
|
}
|
|
409
|
+
function expoClientFromNativeApp(app) {
|
|
410
|
+
var _app_displayName, _app_userInterfaceStyle;
|
|
411
|
+
var _app_icon, _app_fonts;
|
|
412
|
+
return {
|
|
413
|
+
name: (_app_displayName = app.displayName) !== null && _app_displayName !== void 0 ? _app_displayName : app.name,
|
|
414
|
+
slug: app.name,
|
|
415
|
+
scheme: app.scheme,
|
|
416
|
+
version: app.version,
|
|
417
|
+
orientation: app.orientation,
|
|
418
|
+
userInterfaceStyle: (_app_userInterfaceStyle = app.userInterfaceStyle) !== null && _app_userInterfaceStyle !== void 0 ? _app_userInterfaceStyle : "automatic",
|
|
419
|
+
icon: (_app_icon = app.icon) === null || _app_icon === void 0 ? void 0 : _app_icon.source,
|
|
420
|
+
splash: app.splash && {
|
|
421
|
+
image: app.splash.source,
|
|
422
|
+
backgroundImage: app.splash.backgroundImage,
|
|
423
|
+
backgroundColor: app.splash.backgroundColor,
|
|
424
|
+
imageWidth: app.splash.width,
|
|
425
|
+
resizeMode: app.splash.resizeMode,
|
|
426
|
+
dark: app.splash.dark && {
|
|
427
|
+
image: app.splash.dark.source,
|
|
428
|
+
backgroundImage: app.splash.dark.backgroundImage,
|
|
429
|
+
backgroundColor: app.splash.dark.backgroundColor
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
plugins: ((_app_fonts = app.fonts) === null || _app_fonts === void 0 ? void 0 : _app_fonts.length) ? [["expo-font", { fonts: app.fonts }]] : void 0,
|
|
433
|
+
ios: app.ios && {
|
|
434
|
+
bundleIdentifier: app.ios.bundleId,
|
|
435
|
+
buildNumber: app.ios.buildNumber,
|
|
436
|
+
supportsTablet: app.ios.tablet,
|
|
437
|
+
associatedDomains: app.ios.associatedDomains,
|
|
438
|
+
usesAppleSignIn: app.ios.usesAppleSignIn,
|
|
439
|
+
googleServicesFile: app.ios.googleServicesFile,
|
|
440
|
+
infoPlist: app.ios.infoPlist,
|
|
441
|
+
entitlements: app.ios.entitlements
|
|
442
|
+
},
|
|
443
|
+
android: app.android && {
|
|
444
|
+
package: app.android.applicationId,
|
|
445
|
+
versionCode: app.android.versionCode,
|
|
446
|
+
permissions: app.android.permissions,
|
|
447
|
+
blockedPermissions: app.android.blockedPermissions,
|
|
448
|
+
googleServicesFile: app.android.googleServicesFile,
|
|
449
|
+
adaptiveIcon: app.android.adaptiveIcon && {
|
|
450
|
+
foregroundImage: app.android.adaptiveIcon.foreground,
|
|
451
|
+
backgroundImage: app.android.adaptiveIcon.background,
|
|
452
|
+
backgroundColor: app.android.adaptiveIcon.backgroundColor,
|
|
453
|
+
monochromeImage: app.android.adaptiveIcon.monochrome
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
}
|