runcloud 0.2.238 → 0.2.239

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.
@@ -1,4 +1,4 @@
1
- import { existsSync, lstatSync, readFileSync, readdirSync, realpathSync, statSync, } from 'node:fs';
1
+ import { existsSync, readFileSync, readdirSync, statSync, } from 'node:fs';
2
2
  import { createHash } from 'node:crypto';
3
3
  import path from 'node:path';
4
4
  const PREVIEW_APP_ID = 'app.newly.preview';
@@ -28,7 +28,7 @@ const CONFIG_RULES = {
28
28
  orientation: { path: ['expo', 'orientation'], absent: 'info' },
29
29
  ios_supports_tablet: { path: ['expo', 'ios', 'supportsTablet'], absent: 'info' },
30
30
  };
31
- const READS_APP_CONFIG = new Set([...Object.keys(CONFIG_RULES), 'ios_encryption', 'plugin_permission_missing', 'permission_descriptions', 'privacy_manifest', 'app_icon', 'app_icon_alpha', 'splash_screen', 'splash_bg_color']);
31
+ const READS_APP_CONFIG = new Set([...Object.keys(CONFIG_RULES), 'ios_encryption', 'plugin_permission_missing', 'permission_descriptions', 'privacy_manifest']);
32
32
  const DYNAMIC_CONFIGS = ['ts', 'mts', 'cts', 'mjs', 'cjs', 'js'].map((ext) => `app.config.${ext}`);
33
33
  export function dynamicExpoConfig(root) {
34
34
  return DYNAMIC_CONFIGS.find((name) => existsSync(path.join(root, name)));
@@ -162,7 +162,7 @@ export function evaluateCompliance(manifest, projectDir, options = {}) {
162
162
  items.push(makeItem(item, 'info', `Not targeting ${platformNames(item.platform)}.`, 'app.json target platform detection'));
163
163
  continue;
164
164
  }
165
- const evaluated = evaluateLocalItem(root, appJson, item);
165
+ const evaluated = evaluateLocalItem(root, appJson, item, dynamicConfig);
166
166
  if (evaluated && dynamicConfig && READS_APP_CONFIG.has(item.id) && (evaluated.status === 'fail' || evaluated.status === 'warning')) {
167
167
  items.push(makeItem(item, 'info', uncheckedUnder(dynamicConfig, evaluated.message ?? `${item.label} is not set.`), evaluated.evidence));
168
168
  continue;
@@ -211,7 +211,7 @@ export function renderEvaluation(result) {
211
211
  function activeItems(manifest, rollouts = []) {
212
212
  return manifest.items.filter((item) => !item.deferred && item.resolvedBy !== 'card' && (!item.rollout || rollouts.includes(item.rollout)));
213
213
  }
214
- function evaluateLocalItem(root, appJson, item) {
214
+ function evaluateLocalItem(root, appJson, item, dynamicConfig) {
215
215
  if (item.id === 'scheme')
216
216
  return evaluateScheme(root, appJson, item);
217
217
  const rule = CONFIG_RULES[item.id];
@@ -223,11 +223,7 @@ function evaluateLocalItem(root, appJson, item) {
223
223
  case 'http_endpoints':
224
224
  return evaluateHttpEndpoints(root, appJson, item);
225
225
  case 'app_icon':
226
- case 'app_icon_alpha':
227
- return evaluateIcon(root, appJson, item);
228
- case 'splash_screen':
229
- case 'splash_bg_color':
230
- return evaluateSplash(root, appJson, item);
226
+ return evaluateIosIconFiles(root, appJson, item, dynamicConfig);
231
227
  case 'placeholder_content':
232
228
  return patternItem(root, item, PLACEHOLDER_COPY, 'warning', 'Placeholder text found.', 'No placeholder text found.', {
233
229
  filter: (match) => PLACEHOLDER_COPY.test(withoutInputPlaceholders(match.text)),
@@ -359,138 +355,52 @@ function evaluateHttpEndpoints(root, appJson, item) {
359
355
  : 'Non-local HTTP endpoint found without a matching App Transport Security exception. Use HTTPS.';
360
356
  return makeItem(item, 'warning', message, hits.slice(0, 5).map(({ file, line }) => `${file}:${line}`).join('\n'));
361
357
  }
362
- const MAX_INSPECT_BYTES = 32 * 1024 * 1024;
363
- function inspectProjectAsset(root, value) {
364
- if (/^[a-z][a-z\d+.-]*:/i.test(value) || path.isAbsolute(value))
365
- return { kind: 'unchecked' };
366
- const file = path.resolve(root, value);
367
- if (!file.startsWith(root + path.sep))
368
- return { kind: 'unchecked' };
369
- try {
370
- const realRoot = realpathSync(root);
371
- const realFile = realpathSync(file);
372
- if (!realFile.startsWith(realRoot + path.sep))
373
- return { kind: 'unchecked' };
374
- const info = lstatSync(realFile);
375
- if (info.isDirectory() && value.endsWith('.icon')) {
376
- const descriptor = lstatSync(path.join(realFile, 'icon.json'));
377
- return { kind: descriptor.isFile() ? 'composer' : 'missing' };
378
- }
379
- if (!info.isFile() || info.size > MAX_INSPECT_BYTES)
380
- return { kind: 'unchecked' };
381
- const image = inspectImage(readFileSync(realFile));
382
- return image ? { kind: 'image', ...image } : { kind: 'unchecked' };
383
- }
384
- catch (error) {
385
- return { kind: error.code === 'ENOENT' ? 'missing' : 'unchecked' };
386
- }
387
- }
388
- const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
389
- function inspectImage(bytes) {
390
- const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
391
- if (bytes.length > 24 && PNG_SIGNATURE.every((byte, i) => bytes[i] === byte)) {
392
- const colorType = bytes[25];
393
- let alpha = colorType === 4 || colorType === 6;
394
- for (let at = 8; !alpha && at + 8 <= bytes.length;) {
395
- const length = view.getUint32(at);
396
- const type = String.fromCharCode(...bytes.subarray(at + 4, at + 8));
397
- if (type === "IDAT" || type === "IEND")
398
- break;
399
- if (type === "tRNS")
400
- alpha = true;
401
- at += 12 + length;
402
- }
403
- return { format: "png", width: view.getUint32(16), height: view.getUint32(20), alpha };
404
- }
405
- if (bytes[0] === 0xff && bytes[1] === 0xd8) {
406
- for (let at = 2; at + 9 < bytes.length;) {
407
- if (bytes[at] !== 0xff)
408
- return null;
409
- const marker = bytes[at + 1];
410
- if (marker === 0xff) {
411
- at += 1;
412
- continue;
413
- }
414
- const length = view.getUint16(at + 2);
415
- if (marker >= 0xc0 && marker <= 0xcf && ![0xc4, 0xc8, 0xcc].includes(marker)) {
416
- return { format: "jpeg", height: view.getUint16(at + 5), width: view.getUint16(at + 7), alpha: false };
417
- }
418
- at += 2 + length;
419
- }
420
- }
421
- return null;
422
- }
423
- function evaluateIcon(root, appJson, item) {
424
- const config = getPath(appJson, ['expo', 'ios', 'icon']);
425
- const base = stringValue(getPath(appJson, ['expo', 'icon']));
426
- const appearances = objectValue(config);
427
- const primary = stringValue(config) ?? stringValue(appearances.light) ?? base;
428
- const alpha = item.id === 'app_icon_alpha';
429
- const icons = [primary, ...(alpha ? [] : [stringValue(appearances.dark), stringValue(appearances.tinted)])]
430
- .filter((icon) => Boolean(icon));
431
- if (existsSync(path.join(root, 'ios'))) {
432
- return makeItem(item, 'info', 'Check the app icon in the native Xcode asset catalog.', 'ios project checked in');
433
- }
434
- if (!primary) {
435
- return makeItem(item, alpha ? 'info' : 'fail', 'No default iOS app icon is set in app.json.', 'app.json expo.ios.icon and expo.icon');
436
- }
358
+ function evaluateIosIconFiles(root, appJson, item, dynamicConfig) {
359
+ if (safeReadDir(path.join(root, 'ios')).some(({ name }) => /\.(xcodeproj|xcworkspace)$/.test(name))) {
360
+ return makeItem(item, 'info', 'Xcode supplies the app icon for this native project.', 'ios/');
361
+ }
362
+ if (dynamicConfig) {
363
+ return makeItem(item, 'info', `Expo resolves the iOS icon from ${dynamicConfig} at build time.`, dynamicConfig);
364
+ }
365
+ const staticConfigPath = path.join(root, 'app.config.json');
366
+ const configFile = existsSync(staticConfigPath) ? 'app.config.json' : 'app.json';
367
+ const config = configFile === 'app.config.json' ? readJson(staticConfigPath) : appJson;
368
+ if (!config)
369
+ return makeItem(item, 'info', `The iOS icon configuration could not be read from ${configFile}.`, configFile);
370
+ const expo = objectValue(getPath(config, ['expo']) ?? config);
371
+ const iosIcon = getPath(expo, ['ios', 'icon']);
372
+ const variants = objectValue(iosIcon);
373
+ const configured = typeof iosIcon === 'string' && iosIcon
374
+ ? [iosIcon]
375
+ : [variants.light, variants.dark, variants.tinted].filter(Boolean);
376
+ const icons = configured.length ? configured : [expo.icon].filter(Boolean);
377
+ if (!icons.length)
378
+ return makeItem(item, 'pass', 'Expo supplies a default iOS icon.', configFile);
379
+ const missing = [];
437
380
  let unchecked = false;
438
381
  for (const icon of icons) {
439
- const asset = inspectProjectAsset(root, icon);
440
- if (asset.kind === 'missing') {
441
- return makeItem(item, alpha ? 'info' : 'fail', 'The configured iOS app icon is missing.', icon);
382
+ if (typeof icon !== 'string' || path.isAbsolute(icon) || /^[a-z][a-z\d+.-]*:/i.test(icon)) {
383
+ unchecked = true;
384
+ continue;
442
385
  }
443
- if (asset.kind === 'composer' && alpha) {
444
- return makeItem(item, 'pass', 'Icon Composer renders the App Store icon from its layers.', icon);
386
+ const file = path.resolve(root, icon);
387
+ const relative = path.relative(root, file);
388
+ if (relative === '..' || relative.startsWith(`..${path.sep}`)) {
389
+ unchecked = true;
390
+ continue;
445
391
  }
446
- if (asset.kind === 'image') {
447
- if (alpha && asset.alpha)
448
- return makeItem(item, 'fail', 'The iOS app icon has an alpha channel. Export an opaque icon.', icon);
449
- if (!alpha && (asset.width !== asset.height || asset.width < 1024)) {
450
- return makeItem(item, 'fail', `The iOS app icon is ${asset.width}×${asset.height}. Use a square image at least 1024×1024.`, icon);
451
- }
392
+ if (path.extname(icon) === '.icon') {
393
+ unchecked ||= !existsSync(file);
452
394
  }
453
- else if (asset.kind === 'unchecked') {
454
- unchecked = true;
395
+ else if (!safeStat(file)?.isFile()) {
396
+ missing.push(icon);
455
397
  }
456
398
  }
399
+ if (missing.length)
400
+ return makeItem(item, 'fail', 'Expo cannot build the iOS icon because a configured image file is missing.', `${configFile} → ${missing.join(', ')}`);
457
401
  if (unchecked)
458
- return makeItem(item, 'info', 'Check the rendered icon for this asset at build time.', icons.join(', '));
459
- return makeItem(item, 'pass', alpha ? 'The iOS app icon has no alpha channel.' : 'The configured iOS app icon passed the asset check.', icons.join(', '));
460
- }
461
- function evaluateSplash(root, appJson, item) {
462
- if (existsSync(path.join(root, 'ios'))) {
463
- return makeItem(item, 'info', 'Check the splash screen in the native Xcode project.', 'ios project checked in');
464
- }
465
- const plugins = getPath(appJson, ['expo', 'plugins']);
466
- const plugin = Array.isArray(plugins) ? plugins.find((entry) => Array.isArray(entry) && entry[0] === 'expo-splash-screen') : undefined;
467
- const pluginConfig = objectValue(plugin?.[1]);
468
- const iosPluginConfig = objectValue(pluginConfig.ios);
469
- const iosSplash = getPath(appJson, ['expo', 'ios', 'splash']);
470
- const splash = getPath(appJson, ['expo', 'splash']);
471
- const splashColor = [iosPluginConfig.backgroundColor, pluginConfig.backgroundColor, getPath(iosSplash, ['backgroundColor']), getPath(splash, ['backgroundColor'])].map(stringValue).find(Boolean);
472
- if (item.id === 'splash_bg_color') {
473
- const color = splashColor;
474
- return makeItem(item, color ? 'pass' : 'info', color ? 'The splash background color is set.' : 'No splash background color is set.', 'app.json splash settings');
475
- }
476
- const pluginImage = [iosPluginConfig.image, pluginConfig.image].map(stringValue).find(Boolean);
477
- const image = pluginImage ?? stringValue(getPath(iosSplash, ['image'])) ?? stringValue(getPath(splash, ['image']));
478
- if (!image)
479
- return makeItem(item, splashColor ? 'info' : 'warning', splashColor ? 'The splash screen uses a background color only.' : 'No splash image is set in app.json.', 'app.json splash settings');
480
- const darkImage = [objectValue(iosPluginConfig.dark).image, objectValue(pluginConfig.dark).image, getPath(iosSplash, ['dark', 'image'])]
481
- .map(stringValue).find(Boolean);
482
- if (darkImage && inspectProjectAsset(root, darkImage).kind === 'missing') {
483
- return makeItem(item, 'warning', 'The configured dark mode splash image is missing.', darkImage);
484
- }
485
- const asset = inspectProjectAsset(root, image);
486
- if (asset.kind === 'missing')
487
- return makeItem(item, 'warning', 'The configured splash image is missing.', image);
488
- if (asset.kind !== 'image')
489
- return makeItem(item, 'info', 'The configured splash image could not be inspected.', image);
490
- if (!pluginImage && (asset.width < 1024 || asset.height < 1024)) {
491
- return makeItem(item, 'warning', `The legacy full-screen splash image is ${asset.width}×${asset.height}. Use an image at least 1024×1024.`, image);
492
- }
493
- return makeItem(item, 'pass', `The splash image is ${asset.width}×${asset.height}.`, image);
402
+ return makeItem(item, 'info', 'Some configured iOS icon paths could not be verified from the project files.', configFile);
403
+ return makeItem(item, 'pass', 'Configured iOS icon paths exist in the project.', configFile);
494
404
  }
495
405
  const NON_RELEASE_BACKEND = /[a-z0-9]+-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}-dev\.api\.newlyapp\.com|\.api-dev\.newlyapp\.com|\b[a-z0-9-]+\.(?:ngrok(?:-free)?\.(?:app|dev|io)|loca\.lt|trycloudflare\.com)\b|\b10\.0\.2\.2\b/i;
496
406
  const RELEASE_ENV_FILES = ['.env', '.env.production', '.env.production.local', '.env.local'];
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = '0.2.238';
1
+ export const CLI_VERSION = '0.2.239';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcloud",
3
- "version": "0.2.238",
3
+ "version": "0.2.239",
4
4
  "description": "Create and control run.cloud remote mobile simulators and cloud sandboxes",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
Binary file
Binary file