@vxrn/utils 2.8.1 → 2.9.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.
@@ -20,10 +20,39 @@ var __copyProps = (to, from, except, desc) => {
20
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
21
  var nativeAppManifest_exports = {};
22
22
  __export(nativeAppManifest_exports, {
23
+ androidIconSuffix: () => androidIconSuffix,
24
+ appIconPreviewResources: () => appIconPreviewResources,
23
25
  expoClientFromNativeApp: () => expoClientFromNativeApp,
26
+ nativeAppDefines: () => nativeAppDefines,
24
27
  validateNativeApp: () => validateNativeApp
25
28
  });
26
29
  module.exports = __toCommonJS(nativeAppManifest_exports);
30
+ function androidIconSuffix(name) {
31
+ return name.replace(/([a-z\d])([A-Z])/g, "$1_$2").toLowerCase();
32
+ }
33
+ function appIconPreviewResources(name) {
34
+ return {
35
+ ios: `AppIconPreview${name ?? "Primary"}`,
36
+ android: `app_icon_preview_${name === void 0 ? "primary" : androidIconSuffix(name)}`
37
+ };
38
+ }
39
+ function nativeAppDefines(app) {
40
+ const defines = {};
41
+ if (app?.splash) {
42
+ defines["process.env.ONE_LAUNCH_SCREEN"] = JSON.stringify(JSON.stringify({
43
+ width: app.splash.width ?? 200,
44
+ cover: app.splash.resizeMode === "cover",
45
+ backgroundImage: app.splash.backgroundImage !== void 0
46
+ }));
47
+ }
48
+ if (app?.alternateIcons) {
49
+ defines["process.env.ONE_APP_ICONS"] = JSON.stringify(JSON.stringify([void 0, ...Object.keys(app.alternateIcons)].map((name) => ({
50
+ name,
51
+ ...appIconPreviewResources(name)
52
+ }))));
53
+ }
54
+ return defines;
55
+ }
27
56
  const TARGET_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;
28
57
  const SCHEME = /^[a-z][a-z0-9+.-]*$/i;
29
58
  const VERSION = /^\d+\.\d+\.\d+/;
@@ -81,15 +110,33 @@ function validateNativeApp(manifest, platform) {
81
110
  fail("icon requires source and a six-digit hex backgroundColor");
82
111
  }
83
112
  if (manifest.ios?.alternateIcons !== void 0) {
84
- if (!manifest.icon) fail("ios.alternateIcons requires a primary icon");
85
- const entries = Object.entries(manifest.ios.alternateIcons);
86
- if (entries.length === 0) fail("ios.alternateIcons requires at least one icon");
87
- for (const [name, icon] of entries) {
88
- if (name === "AppIcon" || !TARGET_NAME.test(name)) {
89
- fail(`ios.alternateIcons name "${name}" must be an identifier other than AppIcon`);
113
+ fail("ios.alternateIcons moved to alternateIcons, which android uses too");
114
+ }
115
+ const alternates = Object.entries(manifest.alternateIcons ?? {});
116
+ if (manifest.alternateIcons !== void 0) {
117
+ if (!manifest.icon) fail("alternateIcons requires a primary icon");
118
+ if (alternates.length === 0) fail("alternateIcons requires at least one icon");
119
+ const lowered = /* @__PURE__ */ new Set();
120
+ for (const [name, icon] of alternates) {
121
+ if (name === "AppIcon" || name === "Primary" || !TARGET_NAME.test(name)) {
122
+ fail(`alternateIcons name "${name}" must be an identifier other than AppIcon or Primary`);
90
123
  }
124
+ if (lowered.has(name.toLowerCase())) {
125
+ fail(`alternateIcons name "${name}" repeats another name apart from its case`);
126
+ }
127
+ lowered.add(name.toLowerCase());
91
128
  if (!icon?.source || !HEX_COLOR.test(icon.backgroundColor)) {
92
- fail(`ios.alternateIcons.${name} requires source and a six-digit hex backgroundColor`);
129
+ fail(`alternateIcons.${name} requires source and a six-digit hex backgroundColor`);
130
+ }
131
+ }
132
+ }
133
+ const icons = [["icon", manifest.icon], ...alternates.map(([name, alternate]) => [`alternateIcons.${name}`, alternate])];
134
+ for (const [label, icon] of icons) {
135
+ for (const appearance of ["dark", "tinted"]) {
136
+ const variant = icon?.[appearance];
137
+ if (variant === void 0) continue;
138
+ if (typeof variant !== "object" || variant === null || variant.source !== void 0 && !variant.source || variant.backgroundColor !== void 0 && !HEX_COLOR.test(variant.backgroundColor)) {
139
+ fail(`${label}.${appearance} takes an optional source and six-digit hex backgroundColor`);
93
140
  }
94
141
  }
95
142
  }
@@ -22,10 +22,42 @@ var __copyProps = (to, from, except, desc) => {
22
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
23
  var nativeAppManifest_exports = {};
24
24
  __export(nativeAppManifest_exports, {
25
+ androidIconSuffix: () => androidIconSuffix,
26
+ appIconPreviewResources: () => appIconPreviewResources,
25
27
  expoClientFromNativeApp: () => expoClientFromNativeApp,
28
+ nativeAppDefines: () => nativeAppDefines,
26
29
  validateNativeApp: () => validateNativeApp
27
30
  });
28
31
  module.exports = __toCommonJS(nativeAppManifest_exports);
32
+ function androidIconSuffix(name) {
33
+ return name.replace(/([a-z\d])([A-Z])/g, "$1_$2").toLowerCase();
34
+ }
35
+ function appIconPreviewResources(name) {
36
+ return {
37
+ ios: `AppIconPreview${name !== null && name !== void 0 ? name : "Primary"}`,
38
+ android: `app_icon_preview_${name === void 0 ? "primary" : androidIconSuffix(name)}`
39
+ };
40
+ }
41
+ function nativeAppDefines(app) {
42
+ var defines = {};
43
+ if (app === null || app === void 0 ? void 0 : app.splash) {
44
+ var _app_splash_width;
45
+ defines["process.env.ONE_LAUNCH_SCREEN"] = JSON.stringify(JSON.stringify({
46
+ width: (_app_splash_width = app.splash.width) !== null && _app_splash_width !== void 0 ? _app_splash_width : 200,
47
+ cover: app.splash.resizeMode === "cover",
48
+ backgroundImage: app.splash.backgroundImage !== void 0
49
+ }));
50
+ }
51
+ if (app === null || app === void 0 ? void 0 : app.alternateIcons) {
52
+ defines["process.env.ONE_APP_ICONS"] = JSON.stringify(JSON.stringify([void 0, ...Object.keys(app.alternateIcons)].map(function(name) {
53
+ return {
54
+ name,
55
+ ...appIconPreviewResources(name)
56
+ };
57
+ })));
58
+ }
59
+ return defines;
60
+ }
29
61
  var TARGET_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;
30
62
  var SCHEME = /^[a-z][a-z0-9+.-]*$/i;
31
63
  var VERSION = /^\d+\.\d+\.\d+/;
@@ -48,6 +80,7 @@ function fail(message) {
48
80
  throw new Error(`[one] invalid native.app: ${message}`);
49
81
  }
50
82
  function validateNativeApp(manifest, platform) {
83
+ var _manifest_alternateIcons;
51
84
  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;
52
85
  if (!manifest || typeof manifest !== "object") fail("manifest must be an object");
53
86
  if (!manifest.name || typeof manifest.name !== "string") fail("name is required");
@@ -119,18 +152,26 @@ function validateNativeApp(manifest, platform) {
119
152
  fail("icon requires source and a six-digit hex backgroundColor");
120
153
  }
121
154
  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");
155
+ fail("ios.alternateIcons moved to alternateIcons, which android uses too");
156
+ }
157
+ var alternates = Object.entries((_manifest_alternateIcons = manifest.alternateIcons) !== null && _manifest_alternateIcons !== void 0 ? _manifest_alternateIcons : {});
158
+ if (manifest.alternateIcons !== void 0) {
159
+ if (!manifest.icon) fail("alternateIcons requires a primary icon");
160
+ if (alternates.length === 0) fail("alternateIcons requires at least one icon");
161
+ var lowered = /* @__PURE__ */ new Set();
125
162
  var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
126
163
  try {
127
- for (var _iterator2 = entries[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
164
+ for (var _iterator2 = alternates[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
128
165
  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`);
166
+ if (name1 === "AppIcon" || name1 === "Primary" || !TARGET_NAME.test(name1)) {
167
+ fail(`alternateIcons name "${name1}" must be an identifier other than AppIcon or Primary`);
131
168
  }
169
+ if (lowered.has(name1.toLowerCase())) {
170
+ fail(`alternateIcons name "${name1}" repeats another name apart from its case`);
171
+ }
172
+ lowered.add(name1.toLowerCase());
132
173
  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`);
174
+ fail(`alternateIcons.${name1} requires source and a six-digit hex backgroundColor`);
134
175
  }
135
176
  }
136
177
  } catch (err) {
@@ -148,6 +189,37 @@ function validateNativeApp(manifest, platform) {
148
189
  }
149
190
  }
150
191
  }
192
+ var icons = [["icon", manifest.icon], ...alternates.map(function(param) {
193
+ var [name2, alternate] = param;
194
+ return [`alternateIcons.${name2}`, alternate];
195
+ })];
196
+ var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = void 0;
197
+ try {
198
+ for (var _iterator3 = icons[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
199
+ var [label, icon1] = _step3.value;
200
+ for (var _i = 0, _iter = ["dark", "tinted"]; _i < _iter.length; _i++) {
201
+ var appearance = _iter[_i];
202
+ var variant = icon1 === null || icon1 === void 0 ? void 0 : icon1[appearance];
203
+ if (variant === void 0) continue;
204
+ if (typeof variant !== "object" || variant === null || variant.source !== void 0 && !variant.source || variant.backgroundColor !== void 0 && !HEX_COLOR.test(variant.backgroundColor)) {
205
+ fail(`${label}.${appearance} takes an optional source and six-digit hex backgroundColor`);
206
+ }
207
+ }
208
+ }
209
+ } catch (err) {
210
+ _didIteratorError3 = true;
211
+ _iteratorError3 = err;
212
+ } finally {
213
+ try {
214
+ if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
215
+ _iterator3.return();
216
+ }
217
+ } finally {
218
+ if (_didIteratorError3) {
219
+ throw _iteratorError3;
220
+ }
221
+ }
222
+ }
151
223
  if (((_manifest_ios1 = manifest.ios) === null || _manifest_ios1 === void 0 ? void 0 : _manifest_ios1.backgroundTasks) !== void 0) {
152
224
  var _tasks_refresh, _tasks_processing;
153
225
  var tasks = manifest.ios.backgroundTasks;
@@ -158,25 +230,25 @@ function validateNativeApp(manifest, platform) {
158
230
  if (!identifiers.length || new Set(identifiers).size !== identifiers.length) {
159
231
  fail("ios.backgroundTasks needs distinct refresh or processing identifiers");
160
232
  }
161
- var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = void 0;
233
+ var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = void 0;
162
234
  try {
163
- for (var _iterator3 = identifiers[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
164
- var identifier = _step3.value;
235
+ for (var _iterator4 = identifiers[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
236
+ var identifier = _step4.value;
165
237
  if (typeof identifier !== "string" || !REVERSE_DNS.test(identifier)) {
166
238
  fail(`ios.backgroundTasks identifier "${identifier}" must use reverse DNS notation`);
167
239
  }
168
240
  }
169
241
  } catch (err) {
170
- _didIteratorError3 = true;
171
- _iteratorError3 = err;
242
+ _didIteratorError4 = true;
243
+ _iteratorError4 = err;
172
244
  } finally {
173
245
  try {
174
- if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
175
- _iterator3.return();
246
+ if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
247
+ _iterator4.return();
176
248
  }
177
249
  } finally {
178
- if (_didIteratorError3) {
179
- throw _iteratorError3;
250
+ if (_didIteratorError4) {
251
+ throw _iteratorError4;
180
252
  }
181
253
  }
182
254
  }
@@ -188,10 +260,10 @@ function validateNativeApp(manifest, platform) {
188
260
  fail("ios.appIntents.actions must be a non-empty array");
189
261
  }
190
262
  var ids = /* @__PURE__ */ new Set();
191
- var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = void 0;
263
+ var _iteratorNormalCompletion5 = true, _didIteratorError5 = false, _iteratorError5 = void 0;
192
264
  try {
193
- for (var _iterator4 = actions[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
194
- var action = _step4.value;
265
+ for (var _iterator5 = actions[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
266
+ var action = _step5.value;
195
267
  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
268
  fail("ios.appIntents actions need unique non-empty id/title, optional textParameterTitle, and a shortcutPhrase with one {app}");
197
269
  }
@@ -199,16 +271,16 @@ function validateNativeApp(manifest, platform) {
199
271
  ids.add(action.id);
200
272
  }
201
273
  } catch (err) {
202
- _didIteratorError4 = true;
203
- _iteratorError4 = err;
274
+ _didIteratorError5 = true;
275
+ _iteratorError5 = err;
204
276
  } finally {
205
277
  try {
206
- if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
207
- _iterator4.return();
278
+ if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
279
+ _iterator5.return();
208
280
  }
209
281
  } finally {
210
- if (_didIteratorError4) {
211
- throw _iteratorError4;
282
+ if (_didIteratorError5) {
283
+ throw _iteratorError5;
212
284
  }
213
285
  }
214
286
  }
@@ -361,8 +433,8 @@ function validateNativeApp(manifest, platform) {
361
433
  if (manifest.android.versionCode !== void 0 && (!Number.isInteger(manifest.android.versionCode) || manifest.android.versionCode < 1)) {
362
434
  fail(`android.versionCode "${manifest.android.versionCode}" must be a positive integer`);
363
435
  }
364
- for (var _i = 0, _iter = ["targetSdk", "compileSdk"]; _i < _iter.length; _i++) {
365
- var key = _iter[_i];
436
+ for (var _i1 = 0, _iter1 = ["targetSdk", "compileSdk"]; _i1 < _iter1.length; _i1++) {
437
+ var key = _iter1[_i1];
366
438
  var value = manifest.android[key];
367
439
  if (value !== void 0 && (!Number.isInteger(value) || value < 21)) {
368
440
  fail(`android.${key} "${value}" must be an api level integer`);
@@ -371,10 +443,10 @@ function validateNativeApp(manifest, platform) {
371
443
  if (manifest.android.shrinkResources && !manifest.android.minify) {
372
444
  fail("android.shrinkResources needs android.minify");
373
445
  }
374
- var _iteratorNormalCompletion5 = true, _didIteratorError5 = false, _iteratorError5 = void 0;
446
+ var _iteratorNormalCompletion6 = true, _didIteratorError6 = false, _iteratorError6 = void 0;
375
447
  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;
448
+ for (var _iterator6 = ((_manifest_android_appLinks = manifest.android.appLinks) !== null && _manifest_android_appLinks !== void 0 ? _manifest_android_appLinks : [])[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
449
+ var link = _step6.value;
378
450
  if (!link.host || !REVERSE_DNS.test(link.host)) {
379
451
  fail(`android.appLinks host "${link.host}" must be a domain`);
380
452
  }
@@ -383,16 +455,16 @@ function validateNativeApp(manifest, platform) {
383
455
  }
384
456
  }
385
457
  } catch (err) {
386
- _didIteratorError5 = true;
387
- _iteratorError5 = err;
458
+ _didIteratorError6 = true;
459
+ _iteratorError6 = err;
388
460
  } finally {
389
461
  try {
390
- if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
391
- _iterator5.return();
462
+ if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
463
+ _iterator6.return();
392
464
  }
393
465
  } finally {
394
- if (_didIteratorError5) {
395
- throw _iteratorError5;
466
+ if (_didIteratorError6) {
467
+ throw _iteratorError6;
396
468
  }
397
469
  }
398
470
  }
@@ -22,10 +22,42 @@ var __copyProps = (to, from, except, desc) => {
22
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
23
  var nativeAppManifest_exports = {};
24
24
  __export(nativeAppManifest_exports, {
25
+ androidIconSuffix: () => androidIconSuffix,
26
+ appIconPreviewResources: () => appIconPreviewResources,
25
27
  expoClientFromNativeApp: () => expoClientFromNativeApp,
28
+ nativeAppDefines: () => nativeAppDefines,
26
29
  validateNativeApp: () => validateNativeApp
27
30
  });
28
31
  module.exports = __toCommonJS(nativeAppManifest_exports);
32
+ function androidIconSuffix(name) {
33
+ return name.replace(/([a-z\d])([A-Z])/g, "$1_$2").toLowerCase();
34
+ }
35
+ function appIconPreviewResources(name) {
36
+ return {
37
+ ios: `AppIconPreview${name !== null && name !== void 0 ? name : "Primary"}`,
38
+ android: `app_icon_preview_${name === void 0 ? "primary" : androidIconSuffix(name)}`
39
+ };
40
+ }
41
+ function nativeAppDefines(app) {
42
+ var defines = {};
43
+ if (app === null || app === void 0 ? void 0 : app.splash) {
44
+ var _app_splash_width;
45
+ defines["process.env.ONE_LAUNCH_SCREEN"] = JSON.stringify(JSON.stringify({
46
+ width: (_app_splash_width = app.splash.width) !== null && _app_splash_width !== void 0 ? _app_splash_width : 200,
47
+ cover: app.splash.resizeMode === "cover",
48
+ backgroundImage: app.splash.backgroundImage !== void 0
49
+ }));
50
+ }
51
+ if (app === null || app === void 0 ? void 0 : app.alternateIcons) {
52
+ defines["process.env.ONE_APP_ICONS"] = JSON.stringify(JSON.stringify([void 0, ...Object.keys(app.alternateIcons)].map(function(name) {
53
+ return {
54
+ name,
55
+ ...appIconPreviewResources(name)
56
+ };
57
+ })));
58
+ }
59
+ return defines;
60
+ }
29
61
  var TARGET_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;
30
62
  var SCHEME = /^[a-z][a-z0-9+.-]*$/i;
31
63
  var VERSION = /^\d+\.\d+\.\d+/;
@@ -48,6 +80,7 @@ function fail(message) {
48
80
  throw new Error(`[one] invalid native.app: ${message}`);
49
81
  }
50
82
  function validateNativeApp(manifest, platform) {
83
+ var _manifest_alternateIcons;
51
84
  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;
52
85
  if (!manifest || typeof manifest !== "object") fail("manifest must be an object");
53
86
  if (!manifest.name || typeof manifest.name !== "string") fail("name is required");
@@ -119,18 +152,26 @@ function validateNativeApp(manifest, platform) {
119
152
  fail("icon requires source and a six-digit hex backgroundColor");
120
153
  }
121
154
  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");
155
+ fail("ios.alternateIcons moved to alternateIcons, which android uses too");
156
+ }
157
+ var alternates = Object.entries((_manifest_alternateIcons = manifest.alternateIcons) !== null && _manifest_alternateIcons !== void 0 ? _manifest_alternateIcons : {});
158
+ if (manifest.alternateIcons !== void 0) {
159
+ if (!manifest.icon) fail("alternateIcons requires a primary icon");
160
+ if (alternates.length === 0) fail("alternateIcons requires at least one icon");
161
+ var lowered = /* @__PURE__ */ new Set();
125
162
  var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
126
163
  try {
127
- for (var _iterator2 = entries[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
164
+ for (var _iterator2 = alternates[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
128
165
  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`);
166
+ if (name1 === "AppIcon" || name1 === "Primary" || !TARGET_NAME.test(name1)) {
167
+ fail(`alternateIcons name "${name1}" must be an identifier other than AppIcon or Primary`);
131
168
  }
169
+ if (lowered.has(name1.toLowerCase())) {
170
+ fail(`alternateIcons name "${name1}" repeats another name apart from its case`);
171
+ }
172
+ lowered.add(name1.toLowerCase());
132
173
  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`);
174
+ fail(`alternateIcons.${name1} requires source and a six-digit hex backgroundColor`);
134
175
  }
135
176
  }
136
177
  } catch (err) {
@@ -148,6 +189,37 @@ function validateNativeApp(manifest, platform) {
148
189
  }
149
190
  }
150
191
  }
192
+ var icons = [["icon", manifest.icon], ...alternates.map(function(param) {
193
+ var [name2, alternate] = param;
194
+ return [`alternateIcons.${name2}`, alternate];
195
+ })];
196
+ var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = void 0;
197
+ try {
198
+ for (var _iterator3 = icons[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
199
+ var [label, icon1] = _step3.value;
200
+ for (var _i = 0, _iter = ["dark", "tinted"]; _i < _iter.length; _i++) {
201
+ var appearance = _iter[_i];
202
+ var variant = icon1 === null || icon1 === void 0 ? void 0 : icon1[appearance];
203
+ if (variant === void 0) continue;
204
+ if (typeof variant !== "object" || variant === null || variant.source !== void 0 && !variant.source || variant.backgroundColor !== void 0 && !HEX_COLOR.test(variant.backgroundColor)) {
205
+ fail(`${label}.${appearance} takes an optional source and six-digit hex backgroundColor`);
206
+ }
207
+ }
208
+ }
209
+ } catch (err) {
210
+ _didIteratorError3 = true;
211
+ _iteratorError3 = err;
212
+ } finally {
213
+ try {
214
+ if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
215
+ _iterator3.return();
216
+ }
217
+ } finally {
218
+ if (_didIteratorError3) {
219
+ throw _iteratorError3;
220
+ }
221
+ }
222
+ }
151
223
  if (((_manifest_ios1 = manifest.ios) === null || _manifest_ios1 === void 0 ? void 0 : _manifest_ios1.backgroundTasks) !== void 0) {
152
224
  var _tasks_refresh, _tasks_processing;
153
225
  var tasks = manifest.ios.backgroundTasks;
@@ -158,25 +230,25 @@ function validateNativeApp(manifest, platform) {
158
230
  if (!identifiers.length || new Set(identifiers).size !== identifiers.length) {
159
231
  fail("ios.backgroundTasks needs distinct refresh or processing identifiers");
160
232
  }
161
- var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = void 0;
233
+ var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = void 0;
162
234
  try {
163
- for (var _iterator3 = identifiers[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
164
- var identifier = _step3.value;
235
+ for (var _iterator4 = identifiers[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
236
+ var identifier = _step4.value;
165
237
  if (typeof identifier !== "string" || !REVERSE_DNS.test(identifier)) {
166
238
  fail(`ios.backgroundTasks identifier "${identifier}" must use reverse DNS notation`);
167
239
  }
168
240
  }
169
241
  } catch (err) {
170
- _didIteratorError3 = true;
171
- _iteratorError3 = err;
242
+ _didIteratorError4 = true;
243
+ _iteratorError4 = err;
172
244
  } finally {
173
245
  try {
174
- if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
175
- _iterator3.return();
246
+ if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
247
+ _iterator4.return();
176
248
  }
177
249
  } finally {
178
- if (_didIteratorError3) {
179
- throw _iteratorError3;
250
+ if (_didIteratorError4) {
251
+ throw _iteratorError4;
180
252
  }
181
253
  }
182
254
  }
@@ -188,10 +260,10 @@ function validateNativeApp(manifest, platform) {
188
260
  fail("ios.appIntents.actions must be a non-empty array");
189
261
  }
190
262
  var ids = /* @__PURE__ */ new Set();
191
- var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = void 0;
263
+ var _iteratorNormalCompletion5 = true, _didIteratorError5 = false, _iteratorError5 = void 0;
192
264
  try {
193
- for (var _iterator4 = actions[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
194
- var action = _step4.value;
265
+ for (var _iterator5 = actions[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
266
+ var action = _step5.value;
195
267
  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
268
  fail("ios.appIntents actions need unique non-empty id/title, optional textParameterTitle, and a shortcutPhrase with one {app}");
197
269
  }
@@ -199,16 +271,16 @@ function validateNativeApp(manifest, platform) {
199
271
  ids.add(action.id);
200
272
  }
201
273
  } catch (err) {
202
- _didIteratorError4 = true;
203
- _iteratorError4 = err;
274
+ _didIteratorError5 = true;
275
+ _iteratorError5 = err;
204
276
  } finally {
205
277
  try {
206
- if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
207
- _iterator4.return();
278
+ if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
279
+ _iterator5.return();
208
280
  }
209
281
  } finally {
210
- if (_didIteratorError4) {
211
- throw _iteratorError4;
282
+ if (_didIteratorError5) {
283
+ throw _iteratorError5;
212
284
  }
213
285
  }
214
286
  }
@@ -361,8 +433,8 @@ function validateNativeApp(manifest, platform) {
361
433
  if (manifest.android.versionCode !== void 0 && (!Number.isInteger(manifest.android.versionCode) || manifest.android.versionCode < 1)) {
362
434
  fail(`android.versionCode "${manifest.android.versionCode}" must be a positive integer`);
363
435
  }
364
- for (var _i = 0, _iter = ["targetSdk", "compileSdk"]; _i < _iter.length; _i++) {
365
- var key = _iter[_i];
436
+ for (var _i1 = 0, _iter1 = ["targetSdk", "compileSdk"]; _i1 < _iter1.length; _i1++) {
437
+ var key = _iter1[_i1];
366
438
  var value = manifest.android[key];
367
439
  if (value !== void 0 && (!Number.isInteger(value) || value < 21)) {
368
440
  fail(`android.${key} "${value}" must be an api level integer`);
@@ -371,10 +443,10 @@ function validateNativeApp(manifest, platform) {
371
443
  if (manifest.android.shrinkResources && !manifest.android.minify) {
372
444
  fail("android.shrinkResources needs android.minify");
373
445
  }
374
- var _iteratorNormalCompletion5 = true, _didIteratorError5 = false, _iteratorError5 = void 0;
446
+ var _iteratorNormalCompletion6 = true, _didIteratorError6 = false, _iteratorError6 = void 0;
375
447
  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;
448
+ for (var _iterator6 = ((_manifest_android_appLinks = manifest.android.appLinks) !== null && _manifest_android_appLinks !== void 0 ? _manifest_android_appLinks : [])[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
449
+ var link = _step6.value;
378
450
  if (!link.host || !REVERSE_DNS.test(link.host)) {
379
451
  fail(`android.appLinks host "${link.host}" must be a domain`);
380
452
  }
@@ -383,16 +455,16 @@ function validateNativeApp(manifest, platform) {
383
455
  }
384
456
  }
385
457
  } catch (err) {
386
- _didIteratorError5 = true;
387
- _iteratorError5 = err;
458
+ _didIteratorError6 = true;
459
+ _iteratorError6 = err;
388
460
  } finally {
389
461
  try {
390
- if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
391
- _iterator5.return();
462
+ if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
463
+ _iterator6.return();
392
464
  }
393
465
  } finally {
394
- if (_didIteratorError5) {
395
- throw _iteratorError5;
466
+ if (_didIteratorError6) {
467
+ throw _iteratorError6;
396
468
  }
397
469
  }
398
470
  }