@vxrn/utils 2.0.0-beta.33.1 → 2.0.0-beta.362.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.
Files changed (73) hide show
  1. package/dist/cjs/createMessageSocket.cjs +115 -121
  2. package/dist/cjs/createMessageSocket.native.cjs +166 -0
  3. package/dist/cjs/createMessageSocket.native.js +152 -166
  4. package/dist/cjs/createMessageSocket.native.js.map +1 -1
  5. package/dist/cjs/detectPackageManager.cjs +76 -72
  6. package/dist/cjs/detectPackageManager.native.cjs +106 -0
  7. package/dist/cjs/detectPackageManager.native.js +82 -77
  8. package/dist/cjs/detectPackageManager.native.js.map +1 -1
  9. package/dist/cjs/exec.cjs +43 -45
  10. package/dist/cjs/exec.native.cjs +65 -0
  11. package/dist/cjs/exec.native.js +48 -49
  12. package/dist/cjs/exec.native.js.map +1 -1
  13. package/dist/cjs/index.cjs +10 -11
  14. package/dist/cjs/index.native.cjs +26 -0
  15. package/dist/cjs/index.native.js +10 -10
  16. package/dist/cjs/index.native.js.map +1 -1
  17. package/dist/cjs/mustReplace.cjs +27 -35
  18. package/dist/cjs/mustReplace.native.cjs +60 -0
  19. package/dist/cjs/mustReplace.native.js +44 -60
  20. package/dist/cjs/mustReplace.native.js.map +1 -1
  21. package/dist/cjs/nativeAppManifest.cjs +328 -0
  22. package/dist/cjs/nativeAppManifest.native.cjs +445 -0
  23. package/dist/cjs/nativeAppManifest.native.js +447 -0
  24. package/dist/cjs/nativeAppManifest.native.js.map +1 -0
  25. package/dist/cjs/publicEnv.cjs +38 -0
  26. package/dist/cjs/publicEnv.native.cjs +57 -0
  27. package/dist/cjs/publicEnv.native.js +59 -0
  28. package/dist/cjs/publicEnv.native.js.map +1 -0
  29. package/dist/esm/createMessageSocket.mjs +103 -103
  30. package/dist/esm/createMessageSocket.mjs.map +1 -1
  31. package/dist/esm/createMessageSocket.native.js +139 -148
  32. package/dist/esm/createMessageSocket.native.js.map +1 -1
  33. package/dist/esm/detectPackageManager.mjs +65 -55
  34. package/dist/esm/detectPackageManager.mjs.map +1 -1
  35. package/dist/esm/detectPackageManager.native.js +71 -61
  36. package/dist/esm/detectPackageManager.native.js.map +1 -1
  37. package/dist/esm/exec.mjs +29 -27
  38. package/dist/esm/exec.mjs.map +1 -1
  39. package/dist/esm/exec.native.js +34 -32
  40. package/dist/esm/exec.native.js.map +1 -1
  41. package/dist/esm/index.js +13 -7
  42. package/dist/esm/index.mjs +13 -7
  43. package/dist/esm/index.native.js +13 -7
  44. package/dist/esm/mustReplace.mjs +15 -17
  45. package/dist/esm/mustReplace.mjs.map +1 -1
  46. package/dist/esm/mustReplace.native.js +32 -43
  47. package/dist/esm/mustReplace.native.js.map +1 -1
  48. package/dist/esm/nativeAppManifest.mjs +305 -0
  49. package/dist/esm/nativeAppManifest.mjs.map +1 -0
  50. package/dist/esm/nativeAppManifest.native.js +420 -0
  51. package/dist/esm/nativeAppManifest.native.js.map +1 -0
  52. package/dist/esm/publicEnv.mjs +14 -0
  53. package/dist/esm/publicEnv.mjs.map +1 -0
  54. package/dist/esm/publicEnv.native.js +31 -0
  55. package/dist/esm/publicEnv.native.js.map +1 -0
  56. package/package.json +18 -5
  57. package/src/index.ts +1 -0
  58. package/src/nativeAppManifest.test.ts +360 -0
  59. package/src/nativeAppManifest.ts +702 -0
  60. package/src/publicEnv.ts +19 -0
  61. package/types/createMessageSocket.d.ts +1 -1
  62. package/types/createMessageSocket.d.ts.map +1 -1
  63. package/types/detectPackageManager.d.ts.map +1 -1
  64. package/types/exec.d.ts.map +1 -1
  65. package/types/index.d.ts +1 -0
  66. package/types/index.d.ts.map +1 -1
  67. package/types/nativeAppManifest.d.ts +180 -0
  68. package/types/nativeAppManifest.d.ts.map +1 -0
  69. package/types/publicEnv.d.ts +9 -0
  70. package/types/publicEnv.d.ts.map +1 -0
  71. package/dist/esm/index.js.map +0 -1
  72. package/dist/esm/index.mjs.map +0 -1
  73. package/dist/esm/index.native.js.map +0 -1
@@ -0,0 +1,445 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var nativeAppManifest_exports = {};
24
+ __export(nativeAppManifest_exports, {
25
+ expoClientFromNativeApp: () => expoClientFromNativeApp,
26
+ validateNativeApp: () => validateNativeApp
27
+ });
28
+ module.exports = __toCommonJS(nativeAppManifest_exports);
29
+ var TARGET_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;
30
+ var SCHEME = /^[a-z][a-z0-9+.-]*$/i;
31
+ var VERSION = /^\d+\.\d+\.\d+/;
32
+ var BUILD_NUMBER = /^[A-Za-z0-9.]+$/;
33
+ var REVERSE_DNS = /^[A-Za-z][A-Za-z0-9-]*(\.[A-Za-z][A-Za-z0-9-]*)+$/;
34
+ var DEPLOYMENT_TARGET = /^\d+\.\d+$/;
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
+ ];
47
+ function fail(message) {
48
+ throw new Error(`[one] invalid native.app: ${message}`);
49
+ }
50
+ function validateNativeApp(manifest, platform) {
51
+ var _manifest_ios, _manifest_ios1, _manifest_ios2, _manifest_splash, _manifest_splash_dark, _manifest_splash1, _manifest_splash2, _manifest_imagePicker, _manifest_photoLibrary, _manifest_photoLibrary1, _manifest_location, _manifest_ios3, _manifest_speech, _manifest_ios4;
52
+ if (!manifest || typeof manifest !== "object") fail("manifest must be an object");
53
+ if (!manifest.name || typeof manifest.name !== "string") fail("name is required");
54
+ if (!TARGET_NAME.test(manifest.name)) {
55
+ fail(`name "${manifest.name}" must start with a letter and contain only letters, digits, and underscore`);
56
+ }
57
+ var schemes = manifest.scheme === void 0 ? [] : Array.isArray(manifest.scheme) ? manifest.scheme : [manifest.scheme];
58
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
59
+ try {
60
+ for (var _iterator = schemes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
61
+ var scheme = _step.value;
62
+ if (typeof scheme !== "string" || !SCHEME.test(scheme)) {
63
+ fail(`scheme "${scheme}" must be a valid uri scheme`);
64
+ }
65
+ }
66
+ } catch (err) {
67
+ _didIteratorError = true;
68
+ _iteratorError = err;
69
+ } finally {
70
+ try {
71
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
72
+ _iterator.return();
73
+ }
74
+ } finally {
75
+ if (_didIteratorError) {
76
+ throw _iteratorError;
77
+ }
78
+ }
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
+ }
115
+ if (manifest.version !== void 0 && !VERSION.test(manifest.version)) {
116
+ fail(`version "${manifest.version}" must start with major.minor.patch`);
117
+ }
118
+ if (manifest.icon !== void 0 && (!manifest.icon.source || !HEX_COLOR.test(manifest.icon.backgroundColor))) {
119
+ fail("icon requires source and a six-digit hex backgroundColor");
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
+ }
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))) {
217
+ fail("splash requires source, a six-digit hex backgroundColor, and width from 1 to 288");
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
+ }
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() === "")) {
229
+ fail("imagePicker.camera must be a non-empty string");
230
+ }
231
+ if (manifest.photoLibrary !== void 0 && (!manifest.photoLibrary || manifest.photoLibrary.addOnly === void 0 && manifest.photoLibrary.readWrite === void 0)) {
232
+ fail("photoLibrary must configure addOnly or readWrite");
233
+ }
234
+ 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() === "")) {
235
+ fail("photoLibrary.addOnly must be a non-empty string");
236
+ }
237
+ 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() === "")) {
238
+ fail("photoLibrary.readWrite must be a non-empty string");
239
+ }
240
+ if (manifest.contacts !== void 0 && (!manifest.contacts || typeof manifest.contacts.usage !== "string" || manifest.contacts.usage.trim() === "")) {
241
+ fail("contacts.usage must be a non-empty string");
242
+ }
243
+ if (manifest.calendar !== void 0) {
244
+ if (!manifest.calendar || manifest.calendar.usage === void 0 && manifest.calendar.remindersUsage === void 0) {
245
+ fail("calendar.usage or calendar.remindersUsage must be a non-empty string");
246
+ }
247
+ if (manifest.calendar.usage !== void 0 && (typeof manifest.calendar.usage !== "string" || manifest.calendar.usage.trim() === "")) {
248
+ fail("calendar.usage must be a non-empty string");
249
+ }
250
+ if (manifest.calendar.remindersUsage !== void 0 && (typeof manifest.calendar.remindersUsage !== "string" || manifest.calendar.remindersUsage.trim() === "")) {
251
+ fail("calendar.remindersUsage must be a non-empty string");
252
+ }
253
+ }
254
+ if (manifest.location !== void 0 && (!manifest.location || typeof manifest.location.whenInUse !== "string" || manifest.location.whenInUse.trim() === "")) {
255
+ fail("location.whenInUse must be a non-empty string");
256
+ }
257
+ if (((_manifest_location = manifest.location) === null || _manifest_location === void 0 ? void 0 : _manifest_location.background) !== void 0 && typeof manifest.location.background !== "boolean") {
258
+ fail("location.background must be a boolean");
259
+ }
260
+ if (manifest.audio !== void 0) {
261
+ if (!manifest.audio || typeof manifest.audio !== "object") {
262
+ fail("audio must configure microphone or background playback");
263
+ }
264
+ if (manifest.audio.microphone !== void 0 && (typeof manifest.audio.microphone !== "string" || manifest.audio.microphone.trim() === "")) {
265
+ fail("audio.microphone must be a non-empty string");
266
+ }
267
+ if (manifest.audio.background !== void 0 && typeof manifest.audio.background !== "boolean") {
268
+ fail("audio.background must be a boolean");
269
+ }
270
+ if (manifest.audio.microphone === void 0 && manifest.audio.background !== true) {
271
+ fail("audio must configure microphone or background playback");
272
+ }
273
+ }
274
+ 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() === "")) {
275
+ fail("ios.faceIdUsageDescription must be a non-empty string");
276
+ }
277
+ 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() === "")) {
278
+ fail("speech.recognition and speech.microphone must be non-empty strings");
279
+ }
280
+ if (manifest.notifications !== void 0) {
281
+ if (typeof manifest.notifications !== "object" || manifest.notifications.push !== void 0 && typeof manifest.notifications.push !== "boolean") {
282
+ fail("notifications.push must be a boolean");
283
+ }
284
+ var aps = manifest.notifications.apsEnvironment;
285
+ if (aps !== void 0 && aps !== "development" && aps !== "production") {
286
+ fail(`notifications.apsEnvironment "${aps}" must be development or production`);
287
+ }
288
+ if (aps !== void 0 && !manifest.notifications.push) {
289
+ fail("notifications.apsEnvironment needs notifications.push");
290
+ }
291
+ }
292
+ var accent = (_manifest_ios4 = manifest.ios) === null || _manifest_ios4 === void 0 ? void 0 : _manifest_ios4.accentColor;
293
+ if (accent !== void 0 && (!HEX_COLOR.test(accent.light) || accent.dark !== void 0 && !HEX_COLOR.test(accent.dark))) {
294
+ fail("ios.accentColor light and dark must be six-digit hex colors");
295
+ }
296
+ if (manifest.pictureInPicture !== void 0 && typeof manifest.pictureInPicture !== "boolean") {
297
+ fail("pictureInPicture must be a boolean");
298
+ }
299
+ if (manifest.updates !== void 0) {
300
+ if (typeof manifest.updates.runtimeVersion !== "string" || manifest.updates.runtimeVersion.trim() === "") {
301
+ fail("updates.runtimeVersion must be a non-empty string");
302
+ }
303
+ if (manifest.updates.url !== void 0 && (typeof manifest.updates.url !== "string" || manifest.updates.url.trim() === "")) {
304
+ fail("updates.url must be a non-empty string");
305
+ }
306
+ }
307
+ if (!platform || platform === "ios") {
308
+ var _manifest_ios5;
309
+ if (!((_manifest_ios5 = manifest.ios) === null || _manifest_ios5 === void 0 ? void 0 : _manifest_ios5.bundleId) || !REVERSE_DNS.test(manifest.ios.bundleId)) {
310
+ var _manifest_ios6;
311
+ fail(`ios.bundleId "${(_manifest_ios6 = manifest.ios) === null || _manifest_ios6 === void 0 ? void 0 : _manifest_ios6.bundleId}" must be reverse-dns`);
312
+ }
313
+ if (manifest.ios.deploymentTarget !== void 0 && !DEPLOYMENT_TARGET.test(manifest.ios.deploymentTarget)) {
314
+ fail(`ios.deploymentTarget "${manifest.ios.deploymentTarget}" must look like "17.0"`);
315
+ }
316
+ if (manifest.ios.buildNumber !== void 0 && !BUILD_NUMBER.test(manifest.ios.buildNumber)) {
317
+ fail(`ios.buildNumber "${manifest.ios.buildNumber}" must contain only letters, digits, and dots`);
318
+ }
319
+ var widgets = manifest.ios.widgets;
320
+ if (widgets) {
321
+ var _widgets_displayName, _widgets_description;
322
+ if (!manifest.ios.deploymentTarget || Number(manifest.ios.deploymentTarget) < 17) {
323
+ fail("ios.widgets requires ios.deploymentTarget of 17.0 or newer");
324
+ }
325
+ if (!/^group\.[A-Za-z][A-Za-z0-9-]*(\.[A-Za-z][A-Za-z0-9-]*)+$/.test(widgets.appGroup)) {
326
+ fail("ios.widgets.appGroup must be a reverse-dns App Group beginning with group.");
327
+ }
328
+ if (!/^[A-Za-z][A-Za-z0-9._-]*$/.test(widgets.kind)) {
329
+ fail("ios.widgets.kind must be a non-empty WidgetKit kind");
330
+ }
331
+ if (!((_widgets_displayName = widgets.displayName) === null || _widgets_displayName === void 0 ? void 0 : _widgets_displayName.trim()) || !((_widgets_description = widgets.description) === null || _widgets_description === void 0 ? void 0 : _widgets_description.trim())) {
332
+ fail("ios.widgets.displayName and description must be non-empty strings");
333
+ }
334
+ if (widgets.pushNotifications !== void 0 && typeof widgets.pushNotifications !== "boolean") {
335
+ fail("ios.widgets.pushNotifications must be a boolean");
336
+ }
337
+ }
338
+ }
339
+ if (!platform || platform === "android") {
340
+ var _manifest_android_appLinks;
341
+ var _manifest_android;
342
+ if (!((_manifest_android = manifest.android) === null || _manifest_android === void 0 ? void 0 : _manifest_android.applicationId) || !REVERSE_DNS.test(manifest.android.applicationId)) {
343
+ var _manifest_android1;
344
+ fail(`android.applicationId "${(_manifest_android1 = manifest.android) === null || _manifest_android1 === void 0 ? void 0 : _manifest_android1.applicationId}" must be reverse-dns`);
345
+ }
346
+ if (manifest.android.minSdk !== void 0 && (!Number.isInteger(manifest.android.minSdk) || manifest.android.minSdk < 21 || manifest.android.minSdk > 36)) {
347
+ fail(`android.minSdk "${manifest.android.minSdk}" must be an integer from 21 to 36`);
348
+ }
349
+ if (manifest.android.versionCode !== void 0 && (!Number.isInteger(manifest.android.versionCode) || manifest.android.versionCode < 1)) {
350
+ fail(`android.versionCode "${manifest.android.versionCode}" must be a positive integer`);
351
+ }
352
+ for (var _i = 0, _iter = ["targetSdk", "compileSdk"]; _i < _iter.length; _i++) {
353
+ var key = _iter[_i];
354
+ var value = manifest.android[key];
355
+ if (value !== void 0 && (!Number.isInteger(value) || value < 21)) {
356
+ fail(`android.${key} "${value}" must be an api level integer`);
357
+ }
358
+ }
359
+ if (manifest.android.shrinkResources && !manifest.android.minify) {
360
+ fail("android.shrinkResources needs android.minify");
361
+ }
362
+ var _iteratorNormalCompletion5 = true, _didIteratorError5 = false, _iteratorError5 = void 0;
363
+ try {
364
+ 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) {
365
+ var link = _step5.value;
366
+ if (!link.host || !REVERSE_DNS.test(link.host)) {
367
+ fail(`android.appLinks host "${link.host}" must be a domain`);
368
+ }
369
+ if (link.pathPrefix !== void 0 && !link.pathPrefix.startsWith("/")) {
370
+ fail(`android.appLinks pathPrefix "${link.pathPrefix}" must start with /`);
371
+ }
372
+ }
373
+ } catch (err) {
374
+ _didIteratorError5 = true;
375
+ _iteratorError5 = err;
376
+ } finally {
377
+ try {
378
+ if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
379
+ _iterator5.return();
380
+ }
381
+ } finally {
382
+ if (_didIteratorError5) {
383
+ throw _iteratorError5;
384
+ }
385
+ }
386
+ }
387
+ var adaptiveIcon = manifest.android.adaptiveIcon;
388
+ if (adaptiveIcon !== void 0 && (!adaptiveIcon.foreground || adaptiveIcon.backgroundColor !== void 0 && !HEX_COLOR.test(adaptiveIcon.backgroundColor))) {
389
+ fail("android.adaptiveIcon requires foreground, and backgroundColor must be six-digit hex");
390
+ }
391
+ if (manifest.android.googleMapsApiKey !== void 0 && (typeof manifest.android.googleMapsApiKey !== "string" || manifest.android.googleMapsApiKey.trim() === "")) {
392
+ fail("android.googleMapsApiKey must be a non-empty string");
393
+ }
394
+ }
395
+ return manifest;
396
+ }
397
+ function expoClientFromNativeApp(app) {
398
+ var _app_displayName, _app_userInterfaceStyle;
399
+ var _app_icon, _app_fonts;
400
+ return {
401
+ name: (_app_displayName = app.displayName) !== null && _app_displayName !== void 0 ? _app_displayName : app.name,
402
+ slug: app.name,
403
+ scheme: app.scheme,
404
+ version: app.version,
405
+ orientation: app.orientation,
406
+ userInterfaceStyle: (_app_userInterfaceStyle = app.userInterfaceStyle) !== null && _app_userInterfaceStyle !== void 0 ? _app_userInterfaceStyle : "automatic",
407
+ icon: (_app_icon = app.icon) === null || _app_icon === void 0 ? void 0 : _app_icon.source,
408
+ splash: app.splash && {
409
+ image: app.splash.source,
410
+ backgroundImage: app.splash.backgroundImage,
411
+ backgroundColor: app.splash.backgroundColor,
412
+ imageWidth: app.splash.width,
413
+ resizeMode: app.splash.resizeMode,
414
+ dark: app.splash.dark && {
415
+ image: app.splash.dark.source,
416
+ backgroundImage: app.splash.dark.backgroundImage,
417
+ backgroundColor: app.splash.dark.backgroundColor
418
+ }
419
+ },
420
+ plugins: ((_app_fonts = app.fonts) === null || _app_fonts === void 0 ? void 0 : _app_fonts.length) ? [["expo-font", { fonts: app.fonts }]] : void 0,
421
+ ios: app.ios && {
422
+ bundleIdentifier: app.ios.bundleId,
423
+ buildNumber: app.ios.buildNumber,
424
+ supportsTablet: app.ios.tablet,
425
+ associatedDomains: app.ios.associatedDomains,
426
+ usesAppleSignIn: app.ios.usesAppleSignIn,
427
+ googleServicesFile: app.ios.googleServicesFile,
428
+ infoPlist: app.ios.infoPlist,
429
+ entitlements: app.ios.entitlements
430
+ },
431
+ android: app.android && {
432
+ package: app.android.applicationId,
433
+ versionCode: app.android.versionCode,
434
+ permissions: app.android.permissions,
435
+ blockedPermissions: app.android.blockedPermissions,
436
+ googleServicesFile: app.android.googleServicesFile,
437
+ adaptiveIcon: app.android.adaptiveIcon && {
438
+ foregroundImage: app.android.adaptiveIcon.foreground,
439
+ backgroundImage: app.android.adaptiveIcon.background,
440
+ backgroundColor: app.android.adaptiveIcon.backgroundColor,
441
+ monochromeImage: app.android.adaptiveIcon.monochrome
442
+ }
443
+ }
444
+ };
445
+ }