@livx.cc/appwrap 0.39.4 → 0.39.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livx.cc/appwrap",
3
- "version": "0.39.4",
3
+ "version": "0.39.5",
4
4
  "description": "Wrap any PWA into a native app with native capabilities (appwrap runtime + @livx.cc/native-kit).",
5
5
  "license": "MIT",
6
6
  "author": "Elya Livshitz",
package/src/cli.ts CHANGED
@@ -20,6 +20,7 @@ import type * as CapManifest from '../../../runtime/app/shell/capabilities.manif
20
20
  // Config shape lives in its own import-safe module so a `appwrap.config.ts` file can import the
21
21
  // type + `defineConfig` helper without pulling in (and running) the CLI dispatch.
22
22
  import type { AppwrapConfig } from './config';
23
+ import { unknownConfigKeys } from './config';
23
24
  import {
24
25
  androidScreenOrientation,
25
26
  applyBuildNumberFlag,
@@ -377,6 +378,15 @@ async function loadConfig(cwd: string, flags: Record<string, string>): Promise<A
377
378
  }
378
379
  const cfg = await readConfigFile(configPath);
379
380
 
381
+ // Warn (never fail) on keys this appwrap doesn't recognize. A config authored for a NEWER appwrap
382
+ // silently no-ops its unknown keys on an older install (e.g. `targetedDevices` before 0.39 → wrong
383
+ // device family, no error). Turn that silent no-op into a signal.
384
+ const stray = unknownConfigKeys(cfg as unknown as Record<string, unknown>);
385
+ if (stray.length) {
386
+ const ver = pkgVersion(resolve(import.meta.dir, '../package.json'));
387
+ for (const k of stray) console.warn(`⚠ appwrap: unrecognized config key '${k}' — ignored. If you expect it to apply, your installed @livx.cc/appwrap (${ver}) may predate it — upgrade.`);
388
+ }
389
+
380
390
  // Manifest as source: the appwrap config wins, the PWA manifest fills the gaps, template default last.
381
391
  // (DRY single-source — devs don't re-type identity already declared in the manifest.) See mergeManifest.
382
392
  if (cfg.pwaDist) mergeManifest(cfg, loadManifest(cwd, cfg));
package/src/config.ts CHANGED
@@ -200,3 +200,24 @@ export interface AppwrapConfig {
200
200
  export function defineConfig(config: AppwrapConfig): AppwrapConfig {
201
201
  return config;
202
202
  }
203
+
204
+ /**
205
+ * Top-level keys appwrap recognizes — KEEP IN SYNC with `AppwrapConfig` above (top-level only; nested
206
+ * keys like `push.ios` are not listed). Drives `unknownConfigKeys`, which warns (never fails) on stray
207
+ * keys at load time. The motivating bug: a config written for a NEWER appwrap silently no-ops its
208
+ * unknown keys on an OLDER installed version (e.g. `targetedDevices` before 0.39 → a universal build
209
+ * with no error, then an App Store rejection). A loud warning turns that silent no-op into a signal.
210
+ */
211
+ export const KNOWN_CONFIG_KEYS: ReadonlySet<string> = new Set([
212
+ 'appBoundDomains', 'backendOrigin', 'backgroundColor', 'backgroundTasks', 'buildNumber', 'debug',
213
+ 'debugLog', 'devMenu', 'edgeToEdge', 'entry', 'icon', 'id', 'loader', 'modules', 'name',
214
+ 'neutralizeServiceWorker', 'openNewWindowsInBrowser', 'orientation', 'overrides', 'permissions',
215
+ 'plugins', 'push', 'pwaDist', 'queryPackages', 'queryUrlSchemes', 'serverUrl', 'statusBarStyle',
216
+ 'storekitConfig', 'targetedDevices', 'teamId', 'themeColor', 'trackingDomains', 'urlScheme',
217
+ 'usesNonExemptEncryption', 'vendorPaths', 'version',
218
+ ]);
219
+
220
+ /** Config keys appwrap doesn't recognize (pure — the caller decides how to surface them). */
221
+ export function unknownConfigKeys(cfg: Record<string, unknown>): string[] {
222
+ return Object.keys(cfg).filter((k) => !KNOWN_CONFIG_KEYS.has(k));
223
+ }