@wix/himalaya-cli 0.1273.0 → 0.1274.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
@@ -3948,12 +3948,14 @@ var init_dist_jobs = __esm({
3948
3948
  appDir: "apps/himi-branded-lite",
3949
3949
  bundleId: { ios: "ent.wix.brandedlite.dev", android: "com.wix.himi.brandedlite.dev" },
3950
3950
  provisioningEnv: "HIMI_BRANDED_LITE_PROVISIONING_JSON",
3951
+ embeddedSuffixes: ["liveactivity"],
3951
3952
  extensibleCapabilities: true
3952
3953
  },
3953
3954
  "owner-lite": {
3954
3955
  appDir: "apps/himi-owner-lite",
3955
3956
  bundleId: { ios: "ent.wix.ownerlite.dev", android: "com.wix.himi.ownerlite.dev" },
3956
3957
  provisioningEnv: "HIMI_OWNER_LITE_PROVISIONING_JSON",
3958
+ embeddedSuffixes: ["liveactivity"],
3957
3959
  extensibleCapabilities: true
3958
3960
  },
3959
3961
  // RFC 0062 — the site shell: the customer's own website as native-framed Tier-3 tabs.
@@ -3963,6 +3965,7 @@ var init_dist_jobs = __esm({
3963
3965
  appDir: "apps/himi-brandy",
3964
3966
  bundleId: { ios: "ent.wix.brandy.dev", android: "com.wix.himi.brandy.dev" },
3965
3967
  provisioningEnv: "HIMI_BRANDY_PROVISIONING_JSON",
3968
+ embeddedSuffixes: ["liveactivity"],
3966
3969
  extensibleCapabilities: true
3967
3970
  },
3968
3971
  // The Base44 shell (#3674): a Base44 app as a native binary. Brandable — dist bakes the fetched
@@ -3971,18 +3974,21 @@ var init_dist_jobs = __esm({
3971
3974
  appDir: "apps/himi-base44",
3972
3975
  bundleId: { ios: "ent.wix.himibase44.dev", android: "com.wix.himi.base44.dev" },
3973
3976
  provisioningEnv: "HIMI_BASE44_PROVISIONING_JSON",
3977
+ embeddedSuffixes: ["liveactivity"],
3974
3978
  extensibleCapabilities: true
3975
3979
  },
3976
3980
  player: {
3977
3981
  appDir: "apps/himi-player",
3978
3982
  bundleId: { ios: "dev.himalaya.player.dev", android: "dev.himalaya.player.dev" },
3979
3983
  provisioningEnv: "HIMI_PLAYER_PROVISIONING_JSON",
3984
+ embeddedSuffixes: [],
3980
3985
  extensibleCapabilities: false
3981
3986
  },
3982
3987
  "demo-app": {
3983
3988
  appDir: "apps/demo-app",
3984
3989
  bundleId: { ios: "com.himalaya.demoapp.dev", android: "com.himalaya.demoapp.dev" },
3985
3990
  provisioningEnv: "DEMO_APP_PROVISIONING_JSON",
3991
+ embeddedSuffixes: ["widgets"],
3986
3992
  extensibleCapabilities: false
3987
3993
  }
3988
3994
  };
@@ -28588,7 +28594,6 @@ function shouldRevealError(args) {
28588
28594
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE;
28589
28595
  var init_validation = __esm({
28590
28596
  "../../core/ts/src/validation.ts"() {
28591
- "use strict";
28592
28597
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
28593
28598
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
28594
28599
  INTEGER_RE = /^[+-]?[0-9]+$/;
@@ -147798,114 +147803,7 @@ var init_git = __esm({
147798
147803
  }
147799
147804
  });
147800
147805
 
147801
- // ../store-release/version.ts
147802
- var version_exports = {};
147803
- __export(version_exports, {
147804
- bumpVersion: () => bumpVersion,
147805
- readAndroidVersion: () => readAndroidVersion,
147806
- readAndroidVersionName: () => readAndroidVersionName,
147807
- readIosMarketingVersion: () => readIosMarketingVersion,
147808
- readIosVersion: () => readIosVersion,
147809
- readIosVersionStrings: () => readIosVersionStrings,
147810
- setAndroidVersion: () => setAndroidVersion,
147811
- setIosVersion: () => setIosVersion,
147812
- stampIosVersionStrings: () => stampIosVersionStrings
147813
- });
147814
- import { readFileSync as readFileSync79, writeFileSync as writeFileSync28 } from "node:fs";
147815
- function readIosVersion(projectYml) {
147816
- const marketing = matchScalar(projectYml, "CFBundleShortVersionString");
147817
- const build3 = matchScalar(projectYml, "CFBundleVersion");
147818
- if (marketing === null || build3 === null) {
147819
- throw new Error("project.yml is missing CFBundleShortVersionString / CFBundleVersion");
147820
- }
147821
- return { marketing, build: Number(build3) };
147822
- }
147823
- function setIosVersion(projectYml, v2) {
147824
- let out2 = replaceScalar(projectYml, "CFBundleShortVersionString", v2.marketing);
147825
- out2 = replaceScalar(out2, "CFBundleVersion", String(v2.build));
147826
- out2 = out2.replace(
147827
- /(^[ \t]*# >>> himalaya:live-activity:target[^\n]*\n)([\s\S]*?)(^[ \t]*# <<< himalaya:live-activity:target[^\n]*$)/m,
147828
- (_match, start, body, end) => {
147829
- if (!body.trim()) return start + body + end;
147830
- return start + replaceScalar(replaceScalar(body, "CFBundleShortVersionString", v2.marketing), "CFBundleVersion", String(v2.build)) + end;
147831
- }
147832
- );
147833
- return out2;
147834
- }
147835
- function readIosVersionStrings(projectYml) {
147836
- const marketing = matchScalar(projectYml, "CFBundleShortVersionString");
147837
- const build3 = matchScalar(projectYml, "CFBundleVersion");
147838
- if (marketing === null || build3 === null) {
147839
- throw new Error("project.yml is missing CFBundleShortVersionString / CFBundleVersion");
147840
- }
147841
- return { marketing, build: build3 };
147842
- }
147843
- function stampIosVersionStrings(projectYml, v2) {
147844
- return replaceScalar(replaceScalar(projectYml, "CFBundleShortVersionString", v2.marketing), "CFBundleVersion", v2.build);
147845
- }
147846
- function readIosMarketingVersion(projectYml) {
147847
- return matchScalar(projectYml, "CFBundleShortVersionString");
147848
- }
147849
- function scalarRe(key2) {
147850
- return new RegExp(`^(\\s*${key2}:\\s*)("?)([^"\\n#]*?)("?)(\\s*(?:#.*)?)$`, "m");
147851
- }
147852
- function matchScalar(content, key2) {
147853
- const m2 = scalarRe(key2).exec(content);
147854
- return m2 ? m2[3].trim() : null;
147855
- }
147856
- function replaceScalar(content, key2, value) {
147857
- const re2 = scalarRe(key2);
147858
- if (!re2.test(content)) throw new Error(`could not locate \`${key2}:\` in project.yml`);
147859
- return content.replace(re2, (_full, pre, openQ, _oldVal, _closeQ, tail) => {
147860
- const q2 = openQ ? '"' : "";
147861
- return `${pre}${q2}${value}${q2}${tail}`;
147862
- });
147863
- }
147864
- function readAndroidVersion(gradle) {
147865
- const name = /(\bversionName\s*=\s*")([^"]*)(")/.exec(gradle);
147866
- const code = /(\bversionCode\s*=\s*)(\d+)/.exec(gradle);
147867
- if (!name || !code) throw new Error("build.gradle.kts is missing versionName / versionCode");
147868
- return { marketing: name[2], build: Number(code[2]) };
147869
- }
147870
- function readAndroidVersionName(gradle) {
147871
- const name = /(\bversionName\s*=\s*")([^"]*)(")/.exec(gradle);
147872
- return name ? name[2] : null;
147873
- }
147874
- function setAndroidVersion(gradle, v2) {
147875
- if (!/\bversionName\s*=\s*"/.test(gradle) || !/\bversionCode\s*=\s*\d+/.test(gradle)) {
147876
- throw new Error("build.gradle.kts is missing versionName / versionCode");
147877
- }
147878
- return gradle.replace(/(\bversionName\s*=\s*")[^"]*(")/, `$1${v2.marketing}$2`).replace(/(\bversionCode\s*=\s*)\d+/, `$1${v2.build}`);
147879
- }
147880
- function bumpVersion(app, opts) {
147881
- const iosPath = iosProjectYml(app);
147882
- const gradlePath = androidGradle(app);
147883
- const iosYml = readFileSync79(iosPath, "utf8");
147884
- const gradle = readFileSync79(gradlePath, "utf8");
147885
- const current = readIosVersion(iosYml);
147886
- const next = {
147887
- marketing: opts.marketing ?? current.marketing,
147888
- build: opts.build === "increment" || opts.build === void 0 ? current.build + (opts.build === "increment" ? 1 : 0) : opts.build
147889
- };
147890
- writeFileSync28(iosPath, setIosVersion(iosYml, next));
147891
- writeFileSync28(gradlePath, setAndroidVersion(gradle, next));
147892
- return next;
147893
- }
147894
- var init_version = __esm({
147895
- "../store-release/version.ts"() {
147896
- init_paths2();
147897
- }
147898
- });
147899
-
147900
- // ../store-release/store-spec.ts
147901
- function detectBundleId(projectYml) {
147902
- const m2 = /^\s*bundleId:\s*(\S+)\s*$/m.exec(projectYml);
147903
- if (!m2) throw new Error("project.yml has no `bundleId:` on the application target");
147904
- return m2[1];
147905
- }
147906
- function defaultProdBundleId(devBundleId) {
147907
- return devBundleId.replace(/\.dev$/, "");
147908
- }
147806
+ // ../store-release/embedded-bundles.ts
147909
147807
  function referencedWatchProject(projectYml) {
147910
147808
  if (!/^projectReferences:/m.test(projectYml)) return void 0;
147911
147809
  const m2 = /^projectReferences:\n {2}Watch:\n {4}path:\s*\.\.\/watchos\/(\S+)\.xcodeproj\s*$/m.exec(projectYml);
@@ -147916,17 +147814,78 @@ function referencedWatchProject(projectYml) {
147916
147814
  }
147917
147815
  return { name: m2[1] };
147918
147816
  }
147919
- function storeWatchBundleId(prodIosBundleId) {
147920
- return `${prodIosBundleId}.watchkitapp`;
147817
+ function targetsOf(projectYml) {
147818
+ const lines = projectYml.split("\n");
147819
+ const out2 = {};
147820
+ let inTargets = false;
147821
+ let current;
147822
+ for (const line of lines) {
147823
+ if (/^\s*#/.test(line) || !line.trim()) continue;
147824
+ if (/^\S/.test(line)) {
147825
+ inTargets = /^targets:\s*$/.test(line);
147826
+ current = void 0;
147827
+ continue;
147828
+ }
147829
+ if (!inTargets) continue;
147830
+ const name = /^ {2}([A-Za-z0-9_.-]+):\s*$/.exec(line);
147831
+ if (name) {
147832
+ current = out2[name[1]] = { deps: [] };
147833
+ continue;
147834
+ }
147835
+ if (!current) continue;
147836
+ let m2;
147837
+ if (m2 = /^ {4}type:\s*(\S+)\s*$/.exec(line)) current.type = m2[1];
147838
+ else if (m2 = /^ {4}bundleId:\s*(.+?)\s*$/.exec(line)) current.bundleId = unquote2(m2[1]);
147839
+ else if (m2 = /^\s+PRODUCT_BUNDLE_IDENTIFIER:\s*(.+?)\s*$/.exec(line)) current.productBundleId ??= unquote2(m2[1]);
147840
+ else if (m2 = /^ {6}- target:\s*(\S+)\s*$/.exec(line)) current.deps.push(unquote2(m2[1]));
147841
+ }
147842
+ return out2;
147843
+ }
147844
+ function idExprOf(t2) {
147845
+ return t2.productBundleId ?? t2.bundleId;
147846
+ }
147847
+ function appTarget(projectYml) {
147848
+ const apps = Object.entries(targetsOf(projectYml)).filter(([, t3]) => t3.type === "application");
147849
+ if (!apps.length) throw new Error("embedded-bundles: project.yml has no application target");
147850
+ const [name, t2] = apps[0];
147851
+ const idExpr = idExprOf(t2);
147852
+ if (!idExpr) throw new Error(`embedded-bundles: application target ${name} declares no bundle id`);
147853
+ return { name, idExpr };
147854
+ }
147855
+ function embeddedBundles(projectYml) {
147856
+ const targets = targetsOf(projectYml);
147857
+ const host = appTarget(projectYml);
147858
+ const deps = targets[host.name].deps.filter((t2) => !t2.includes("/"));
147859
+ const out2 = [];
147860
+ for (const name of deps) {
147861
+ const t2 = targets[name];
147862
+ if (t2?.type !== "app-extension") continue;
147863
+ const idExpr = idExprOf(t2);
147864
+ if (!idExpr || !idExpr.startsWith(`${host.idExpr}.`)) {
147865
+ throw new Error(
147866
+ `embedded-bundles: extension ${name}'s bundle id ${JSON.stringify(idExpr)} does not extend the app's ${JSON.stringify(host.idExpr)} \u2014 Apple requires an embedded bundle's id to be <app id>.<suffix>`
147867
+ );
147868
+ }
147869
+ out2.push({ target: name, kind: "app-extension", suffix: idExpr.slice(host.idExpr.length + 1), idExpr });
147870
+ }
147871
+ const watch2 = referencedWatchProject(projectYml);
147872
+ if (watch2) {
147873
+ out2.push({ target: watch2.name, kind: "watch", suffix: "watchkitapp", idExpr: `${host.idExpr}.watchkitapp` });
147874
+ }
147875
+ return out2;
147876
+ }
147877
+ function embeddedBundleId(hostBundleId, b2) {
147878
+ return `${hostBundleId}.${b2.suffix}`;
147921
147879
  }
147922
- function storeSigningBundleIds(projectYml, toBundleId) {
147923
- const prod = toBundleId ?? defaultProdBundleId(detectBundleId(projectYml));
147924
- return referencedWatchProject(projectYml) ? [prod, storeWatchBundleId(prod)] : [prod];
147880
+ function embeddedAppIdLabel(b2) {
147881
+ if (b2.kind === "watch") return "Watch";
147882
+ const words = b2.suffix.split(/[^A-Za-z0-9]+/).filter(Boolean).map((w2) => w2[0].toUpperCase() + w2.slice(1));
147883
+ return `${words.join(" ") || "Extension"} Extension`;
147925
147884
  }
147926
- var init_store_spec = __esm({
147927
- "../store-release/store-spec.ts"() {
147928
- init_paths2();
147929
- init_version();
147885
+ var unquote2;
147886
+ var init_embedded_bundles = __esm({
147887
+ "../store-release/embedded-bundles.ts"() {
147888
+ unquote2 = (v2) => v2.trim().replace(/^(["'])(.*)\1$/, "$2");
147930
147889
  }
147931
147890
  });
147932
147891
 
@@ -147939,7 +147898,7 @@ __export(preflight_exports, {
147939
147898
  parseStoreConfig: () => parseStoreConfig,
147940
147899
  requireEnv: () => requireEnv
147941
147900
  });
147942
- import { existsSync as existsSync69, readFileSync as readFileSync80 } from "node:fs";
147901
+ import { existsSync as existsSync69, readFileSync as readFileSync79 } from "node:fs";
147943
147902
  import { isAbsolute as isAbsolute6, relative as relative14, resolve as resolve53 } from "node:path";
147944
147903
  function isInsideRepo(p2) {
147945
147904
  const rel = relative14(REPO_ROOT3, resolve53(p2));
@@ -147999,7 +147958,7 @@ function loadStoreConfig(app) {
147999
147958
  if (!existsSync69(p2)) {
148000
147959
  throw new Error(`No store config at ${p2}. Create apps/${app}/store/store.config.yaml first (see /setup-store-signing).`);
148001
147960
  }
148002
- return parseStoreConfig(readFileSync80(p2, "utf8"));
147961
+ return parseStoreConfig(readFileSync79(p2, "utf8"));
148003
147962
  }
148004
147963
  var init_preflight = __esm({
148005
147964
  "../store-release/preflight.ts"() {
@@ -148008,7 +147967,7 @@ var init_preflight = __esm({
148008
147967
  });
148009
147968
 
148010
147969
  // ../store-release/register-bundle.ts
148011
- import { readFileSync as readFileSync81 } from "node:fs";
147970
+ import { readFileSync as readFileSync80 } from "node:fs";
148012
147971
  import { createPrivateKey as createPrivateKey2, sign } from "node:crypto";
148013
147972
  function b64url2(b2) {
148014
147973
  return Buffer.from(b2).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
@@ -148026,7 +147985,7 @@ function bundleIdBody(identifier, name, platform = "IOS") {
148026
147985
  async function registerBundleId(opts) {
148027
147986
  const env = requireEnv(["ASC_KEY_ID", "ASC_ISSUER_ID", "ASC_KEY_PATH"]);
148028
147987
  assertCredentialOutsideRepo("ASC_KEY_PATH", env.ASC_KEY_PATH);
148029
- const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync81(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
147988
+ const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync80(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
148030
147989
  const res = await fetch(`${ASC_API}/v1/bundleIds`, {
148031
147990
  method: "POST",
148032
147991
  headers: { Authorization: `Bearer ${jwt}`, "Content-Type": "application/json" },
@@ -148056,8 +148015,12 @@ async function main() {
148056
148015
  }
148057
148016
  const ni2 = rest.indexOf("--name");
148058
148017
  const name = ni2 >= 0 ? rest[ni2 + 1] : cfg.app ?? app;
148059
- for (const id of storeSigningBundleIds(readFileSync81(iosProjectYml(app), "utf8"), identifier)) {
148060
- const r2 = await registerBundleId({ identifier: id, name: id === identifier ? name : `${name} Watch` });
148018
+ const yml = readFileSync80(iosProjectYml(app), "utf8");
148019
+ for (const { id, label: label2 } of [{ id: identifier, label: name }, ...embeddedBundles(yml).map((b2) => ({
148020
+ id: embeddedBundleId(identifier, b2),
148021
+ label: `${name} ${embeddedAppIdLabel(b2)}`
148022
+ }))]) {
148023
+ const r2 = await registerBundleId({ identifier: id, name: label2 });
148061
148024
  console.log(`bundle id ${id}: ${r2.status}${r2.id ? ` (${r2.id})` : ""}`);
148062
148025
  }
148063
148026
  }
@@ -148065,7 +148028,7 @@ var ASC_API;
148065
148028
  var init_register_bundle = __esm({
148066
148029
  "../store-release/register-bundle.ts"() {
148067
148030
  init_paths2();
148068
- init_store_spec();
148031
+ init_embedded_bundles();
148069
148032
  init_preflight();
148070
148033
  ASC_API = "https://api.appstoreconnect.apple.com";
148071
148034
  if (runningAsScript("store-release/register-bundle.ts")) {
@@ -149461,7 +149424,7 @@ __export(credential_profile_exports, {
149461
149424
  profilePath: () => profilePath,
149462
149425
  resolveStoreCredentials: () => resolveStoreCredentials
149463
149426
  });
149464
- import { existsSync as existsSync70, readFileSync as readFileSync82 } from "node:fs";
149427
+ import { existsSync as existsSync70, readFileSync as readFileSync81 } from "node:fs";
149465
149428
  import { homedir as homedir6 } from "node:os";
149466
149429
  import { join as join70 } from "node:path";
149467
149430
  function credentialsDir(home = homedir6()) {
@@ -149504,7 +149467,7 @@ function resolveStoreCredentials(opts) {
149504
149467
  const { app, cfg } = opts;
149505
149468
  const env = opts.env ?? process.env;
149506
149469
  const home = opts.home ?? homedir6();
149507
- const read = opts.readProfile ?? ((p2) => readFileSync82(p2, "utf8"));
149470
+ const read = opts.readProfile ?? ((p2) => readFileSync81(p2, "utf8"));
149508
149471
  const exists = opts.profileExists ?? existsSync70;
149509
149472
  const ios = cfg.ios ?? {};
149510
149473
  const flagName = opts.profileFlag?.trim();
@@ -149571,7 +149534,7 @@ var init_credential_profile = __esm({
149571
149534
 
149572
149535
  // ../store-release/iap-credentials.ts
149573
149536
  import { createHash as createHash35 } from "node:crypto";
149574
- import { existsSync as existsSync71, readFileSync as readFileSync83, realpathSync as realpathSync11 } from "node:fs";
149537
+ import { existsSync as existsSync71, readFileSync as readFileSync82, realpathSync as realpathSync11 } from "node:fs";
149575
149538
  import { homedir as homedir7 } from "node:os";
149576
149539
  function accountFingerprint(keyId, issuerId) {
149577
149540
  return `sha256:${createHash35("sha256").update(`${issuerId}:${keyId}`).digest("hex").slice(0, 16)}`;
@@ -149605,7 +149568,7 @@ function canonicalKeyPath(path2, profile, realpath) {
149605
149568
  function resolveIapCredentials(options) {
149606
149569
  const { target } = options;
149607
149570
  const home = options.home ?? homedir7();
149608
- const readFile3 = options.readFile ?? ((p2) => readFileSync83(p2, "utf8"));
149571
+ const readFile3 = options.readFile ?? ((p2) => readFileSync82(p2, "utf8"));
149609
149572
  const realpath = options.realpath ?? realpathSync11;
149610
149573
  const profile = requireExplicitProfile(options.profileFlag, target);
149611
149574
  const creds = resolveStoreCredentials({
@@ -150062,7 +150025,7 @@ __export(store_iap_exports, {
150062
150025
  runStoreIap: () => runStoreIap
150063
150026
  });
150064
150027
  import { randomUUID as randomUUID7 } from "node:crypto";
150065
- import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync34, readFileSync as readFileSync84, rmSync as rmSync18, writeFileSync as writeFileSync29 } from "node:fs";
150028
+ import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync34, readFileSync as readFileSync83, rmSync as rmSync18, writeFileSync as writeFileSync28 } from "node:fs";
150066
150029
  import { homedir as homedir8, hostname } from "node:os";
150067
150030
  import { join as join71 } from "node:path";
150068
150031
  function scrubDeep(value, scrub) {
@@ -150390,7 +150353,7 @@ function fileJournal(path2) {
150390
150353
  }
150391
150354
  function readLockSummary(path2) {
150392
150355
  try {
150393
- const { pid, host, at: at2 } = JSON.parse(readFileSync84(path2, "utf8"));
150356
+ const { pid, host, at: at2 } = JSON.parse(readFileSync83(path2, "utf8"));
150394
150357
  return `pid ${pid} on ${host} since ${at2}`;
150395
150358
  } catch {
150396
150359
  return "unreadable lock";
@@ -150400,7 +150363,7 @@ function acquireApplyLock(dir, appleAppId) {
150400
150363
  const path2 = join71(dir, "apply.lock");
150401
150364
  const stamp = JSON.stringify({ pid: process.pid, host: hostname(), at: (/* @__PURE__ */ new Date()).toISOString(), token: randomUUID7() });
150402
150365
  try {
150403
- writeFileSync29(path2, stamp, { flag: "wx", mode: 384 });
150366
+ writeFileSync28(path2, stamp, { flag: "wx", mode: 384 });
150404
150367
  } catch (e2) {
150405
150368
  if (e2.code !== "EEXIST") throw e2;
150406
150369
  throw new Error(
@@ -150410,7 +150373,7 @@ function acquireApplyLock(dir, appleAppId) {
150410
150373
  return () => {
150411
150374
  let current = "";
150412
150375
  try {
150413
- current = readFileSync84(path2, "utf8");
150376
+ current = readFileSync83(path2, "utf8");
150414
150377
  } catch {
150415
150378
  return;
150416
150379
  }
@@ -150434,7 +150397,7 @@ async function confirmOnTerminal(question) {
150434
150397
  }
150435
150398
  function defaultStoreIapDeps() {
150436
150399
  return {
150437
- readFile: (path2) => readFileSync84(path2, "utf8"),
150400
+ readFile: (path2) => readFileSync83(path2, "utf8"),
150438
150401
  writeFileAtomic,
150439
150402
  resolveCredentials: ({ profileFlag, target }) => resolveIapCredentials({ profileFlag, target }),
150440
150403
  createApi: (key2) => createIapApi(createAscClient({ key: key2 })),
@@ -150897,7 +150860,7 @@ __export(preflight_app_exports, {
150897
150860
  preflightApp: () => preflightApp,
150898
150861
  profileAccount: () => profileAccount
150899
150862
  });
150900
- import { readFileSync as readFileSync85, existsSync as existsSync72, readdirSync as readdirSync33, statSync as statSync18 } from "node:fs";
150863
+ import { readFileSync as readFileSync84, existsSync as existsSync72, readdirSync as readdirSync33, statSync as statSync18 } from "node:fs";
150901
150864
  import { createHash as createHash37 } from "node:crypto";
150902
150865
  import { join as join72 } from "node:path";
150903
150866
  function analyze(projectYml, storeConfig, icon, account) {
@@ -150963,8 +150926,8 @@ function profileAccount(app, storeConfig, opts = {}) {
150963
150926
  }
150964
150927
  }
150965
150928
  async function preflightApp(app, opts = {}) {
150966
- const projectYml = existsSync72(iosProjectYml(app)) ? readFileSync85(iosProjectYml(app), "utf8") : "";
150967
- const storeConfig = existsSync72(storeConfigPath(app)) ? readFileSync85(storeConfigPath(app), "utf8") : "";
150929
+ const projectYml = existsSync72(iosProjectYml(app)) ? readFileSync84(iosProjectYml(app), "utf8") : "";
150930
+ const storeConfig = existsSync72(storeConfigPath(app)) ? readFileSync84(storeConfigPath(app), "utf8") : "";
150968
150931
  if (!storeConfig) return [{ level: "error", message: `no apps/${app}/store/store.config.yaml \u2014 run /setup-store-signing first.` }];
150969
150932
  const findings = analyze(
150970
150933
  projectYml,
@@ -151123,7 +151086,7 @@ function playListingAssets(app, locale = "en-US") {
151123
151086
  for (const name of names) {
151124
151087
  const p2 = join72(dir, name);
151125
151088
  try {
151126
- if (statSync18(p2).isFile()) return { name, bytes: readFileSync85(p2) };
151089
+ if (statSync18(p2).isFile()) return { name, bytes: readFileSync84(p2) };
151127
151090
  } catch {
151128
151091
  }
151129
151092
  }
@@ -151163,7 +151126,7 @@ function listScreenshots(app, locale = "en-US") {
151163
151126
  const flat = join72(storeDir(app), "screenshots", locale);
151164
151127
  if (existsSync72(flat)) {
151165
151128
  for (const png of readdirSync33(flat).filter((n2) => n2.endsWith(".png"))) {
151166
- const sz = pngSize(readFileSync85(join72(flat, png)));
151129
+ const sz = pngSize(readFileSync84(join72(flat, png)));
151167
151130
  if (sz) out2.push({ name: png, w: sz.w, h: sz.h });
151168
151131
  }
151169
151132
  }
@@ -151173,7 +151136,7 @@ function listScreenshots(app, locale = "en-US") {
151173
151136
  const d2 = join72(legacy, deviceDir);
151174
151137
  if (!statSync18(d2).isDirectory()) continue;
151175
151138
  for (const png of readdirSync33(d2).filter((n2) => n2.endsWith(".png"))) {
151176
- const sz = pngSize(readFileSync85(join72(d2, png)));
151139
+ const sz = pngSize(readFileSync84(join72(d2, png)));
151177
151140
  if (sz) out2.push({ name: `${deviceDir}/${png}`, w: sz.w, h: sz.h });
151178
151141
  }
151179
151142
  }
@@ -151187,7 +151150,7 @@ function placeholderHashes2() {
151187
151150
  const p2 = join72(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
151188
151151
  try {
151189
151152
  if (!statSync18(p2).isFile()) continue;
151190
- return [LEGACY_PLACEHOLDER_SHA2562, createHash37("sha256").update(readFileSync85(p2)).digest("hex")];
151153
+ return [LEGACY_PLACEHOLDER_SHA2562, createHash37("sha256").update(readFileSync84(p2)).digest("hex")];
151191
151154
  } catch {
151192
151155
  }
151193
151156
  }
@@ -151223,7 +151186,7 @@ async function appIconState(iosDir) {
151223
151186
  const p2 = join72(iosDir, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
151224
151187
  try {
151225
151188
  if (!statSync18(p2).isFile()) continue;
151226
- const bytes2 = readFileSync85(p2);
151189
+ const bytes2 = readFileSync84(p2);
151227
151190
  const hash2 = createHash37("sha256").update(bytes2).digest("hex");
151228
151191
  const pixels = await pixelIssues(bytes2);
151229
151192
  return {
@@ -151284,6 +151247,188 @@ var init_preflight_app = __esm({
151284
151247
  }
151285
151248
  });
151286
151249
 
151250
+ // ../store-release/version.ts
151251
+ var version_exports = {};
151252
+ __export(version_exports, {
151253
+ bumpVersion: () => bumpVersion,
151254
+ readAndroidVersion: () => readAndroidVersion,
151255
+ readAndroidVersionName: () => readAndroidVersionName,
151256
+ readIosMarketingVersion: () => readIosMarketingVersion,
151257
+ readIosVersion: () => readIosVersion,
151258
+ readIosVersionStrings: () => readIosVersionStrings,
151259
+ readIosVersionStringsOrNull: () => readIosVersionStringsOrNull,
151260
+ readTargetVersionKeys: () => readTargetVersionKeys,
151261
+ readTargetVersionStrings: () => readTargetVersionStrings,
151262
+ setAndroidVersion: () => setAndroidVersion,
151263
+ setIosVersion: () => setIosVersion,
151264
+ stampIosVersionStrings: () => stampIosVersionStrings,
151265
+ stampTargetVersion: () => stampTargetVersion,
151266
+ stampVersionKeys: () => stampVersionKeys
151267
+ });
151268
+ import { readFileSync as readFileSync85, writeFileSync as writeFileSync29 } from "node:fs";
151269
+ function readIosVersion(projectYml) {
151270
+ const marketing = matchScalar(projectYml, "CFBundleShortVersionString");
151271
+ const build3 = matchScalar(projectYml, "CFBundleVersion");
151272
+ if (marketing === null || build3 === null) {
151273
+ throw new Error("project.yml is missing CFBundleShortVersionString / CFBundleVersion");
151274
+ }
151275
+ return { marketing, build: Number(build3) };
151276
+ }
151277
+ function setIosVersion(projectYml, v2) {
151278
+ let out2 = replaceScalar(projectYml, "CFBundleShortVersionString", v2.marketing);
151279
+ out2 = replaceScalar(out2, "CFBundleVersion", String(v2.build));
151280
+ out2 = out2.replace(
151281
+ /(^[ \t]*# >>> himalaya:live-activity:target[^\n]*\n)([\s\S]*?)(^[ \t]*# <<< himalaya:live-activity:target[^\n]*$)/m,
151282
+ (_match, start, body, end) => {
151283
+ if (!body.trim()) return start + body + end;
151284
+ return start + replaceScalar(replaceScalar(body, "CFBundleShortVersionString", v2.marketing), "CFBundleVersion", String(v2.build)) + end;
151285
+ }
151286
+ );
151287
+ return out2;
151288
+ }
151289
+ function readIosVersionStrings(projectYml) {
151290
+ const marketing = matchScalar(projectYml, "CFBundleShortVersionString");
151291
+ const build3 = matchScalar(projectYml, "CFBundleVersion");
151292
+ if (marketing === null || build3 === null) {
151293
+ throw new Error("project.yml is missing CFBundleShortVersionString / CFBundleVersion");
151294
+ }
151295
+ return { marketing, build: build3 };
151296
+ }
151297
+ function readIosVersionStringsOrNull(projectYml) {
151298
+ try {
151299
+ return readIosVersionStrings(projectYml);
151300
+ } catch {
151301
+ return null;
151302
+ }
151303
+ }
151304
+ function stampIosVersionStrings(projectYml, v2) {
151305
+ return replaceScalar(replaceScalar(projectYml, "CFBundleShortVersionString", v2.marketing), "CFBundleVersion", v2.build);
151306
+ }
151307
+ function stampVersionKeys(projectYml, v2) {
151308
+ let out2 = projectYml;
151309
+ if (v2.marketing !== void 0) out2 = replaceScalar(out2, "CFBundleShortVersionString", v2.marketing);
151310
+ if (v2.build !== void 0) out2 = replaceScalar(out2, "CFBundleVersion", v2.build);
151311
+ return out2;
151312
+ }
151313
+ function targetBlock(lines, target) {
151314
+ const head = new RegExp(`^ {2}${target.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}:\\s*$`);
151315
+ const start = lines.findIndex((l2) => head.test(l2));
151316
+ if (start < 0) return null;
151317
+ let end = start + 1;
151318
+ while (end < lines.length && !/^ {0,2}\S/.test(lines[end])) end++;
151319
+ return { start, end };
151320
+ }
151321
+ function readTargetVersionStrings(projectYml, target) {
151322
+ const lines = projectYml.split("\n");
151323
+ const block = targetBlock(lines, target);
151324
+ if (!block) return null;
151325
+ const body = lines.slice(block.start + 1, block.end).join("\n");
151326
+ const marketing = matchScalar(body, "CFBundleShortVersionString");
151327
+ const build3 = matchScalar(body, "CFBundleVersion");
151328
+ return marketing !== null && build3 !== null ? { marketing, build: build3 } : null;
151329
+ }
151330
+ function readTargetVersionKeys(projectYml, target) {
151331
+ const lines = projectYml.split("\n");
151332
+ const block = targetBlock(lines, target);
151333
+ if (!block) return null;
151334
+ const body = lines.slice(block.start + 1, block.end).join("\n");
151335
+ const marketing = matchScalar(body, "CFBundleShortVersionString");
151336
+ const build3 = matchScalar(body, "CFBundleVersion");
151337
+ if (marketing === null && build3 === null) return null;
151338
+ return { ...marketing !== null ? { marketing } : {}, ...build3 !== null ? { build: build3 } : {} };
151339
+ }
151340
+ function stampTargetVersion(yml, target, v2) {
151341
+ const lines = yml.split("\n");
151342
+ const block = targetBlock(lines, target);
151343
+ if (!block) return yml;
151344
+ for (let i2 = block.start + 1; i2 < block.end; i2++) {
151345
+ const inline = /^ {4}info:\s*\{\s*path:\s*([^\s,}]+)\s*\}\s*(#.*)?$/.exec(lines[i2]);
151346
+ if (inline) {
151347
+ lines.splice(i2, 1, " info:", ` path: ${inline[1]}`);
151348
+ block.end++;
151349
+ break;
151350
+ }
151351
+ }
151352
+ const { start, end } = block;
151353
+ const want = {};
151354
+ if (v2.marketing !== void 0) want.CFBundleShortVersionString = v2.marketing;
151355
+ if (v2.build !== void 0) want.CFBundleVersion = v2.build;
151356
+ const seen = /* @__PURE__ */ new Set();
151357
+ let infoAt = -1;
151358
+ let propsAt = -1;
151359
+ for (let i2 = start + 1; i2 < end; i2++) {
151360
+ if (/^ {4}info:\s*$/.test(lines[i2])) infoAt = i2;
151361
+ if (infoAt >= 0 && /^ {6}properties:\s*$/.test(lines[i2]) && lines.slice(infoAt + 1, i2).every((l2) => !/^ {4}\S/.test(l2))) propsAt = i2;
151362
+ const m2 = /^(\s+)(CFBundleShortVersionString|CFBundleVersion):\s*.*$/.exec(lines[i2]);
151363
+ if (m2 && m2[2] in want) {
151364
+ lines[i2] = `${m2[1]}${m2[2]}: "${want[m2[2]]}"`;
151365
+ seen.add(m2[2]);
151366
+ }
151367
+ }
151368
+ const missing = Object.keys(want).filter((k2) => !seen.has(k2)).map((k2) => ` ${k2}: "${want[k2]}"`);
151369
+ if (missing.length && propsAt >= 0) {
151370
+ lines.splice(propsAt + 1, 0, ...missing);
151371
+ } else if (missing.length && infoAt >= 0) {
151372
+ let after = infoAt + 1;
151373
+ while (after < end && /^ {6}\S/.test(lines[after])) after++;
151374
+ lines.splice(after, 0, " properties:", ...missing);
151375
+ }
151376
+ return lines.join("\n");
151377
+ }
151378
+ function readIosMarketingVersion(projectYml) {
151379
+ return matchScalar(projectYml, "CFBundleShortVersionString");
151380
+ }
151381
+ function scalarRe(key2) {
151382
+ return new RegExp(`^(\\s*${key2}:\\s*)("?)([^"\\n#]*?)("?)(\\s*(?:#.*)?)$`, "m");
151383
+ }
151384
+ function matchScalar(content, key2) {
151385
+ const m2 = scalarRe(key2).exec(content);
151386
+ return m2 ? m2[3].trim() : null;
151387
+ }
151388
+ function replaceScalar(content, key2, value) {
151389
+ const re2 = scalarRe(key2);
151390
+ if (!re2.test(content)) throw new Error(`could not locate \`${key2}:\` in project.yml`);
151391
+ return content.replace(re2, (_full, pre, openQ, _oldVal, _closeQ, tail) => {
151392
+ const q2 = openQ ? '"' : "";
151393
+ return `${pre}${q2}${value}${q2}${tail}`;
151394
+ });
151395
+ }
151396
+ function readAndroidVersion(gradle) {
151397
+ const name = /(\bversionName\s*=\s*")([^"]*)(")/.exec(gradle);
151398
+ const code = /(\bversionCode\s*=\s*)(\d+)/.exec(gradle);
151399
+ if (!name || !code) throw new Error("build.gradle.kts is missing versionName / versionCode");
151400
+ return { marketing: name[2], build: Number(code[2]) };
151401
+ }
151402
+ function readAndroidVersionName(gradle) {
151403
+ const name = /(\bversionName\s*=\s*")([^"]*)(")/.exec(gradle);
151404
+ return name ? name[2] : null;
151405
+ }
151406
+ function setAndroidVersion(gradle, v2) {
151407
+ if (!/\bversionName\s*=\s*"/.test(gradle) || !/\bversionCode\s*=\s*\d+/.test(gradle)) {
151408
+ throw new Error("build.gradle.kts is missing versionName / versionCode");
151409
+ }
151410
+ return gradle.replace(/(\bversionName\s*=\s*")[^"]*(")/, `$1${v2.marketing}$2`).replace(/(\bversionCode\s*=\s*)\d+/, `$1${v2.build}`);
151411
+ }
151412
+ function bumpVersion(app, opts) {
151413
+ const iosPath = iosProjectYml(app);
151414
+ const gradlePath = androidGradle(app);
151415
+ const iosYml = readFileSync85(iosPath, "utf8");
151416
+ const gradle = readFileSync85(gradlePath, "utf8");
151417
+ const current = readIosVersion(iosYml);
151418
+ const next = {
151419
+ marketing: opts.marketing ?? current.marketing,
151420
+ build: opts.build === "increment" || opts.build === void 0 ? current.build + (opts.build === "increment" ? 1 : 0) : opts.build
151421
+ };
151422
+ writeFileSync29(iosPath, setIosVersion(iosYml, next));
151423
+ writeFileSync29(gradlePath, setAndroidVersion(gradle, next));
151424
+ return next;
151425
+ }
151426
+ var init_version = __esm({
151427
+ "../store-release/version.ts"() {
151428
+ init_paths2();
151429
+ }
151430
+ });
151431
+
151287
151432
  // ../store-release/asc-status.ts
151288
151433
  var asc_status_exports = {};
151289
151434
  __export(asc_status_exports, {
@@ -225,6 +225,31 @@ twice.
225
225
  An early return in the build now reports a **FAILURE with the reason** rather than
226
226
  exiting 0: a job that produced no artifact must never read `SUCCESS` with no link.
227
227
 
228
+ ### Embedded bundles (app extensions, a companion watch app)
229
+
230
+ An app that embeds a bundle — an app extension (a widget, a Live Activity) or a companion watch
231
+ app (`watch.mode: "companion"`) — is signed bundle by bundle: Apple requires every embedded bundle
232
+ to carry a profile for **its own** id, under the host app's team and certificate.
233
+
234
+ - The build lists the bundles the app embeds and asks the signing route for each,
235
+ `GET /v1/dist/signing?embedded=<suffix>`. It mints `<host id>.<suffix>` (`<host id>.widgets`,
236
+ `<host id>.watchkitapp`) with the same account, profile type and capabilities as the host. Only
237
+ the suffixes the job's shell declares it embeds are accepted (an explicit list per shell, kept
238
+ equal to its project) — so the job's token still pins the host app and can create only that
239
+ fixed set of ids, each idempotent. As with the host, the job's status is not checked, so a
240
+ retried job gets the same identities as its first attempt. A refusal on that call (an older deployment whose list
241
+ lacks the suffix) falls back the same way as the version skew below.
242
+ - App Groups stay off in QA builds: the group identifier itself is not registered, so a kept
243
+ widget or Live Activity signs and runs but its shared container is inert.
244
+ - Each extension target and the watch app are pinned to their own profile — the watch app is
245
+ re-identified under the host's minted id and carries the host's version — and the export lists
246
+ every profile. The store archive signs exactly the same list of bundles.
247
+ - **Version skew is handled.** A deployment that predates `?embedded=` answers with the host's
248
+ identity; the build detects that and falls back to the earlier behaviour — extensions removed,
249
+ a companion watch app refused — rather than sign an extension with the host's profile.
250
+ - Borrowed ids (`--borrow-ios-id`) and `--signing byo` still remove extensions and refuse a watch
251
+ app: they carry one profile for one bundle.
252
+
228
253
  ### If the release's branch was deleted, the build cannot run — and says so badly
229
254
 
230
255
  The pool bootstraps a job by cloning `wix-private/himalaya` and then running
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1273.0",
3
+ "version": "0.1274.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": [
@@ -69,5 +69,5 @@
69
69
  "artifactId": "himalaya-cli"
70
70
  }
71
71
  },
72
- "falconPackageHash": "f0c39037eb2a54b21ac2a62c2902e69d3d5a0240d69f8ddb7a757edc"
72
+ "falconPackageHash": "06f55428e38e6292bf20ac37016f823931b4f6a88c5666fc9c8818b3"
73
73
  }