@wix/himalaya-cli 0.1367.0 → 0.1368.0

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/cli.mjs CHANGED
@@ -35371,6 +35371,16 @@ function loadSupervisorRegistry() {
35371
35371
  function isPlayerHost(appName2) {
35372
35372
  return appName2 === PLAYER_APP_ID || process.env.HIMALAYA_DEV_MULTI_APP === "1";
35373
35373
  }
35374
+ function tenantsOf(hostApp) {
35375
+ if (!Object.prototype.hasOwnProperty.call(HOSTED_TENANTS, hostApp)) return [];
35376
+ const fixed = HOSTED_TENANTS[hostApp];
35377
+ const extra = (process.env.HIMALAYA_DEV_HOSTED_TENANTS ?? "").split(",").map((a2) => a2.trim()).filter((a2) => /^[a-z0-9][a-z0-9._-]{0,127}$/i.test(a2) && a2 !== hostApp && a2 !== PLAYER_APP_ID);
35378
+ return extra.length ? [...fixed, ...extra.filter((a2) => !fixed.includes(a2))] : fixed;
35379
+ }
35380
+ function optedInTenant(tenant) {
35381
+ if (Object.values(HOSTED_TENANTS).some((t2) => t2.includes(tenant))) return false;
35382
+ return (process.env.HIMALAYA_DEV_HOSTED_TENANTS ?? "").split(",").some((a2) => a2.trim() === tenant);
35383
+ }
35374
35384
  function isTenantHost(appName2) {
35375
35385
  return !!appName2 && Object.prototype.hasOwnProperty.call(HOSTED_TENANTS, appName2);
35376
35386
  }
@@ -35386,7 +35396,7 @@ function resolveTenantBase(tenant, registry2 = loadSupervisorRegistry) {
35386
35396
  if (running?.status === "running" && running.port) port = running.port;
35387
35397
  } catch {
35388
35398
  }
35389
- port ??= ledgerDevServerPort(tenant);
35399
+ if (!optedInTenant(tenant)) port ??= ledgerDevServerPort(tenant);
35390
35400
  if (port) return `http://127.0.0.1:${port}`;
35391
35401
  }
35392
35402
  return resolveServeBase();
@@ -35411,7 +35421,7 @@ function tenantPrefixed(url, hostApp, method = "GET") {
35411
35421
  return null;
35412
35422
  }
35413
35423
  if (!normalized.startsWith("/v1/") || normalized !== path2 || isTenantAdminPath(normalized)) return null;
35414
- return HOSTED_TENANTS[hostApp].includes(tenant) ? { tenant, url: tenantUrl } : null;
35424
+ return tenantsOf(hostApp).includes(tenant) ? { tenant, url: tenantUrl } : null;
35415
35425
  }
35416
35426
  function forwardedBaseUrl(req) {
35417
35427
  if (!LOOPBACK_PEERS.has(req.socket?.remoteAddress ?? "")) return null;
@@ -35493,7 +35503,9 @@ function tenantHostPlaneRead(url, headers2, hostApp, method = "GET") {
35493
35503
  if (path2 === "/v1/release/current") {
35494
35504
  const app = new URLSearchParams(query).get("app")?.trim();
35495
35505
  if (!app || app === hostApp || HOSTED_TENANTS[hostApp].includes(app)) return null;
35496
- if (targetTenant(url, headers2, hostApp) !== null) return null;
35506
+ const hdr = headers2["x-himalaya-app"];
35507
+ const headerApp = (Array.isArray(hdr) ? hdr[0] : hdr)?.trim();
35508
+ if (headerApp && tenantsOf(hostApp).includes(headerApp)) return null;
35497
35509
  return resolveServeBase() || null;
35498
35510
  }
35499
35511
  return null;
@@ -35513,7 +35525,7 @@ function targetTenant(url, headers2, hostApp) {
35513
35525
  }
35514
35526
  if (!app) return null;
35515
35527
  if (app === hostApp || app === PLAYER_APP_ID) return null;
35516
- if (hostApp && isTenantHost(hostApp) && !HOSTED_TENANTS[hostApp].includes(app)) return null;
35528
+ if (hostApp && isTenantHost(hostApp) && !tenantsOf(hostApp).includes(app)) return null;
35517
35529
  return app;
35518
35530
  }
35519
35531
  function shouldServeFromPlane(url, headers2, hostApp) {
@@ -132563,6 +132575,8 @@ function createDevServer(opts = {}) {
132563
132575
  await maybeReseedNetMocks(state);
132564
132576
  if (url.startsWith("/__dev/")) return await handleDev(req, res, state);
132565
132577
  if (isTenantHost(state.appName)) {
132578
+ const planeRead = tenantHostPlaneRead(url, req.headers, state.appName, req.method);
132579
+ if (planeRead) return await proxyToServe(planeRead, req, res);
132566
132580
  const prefixed = tenantPrefixed(url, state.appName, req.method);
132567
132581
  const tenant = prefixed?.tenant ?? (shouldServeFromPlane(url, req.headers, state.appName) && !isTenantAdminPath(url) ? targetTenant(url, req.headers, state.appName) : null);
132568
132582
  if (tenant) {
@@ -132580,8 +132594,6 @@ function createDevServer(opts = {}) {
132580
132594
  forwardAs: clientHost ? { host: clientHost, prefix: `${TENANT_PREFIX}${encodeURIComponent(tenant)}` } : void 0
132581
132595
  });
132582
132596
  }
132583
- const planeRead = tenantHostPlaneRead(url, req.headers, state.appName, req.method);
132584
- if (planeRead) return await proxyToServe(planeRead, req, res);
132585
132597
  }
132586
132598
  if (url.split("?")[0] === "/v1/app-icon" && req.method === "GET") {
132587
132599
  const iconApp = new URLSearchParams(url.split("?")[1] ?? "").get("app") ?? "";
@@ -170122,19 +170134,42 @@ function decideSiteApp(input) {
170122
170134
  ...input.installedVersion ? { installedVersion: input.installedVersion } : {}
170123
170135
  });
170124
170136
  if (!verdict.ok) return fallback(picked, verdict.reason);
170125
- if (!(input.hostable ?? NATIVELY_HOSTABLE_APPS).includes(picked)) {
170137
+ const ungranted = req.requirements.capabilities.filter((c2) => !HOSTED_APP_CAPABILITIES.includes(c2));
170138
+ if ((input.hostable ?? NATIVELY_HOSTABLE_APPS) === "any" && ungranted.length) {
170139
+ return fallback(picked, `This Spaces build does not grant a member app ${ungranted.join(", ")} yet (${picked} declares it)`);
170140
+ }
170141
+ const hostable = input.hostable ?? NATIVELY_HOSTABLE_APPS;
170142
+ if (hostable !== "any" && !hostable.includes(picked)) {
170126
170143
  return fallback(picked, `This Spaces build cannot host a custom member app yet (${picked} is compatible)`);
170127
170144
  }
170128
170145
  return { appId: picked, source: "picked" };
170129
170146
  }
170130
- var DEFAULT_SITE_APP, NATIVELY_HOSTABLE_APPS, APP_ID3;
170147
+ var DEFAULT_SITE_APP, NATIVELY_HOSTABLE_APPS, HOSTED_APP_CAPABILITIES, APP_ID3;
170131
170148
  var init_site_app = __esm({
170132
170149
  "../../apps/himi-spaces-lite/site-app.ts"() {
170133
170150
  init_host_compatibility();
170134
170151
  init_registry_app_normalize();
170135
170152
  init_site_open();
170136
170153
  DEFAULT_SITE_APP = HOSTED_MEMBER_APP;
170137
- NATIVELY_HOSTABLE_APPS = [DEFAULT_SITE_APP];
170154
+ NATIVELY_HOSTABLE_APPS = "any";
170155
+ HOSTED_APP_CAPABILITIES = [
170156
+ "animation",
170157
+ "app_info",
170158
+ "clipboard",
170159
+ "file_picker",
170160
+ "haptics",
170161
+ "keyboard",
170162
+ "media_playback",
170163
+ "motion",
170164
+ "on_device_ai",
170165
+ "open_url",
170166
+ "pdf",
170167
+ "share",
170168
+ "stream",
170169
+ "theme",
170170
+ "ui",
170171
+ "wix_api"
170172
+ ];
170138
170173
  APP_ID3 = /^[a-z0-9][a-z0-9._-]{0,127}$/i;
170139
170174
  }
170140
170175
  });
@@ -135,10 +135,12 @@ keeps the service's own `error` in `serverError` and its HTTP `status`; the CLI
135
135
 
136
136
  `show` succeeds with `opens` (what members get: the picked app or `himi-branded-lite`), `compatible`
137
137
  (whether the picked release fits the Spaces host manifest, judged with `checkHostCompatibility`), and —
138
- whenever members get Branded Lite instead of the pick — `reason`. `opens` is Spaces' own decision, so a
139
- compatible pick that this Spaces build cannot host yet reports `compatible: true` with `opens:
140
- "himi-branded-lite"` and that reason. An incompatible pick is not a failure: it is `ok: true` with
141
- `compatible: false`.
138
+ whenever members get Branded Lite instead of the pick — `reason`. `opens` is Spaces' own decision: a
139
+ compatible pick reports `compatible: true` with `opens` naming that app — except one that needs a
140
+ capability the hosted-app sandbox does not grant (on-device stores such as `local_database`,
141
+ `secure_storage` and `files`, or push, purchases, release control and the like), which reports
142
+ `compatible: true` with `opens: "himi-branded-lite"` and that reason. Read `opens`, not `compatible`, for
143
+ what members get. An incompatible pick is not a failure: it is `ok: true` with `compatible: false`.
142
144
 
143
145
  ## Follow-ups
144
146
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1367.0",
3
+ "version": "0.1368.0",
4
4
  "type": "module",
5
5
  "description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
6
6
  "keywords": [
@@ -71,5 +71,5 @@
71
71
  "artifactId": "himalaya-cli"
72
72
  }
73
73
  },
74
- "falconPackageHash": "f0bd979c3332da32c4c59ee213e5f02fad1f6edd492c8ab44ee4947b"
74
+ "falconPackageHash": "b0dba7f9b4c5184e704a739e1f459e4930cc9b446af7d0866d9038ae"
75
75
  }